getTyped to cleanup this.get('...') (#4334)

* getTyped to cleanup this.get('...')

* shorten

* Adjust
This commit is contained in:
Jaco
2021-12-16 07:51:52 +02:00
committed by GitHub
parent 1113f6cfdd
commit 5c8bad5bb9
15 changed files with 77 additions and 74 deletions
+4
View File
@@ -64,6 +64,10 @@ export class Json extends Map<string, any> implements Codec {
return compareMap(this, other);
}
public getT <T> (key: string): T {
return this.get(key) as unknown as T;
}
/**
* @description Unimplemented, will throw
*/
@@ -137,6 +137,10 @@ export class Struct<
return Object.keys(this.#Types);
}
public getT <T> (key: string): T {
return this.get(key) as unknown as T;
}
/**
* @description Checks if the value is an empty value
*/