Js
t
JS object type
type t<'a> = 'a constraint 'a = {..}
Internal
opaqueFullApply
let opaqueFullApply: 'a => 'a
run
let run: (. unit) => 'a => 'a
opaque
let opaque: 'a => 'a
null
Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.
type null<'a> = Value('a) | Null
undefined
A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t.
type undefined<+'a>
nullable
type nullable<'a> = Value('a) | Null | Undefined
null_undefined
type null_undefined<'a> = nullable<'a>
toOption
let toOption: nullable<'a> => option<'a>
undefinedToOption
let undefinedToOption: undefined<'a> => option<'a>
nullToOption
let nullToOption: null<'a> => option<'a>
isNullable
let isNullable: nullable<'a> => bool
import
let import: 'a => promise<'a>
testAny
The same as {!test} except that it is more permissive on the types of input
let testAny: 'a => bool
promise
The promise type, defined here for interoperation across packages.
@deprecated please use Js.Promise
.
type promise<+'a, +'e>
null
The same as empty in Js.Null
. Compiles to null
.
let null: null<'a>
undefined
The same as empty Js.Undefined
. Compiles to undefined
.
let undefined: undefined<'a>
typeof
typeof x
will be compiled as typeof x
in JS. Please consider functions in
Js.Types
for a type safe way of reflection.
let typeof: 'a => string
log
Equivalent to console.log any value.
let log: 'a => unit
log2
let log2: ('a, 'b) => unit
log3
let log3: ('a, 'b, 'c) => unit
log4
let log4: ('a, 'b, 'c, 'd) => unit
logMany
A convenience function to console.log more than 4 arguments
let logMany: array<'a> => unit
eqNull
let eqNull: ('a, null<'a>) => bool
eqUndefined
let eqUndefined: ('a, undefined<'a>) => bool
eqNullable
let eqNullable: ('a, nullable<'a>) => bool
unsafe_lt
unsafe_lt(a, b)
will be compiled as a < b
.
It is marked as unsafe, since it is impossible
to give a proper semantics for comparision which applies to any type
let unsafe_lt: ('a, 'a) => bool
unsafe_le
unsafe_le(a, b) will be compiled as
a <= b.
See also
Js.unsafe_lt`.
let unsafe_le: ('a, 'a) => bool
unsafe_gt
unsafe_gt(a, b)
will be compiled as a > b
.
See also Js.unsafe_lt
.
let unsafe_gt: ('a, 'a) => bool
unsafe_ge
unsafe_ge(a, b)
will be compiled as a >= b
.
See also Js.unsafe_lt
.
let unsafe_ge: ('a, 'a) => bool