createAssetValidator
See source codeCreate a validator for an asset record type.
function createAssetValidator<Type extends string, Props extends JsonObject>(
type: Type,
props: T.Validator<Props>
): T.ObjectValidator<
import('@tldraw/utils').Expand<
{
[P in
| 'id'
| 'meta'
| 'typeName'
| (undefined extends Props ? never : 'props')
| (undefined extends Type ? never : 'type')]: {
id: TLAssetId
meta: JsonObject
props: Props
type: Type
typeName: 'asset'
}[P]
} & {
[P_1 in
| (undefined extends Props ? 'props' : never)
| (undefined extends Type ? 'type' : never)]?:
| {
id: TLAssetId
meta: JsonObject
props: Props
type: Type
typeName: 'asset'
}[P_1]
| undefined
}
>
>
Parameters
Name | Description |
---|---|
|
The type of the asset |
|
The validator for the asset's props |
Returns
T.ObjectValidator<
import('@tldraw/utils').Expand<
{
[P in
| 'id'
| 'meta'
| 'typeName'
| (undefined extends Props ? never : 'props')
| (undefined extends Type ? never : 'type')]: {
id: TLAssetId
meta: JsonObject
props: Props
type: Type
typeName: 'asset'
}[P]
} & {
[P_1 in
| (undefined extends Props ? 'props' : never)
| (undefined extends Type ? 'type' : never)]?:
| {
id: TLAssetId
meta: JsonObject
props: Props
type: Type
typeName: 'asset'
}[P_1]
| undefined
}
>
>
Prev
useUiEventsNext
createBindingId