@mocanvas/editor · function
declare function createCustomRecordTypeMap(records: Readonly<Record<string, CustomRecordInfo<string>>> | undefined): RecordType<UnknownCustomRecord, any>One RecordType covering every declared custom type.
Custom records all share the custom typeName, and the store's type map is
keyed by typeName — so the map gets one entry, not one per declaration.
Validation and defaults dispatch on the record's own type, which is what
keeps a review from being validated as a checklist.
A record whose type was never declared is refused rather than waved
through: it would otherwise round-trip unvalidated and look like data the
schema understood. With nothing declared the entry still exists and refuses
everything, which is the same answer arrived at sooner.
Mentioned here
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.