TypeofResult
Syntax
type TypeofResult
Represents the result of the typeof
keyword.
Example
import { TypeofResult } from 'potence';
function checkType(object: unknown, type: TypeofResult): boolean {
return typeof object === type;
}
console.log(checkType('foo', 'string')); // true
Remarks
The type expands into 'bigint' | 'boolean' | 'function' | 'number' | 'object' |
'string' | 'symbol' | 'undefined'
. Note that these are the string
s that may
be returned by the typeof
keyword, not their respective actual types. To get
the actual type from a TypeofResult
, use
Typeof<T>
.