You are viewing docs for an older version of Rescript.
Go to latest version.
Types
Provide utilities for manipulating JS types.
symbol
RESCRIPT
type symbolJs symbol type (only available in ES6)
bigint_val
RESCRIPT
type bigint_valJs bigint type only available in ES2020
obj_val
RESCRIPT
type obj_valundefined_val
RESCRIPT
type undefined_valThis type has only one value undefined
null_val
RESCRIPT
type null_valThis type has only one value null
function_val
RESCRIPT
type function_valt
RESCRIPT
type t<_> =
| Undefined: t<undefined_val>
| Null: t<null_val>
| Boolean: t<bool>
| Number: t<float>
| String: t<string>
| Function: t<function_val>
| Object: t<obj_val>
| Symbol: t<symbol>
| BigInt: t<bigint_val>test
RESCRIPT
let test: ('a, t<'b>) => booltest(value, t) returns true if value is typeof t, otherwise false.
This is useful for doing runtime reflection on any given value.
Examples
RESCRIPTtest("test", String) == true
test(() => true, Function) == true
test("test", Boolean) == false
tagged_t
RESCRIPT
type tagged_t =
| JSFalse
| JSTrue
| JSNull
| JSUndefined
| JSNumber(float)
| JSString(string)
| JSFunction(function_val)
| JSObject(obj_val)
| JSSymbol(symbol)
| JSBigInt(bigint_val)classify
RESCRIPT
let classify: 'a => tagged_t