Skip to content

isWeakRef

The isWeakRef function checks if the provided value is an instance of WeakRef.

Syntax

typescript
isWeakRef(value: any): value is WeakRef<any>;

Parameters

ParameterTypeDescription
valueanyValue to be checked

Returns

TypeDescription
booleanTrue if it is an instance of WeakRef

Examples

typescript
isWeakRef(new WeakRef({})); // => true
isWeakRef({}); // => false

Notes

  • Useful for validating objects before performing WeakRef-specific operations.

References

Released under the MIT License.