TLAssetPartial
See source codePartial type for TLAsset allowing optional properties except id and type. Useful for creating or updating assets where not all properties need to be specified.
type TLAssetPartial<T extends TLAsset = TLAsset> = T extends T
? {
id: TLAssetId
meta?: Partial<T['meta']>
props?: Partial<T['props']>
type: T['type']
} & Partial<Omit<T, 'id' | 'meta' | 'props' | 'type'>>
: never
Example
// Create a partial asset for updating
const partialAsset: TLAssetPartial<TLImageAsset> = {
id: 'asset:image123',
type: 'image',
props: {
w: 800, // Only updating width
},
}
// Use in asset updates
editor.updateAssets([partialAsset])
Prev
TLAssetIdNext
TLAssetShape