feat: add WeakRef interface

This commit is contained in:
eric_wang 2022-06-12 18:01:46 +08:00
parent 335c5ee25f
commit 4fe89357fc
3 changed files with 98 additions and 2 deletions

View file

@ -49,3 +49,13 @@ export interface ObservableLike {
// eslint-disable-next-line @typescript-eslint/ban-types
export type Falsy = false | 0 | 0n | '' | null | undefined;
export interface WeakRef<T extends object> {
readonly [Symbol.toStringTag]: "WeakRef";
/**
* Returns the WeakRef instance's target object, or undefined if the target object has been
* reclaimed.
*/
deref(): T | undefined;
}