refactor: refine ts type (#322)

This commit is contained in:
Zixuan Chen 2024-04-18 09:47:14 +08:00 committed by GitHub
parent a32b75ad3b
commit ce992b9de0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -187,7 +187,7 @@ declare module "loro-wasm" {
* const map = doc.getMap("map");
* ```
*/
getMap<Key extends keyof T>(
getMap<Key extends (keyof T) | ContainerID>(
name: Key,
): T[Key] extends LoroMap ? T[Key] : LoroMap;
/**
@ -204,7 +204,7 @@ declare module "loro-wasm" {
* const list = doc.getList("list");
* ```
*/
getList<Key extends keyof T>(
getList<Key extends (keyof T) | ContainerID>(
name: Key,
): T[Key] extends LoroList ? T[Key] : LoroList;
/**
@ -221,7 +221,7 @@ declare module "loro-wasm" {
* const tree = doc.getTree("tree");
* ```
*/
getTree<Key extends keyof T>(
getTree<Key extends (keyof T) | ContainerID>(
name: Key,
): T[Key] extends LoroTree ? T[Key] : LoroTree;
getText(key: string | ContainerID): LoroText;