fix: correct TypeScript typing for Automerge.from() optimization

Use double type assertion for TLStoreSnapshot → Record<string, unknown>
to satisfy Automerge.from() type constraints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-01-03 11:56:49 +01:00
parent 06f41e8fec
commit 1dc8f4f1b8
1 changed files with 2 additions and 1 deletions

View File

@ -157,7 +157,8 @@ export class AutomergeR2Storage {
} }
// Automerge.from() is optimized for creating documents from existing state // Automerge.from() is optimized for creating documents from existing state
const doc = Automerge.from<TLStoreSnapshot>(initialState) // Type assertion needed because TLStoreSnapshot doesn't have index signature
const doc = Automerge.from(initialState as unknown as Record<string, unknown>) as Automerge.Doc<TLStoreSnapshot>
const conversionTime = Date.now() - startTime const conversionTime = Date.now() - startTime
console.log(`⏱️ Automerge conversion took ${conversionTime}ms for ${recordCount} records`) console.log(`⏱️ Automerge conversion took ${conversionTime}ms for ${recordCount} records`)