Skip to main content

Function: cast()

cast<T>(value: unknown): T

Casts any value to T

Note that this function is not type-safe, and may cause runtime errors if used incorrectly. Also note that this function is effectively useless in a JavaScript project, it only serves a purpose for TypeScript projects.

Type parameters

Type parameter
T

Parameters

ParameterTypeDescription
valueunknownThe value to cast to another type

Returns

T

The value but as type T

Source

lib/cast.ts:10