IdOf
Utility type that extracts the ID type from a record type. This is useful when you need to work with record IDs without having the full record type.
type IdOf<R extends UnknownRecord> = R["id"];Example
interface Book extends BaseRecord<"book", RecordId<Book>> {
title: string;
author: string;
}
// Extract the ID type from the Book record
type BookId = IdOf<Book>; // RecordId<Book>
function findBook(id: IdOf<Book>): Book | undefined {
return store.get(id);
}Prev
ChangeSourceNext
Migration