@mocanvas/editor · interface

CustomRecordInfo

interface CustomRecordInfo<Type extends string = string>

What an app tells createTLSchema about one custom record type.

props is a validator per prop, exactly as a shape util's static props is. scope decides whether the records are persisted and shared (document), local to this browser (session) or shared but never saved (presence) — the same three choices every built-in record type makes.


Properties · 6

readonly ephemeralKeys?: Readonly<Record<string, boolean>> | undefined

Props whose changes are not "real" document changes — transient flags the store should not treat as an edit.

readonly getDefaultProps?: (() => CustomRecordPropsForType<Type>) | undefined

Props supplied when the caller omits them.

readonly migrations?: PropsMigrations | undefined

How the props have changed over time; see createCustomRecordMigrationSequence.

readonly props: CustomRecordPropsForType<Type> extends infer P ? P extends object ? RecordProps<{

One validator per prop.

readonly scope?: RecordScope | undefined

Where the records live. Defaults to document: a custom record almost always *is* document data, which is the reason for declaring one.

readonly type: Type

The type discriminant, e.g. "review". Must be unique across custom types.

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.