UNPKG

@tldraw/store

Version:

tldraw infinite canvas SDK (store).

8 lines (7 loc) 851 B
{ "version": 3, "sources": ["../../src/lib/BaseRecord.ts"], "sourcesContent": ["/** @public */\nexport type RecordId<R extends UnknownRecord> = string & { __type__: R }\n\n/** @public */\nexport type IdOf<R extends UnknownRecord> = R['id']\n\n/**\n * The base record that all records must extend.\n *\n * @public\n */\nexport interface BaseRecord<TypeName extends string, Id extends RecordId<UnknownRecord>> {\n\treadonly id: Id\n\treadonly typeName: TypeName\n}\n\n/** @public */\nexport type UnknownRecord = BaseRecord<string, RecordId<UnknownRecord>>\n\nexport function isRecord(record: unknown): record is UnknownRecord {\n\treturn typeof record === 'object' && record !== null && 'id' in record && 'typeName' in record\n}\n"], "mappings": "AAmBO,SAAS,SAAS,QAA0C;AAClE,SAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,QAAQ,UAAU,cAAc;AACzF;", "names": [] }