mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
feat(editor): type safe draft model and transformer (#10486)
This commit is contained in:
@@ -11,7 +11,7 @@ type ModelList<T> =
|
||||
export function matchModels<
|
||||
const Model extends ConstructorType<BlockModel>[],
|
||||
U extends ModelList<Model>[number] = ModelList<Model>[number],
|
||||
>(model: unknown, expected: Model): model is U {
|
||||
>(model: BlockModel | null, expected: Model): model is U {
|
||||
return (
|
||||
!!model && expected.some(expectedModel => model instanceof expectedModel)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user