Public function

Signature
function createShapeValidator<
  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<
  {
    [P in
      | 'id'
      | 'index'
      | 'isLocked'
      | 'meta'
      | 'opacity'
      | 'parentId'
      | 'rotation'
      | 'typeName'
      | 'x'
      | 'y'
      | (undefined extends Props ? never : 'props')
      | (undefined extends Type ? never : 'type')]: TLBaseShape<Type, Props>[P]
  } & {
    [P_1 in
      | (undefined extends Props ? 'props' : never)
      | (undefined extends Type ? 'type' : never)]?:
      | TLBaseShape<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<
  {
    [P in
      | 'id'
      | 'index'
      | 'isLocked'
      | 'meta'
      | 'opacity'
      | 'parentId'
      | 'rotation'
      | 'typeName'
      | 'x'
      | 'y'
      | (undefined extends Props ? never : 'props')
      | (undefined extends Type ? never : 'type')]: TLBaseShape<Type, Props>[P]
  } & {
    [P_1 in
      | (undefined extends Props ? 'props' : never)
      | (undefined extends Type ? 'type' : never)]?:
      | TLBaseShape<Type, Props>[P_1]
      | undefined
  }
>
References

T.ObjectValidator, TLBaseShape

Source

packages/tlschema/src/shapes/TLBaseShape.ts

createShapePropsMigrationSequencecreateTLSchema