createBindingValidator

See source code
function createBindingValidator<
  Type extends string,
  Props extends JsonObject,
  Meta extends JsonObject,
>(
  type: Type,
  props?: {
    [K in keyof Props]: T.Validatable<Props[K]>
  },
  meta?: {
    [K in keyof Meta]: T.Validatable<Meta[K]>
  }
): T.ObjectValidator<
  import('@tldraw/utils').Expand<
    {
      [P in
        | 'fromId'
        | 'id'
        | 'meta'
        | 'toId'
        | 'typeName'
        | (undefined extends Props ? never : 'props')
        | (undefined extends Type ? never : 'type')]: TLBaseBinding<
        Type,
        Props
      >[P]
    } & {
      [P_1 in
        | (undefined extends Props ? 'props' : never)
        | (undefined extends Type ? 'type' : never)]?:
        | TLBaseBinding<Type, Props>[P_1]
        | undefined
    }
  >
>

Parameters

NameDescription

type

Type

props

{
  [K in keyof Props]: T.Validatable<Props[K]>
}

meta

{
  [K in keyof Meta]: T.Validatable<Meta[K]>
}

Returns

T.ObjectValidator<
  import('@tldraw/utils').Expand<
    {
      [P in
        | 'fromId'
        | 'id'
        | 'meta'
        | 'toId'
        | 'typeName'
        | (undefined extends Props ? never : 'props')
        | (undefined extends Type ? never : 'type')]: TLBaseBinding<
        Type,
        Props
      >[P]
    } & {
      [P_1 in
        | (undefined extends Props ? 'props' : never)
        | (undefined extends Type ? 'type' : never)]?:
        | TLBaseBinding<Type, Props>[P_1]
        | undefined
    }
  >
>
Prev
createBindingPropsMigrationSequence
Next
createPresenceStateDerivation