Add .weakRef() (#165)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
Eric(书生) 2022-06-13 15:05:26 +08:00 committed by GitHub
parent 06d217f70c
commit e503a9ec49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View file

@ -49,3 +49,8 @@ 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> { // eslint-disable-line @typescript-eslint/ban-types
readonly [Symbol.toStringTag]: 'WeakRef';
deref(): T | undefined;
}