/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/editor/src/lib/config/defaultAssets.ts
19 строк
610 B
Mime Čuvalo
feature: AssetUtil for extensible asset types (#8031)
03 апр 2026, 12:08
Не верифицирован
03 апр 2026, 12:08
ec0c91e
Код
Авторство
О чём код?
import { TLAssetUtilConstructor } from '../editor/assets/AssetUtil' /** @public */ export type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any> export function checkAssets(customAssets: readonly TLAnyAssetUtilConstructor[]) { const assets = [] as TLAnyAssetUtilConstructor[] const addedCustomAssetTypes = new Set<string>() for (const customAsset of customAssets) { if (addedCustomAssetTypes.has(customAsset.type)) { throw new Error(`Asset type "${customAsset.type}" is defined more than once`) } assets.push(customAsset) addedCustomAssetTypes.add(customAsset.type) } return assets }