From 367975e1ac29f073c20ef6171205f970236ac5be Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Sun, 31 Mar 2024 02:10:49 +0800 Subject: [PATCH] fix: type error --- loro-js/src/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/loro-js/src/index.ts b/loro-js/src/index.ts index 9dfbd964..ae056662 100644 --- a/loro-js/src/index.ts +++ b/loro-js/src/index.ts @@ -179,10 +179,10 @@ export function isContainer(value: any): value is Container { */ export function getType( value: T, -): T extends LoroText ? "Text" - : T extends LoroMap ? "Map" - : T extends LoroTree ? "Tree" - : T extends LoroList ? "List" +): T extends LoroText ? "Text" + : T extends LoroMap ? "Map" + : T extends LoroTree ? "Tree" + : T extends LoroList ? "List" : "Json" { if (isContainer(value)) { return value.kind() as unknown as any; @@ -212,7 +212,7 @@ declare module "loro-wasm" { interface LoroList< T extends any[] = any[], > { - new (): LoroList; + new (): LoroList; insertContainer( pos: number, child: C, @@ -223,13 +223,13 @@ declare module "loro-wasm" { insert(pos: number, value: Value): void; delete(pos: number, len: number): void; subscribe(txn: Loro, listener: Listener): number; - getAttached(): undefined | LoroList; + getAttached(): undefined | LoroList; } interface LoroMap< T extends Record = Record, > { - new (): LoroMap; + new (): LoroMap; getOrCreateContainer( key: string, child: C, @@ -246,8 +246,8 @@ declare module "loro-wasm" { subscribe(txn: Loro, listener: Listener): number; } - interface LoroText { - new (): LoroText; + interface LoroText { + new (): LoroText; insert(pos: number, text: string): void; delete(pos: number, len: number): void; subscribe(txn: Loro, listener: Listener): number; @@ -256,7 +256,7 @@ declare module "loro-wasm" { interface LoroTree< T extends Record = Record, > { - new (): LoroTree; + new (): LoroTree; createNode(parent: TreeID | undefined): LoroTreeNode; move(target: TreeID, parent: TreeID | undefined): void; delete(target: TreeID): void;