UnknownRecord
See source codeA generic type representing any record that extends BaseRecord. This is useful for type constraints when you need to work with records of unknown types, but still want to ensure they follow the BaseRecord structure.
type UnknownRecord = BaseRecord<string, RecordId<UnknownRecord>>
Example
// Function that works with any type of record
function logRecord(record: UnknownRecord): void {
console.log(`Record ${record.id} of type ${record.typeName}`)
}
// Can be used with any record type
const book: Book = {
id: 'book:123' as RecordId<Book>,
typeName: 'book',
title: '1984',
}
const author: Author = {
id: 'author:456' as RecordId<Author>,
typeName: 'author',
name: 'Orwell',
}
logRecord(book) // "Record book:123 of type book"
logRecord(author) // "Record author:456 of type author"
Prev
StoreValidatorsNext
RemoteTLStoreWithStatus