createShapeValidator
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<
import('@tldraw/utils').Expand<
{
[P in T.ExtractRequiredKeys<TLBaseShape<Type, Props>>]: TLBaseShape<
Type,
Props
>[P]
} & {
[P_1 in T.ExtractOptionalKeys<TLBaseShape<Type, Props>>]?:
| TLBaseShape<Type, Props>[P_1]
| undefined
}
>
>
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
Returns
T.ObjectValidator<
import('@tldraw/utils').Expand<
{
[P in T.ExtractRequiredKeys<TLBaseShape<Type, Props>>]: TLBaseShape<
Type,
Props
>[P]
} & {
[P_1 in T.ExtractOptionalKeys<TLBaseShape<Type, Props>>]?:
| TLBaseShape<Type, Props>[P_1]
| undefined
}
>
>