Module Js
type null(+'a);
A value of this type can be either null
or 'a
. This type is the same as type t
in Null
type undefined(+'a);
A value of this type can be either undefined
or 'a
. This type is the same as type t
in Undefined
type nullable(+'a);
A value of this type can be undefined
, null
or 'a
. This type is the same as type t
n Nullable
type re;
The type for JavaScript RegExp
type dict('a);
The type for a simple key-value dictionary abstraction over native JavaScript objects
type iterator('a);
The type for JavaScript iterators
type array_like('a);
The type for array-like objects in JavaScript
type bigint;
The type for JavaScript BigInt
type promise(+'a);
The type for JavaScript Promise
type blob;
The type for JavaScript Blob
type file;
The type for JavaScript File
type arrayBuffer;
type int8Array;
type uint8Array;
type uint8ClampedArray;
type int16Array;
type uint16Array;
type int32Array;
type uint32Array;
type float32Array;
type float64Array;
let toOption: nullable('a) => option('a);
let undefinedToOption: undefined('a) => option('a);
let nullToOption: null('a) => option('a);
let isNullable: nullable('a) => bool;
let import: 'a => promise('a);
TODO(anmonteiro): document
let testAny: 'a => bool;
The same as isNullable
except that it is more permissive on the types of input
let null: null('a);
The same as empty
in Js.Null
will be compiled as null
let undefined: undefined('a);
The same as empty
Js.Undefined
will be compiled as undefined
let typeof: 'a => string;
typeof x
will be compiled as typeof x
in JS Please consider functions in Types
for a type safe way of reflection
let log: 'a => unit;
A convenience function to log everything
let log2: 'a => 'b => unit;
let log3: 'a => 'b => 'c => unit;
let log4: 'a => 'b => 'c => 'd => unit;
let logMany: array('a) => unit;
A convenience function to log more than 4 arguments
let eqNull: 'a => null('a) => bool;
let eqUndefined: 'a => undefined('a) => bool;
let eqNullable: 'a => nullable('a) => bool;
Operators
let unsafe_lt: 'a => 'a => bool;
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_le: 'a => 'a => bool;
unsafe_le a b
will be compiled as a <= b
. See also unsafe_lt
let unsafe_gt: 'a => 'a => bool;
unsafe_gt a b
will be compiled as a > b
. See also unsafe_lt
let unsafe_ge: 'a => 'a => bool;
unsafe_ge a b
will be compiled as a >= b
. See also unsafe_lt
Types for JS objects
type t('a);
This used to be mark a Js object type.
module Exn: { ... };
Utilities for dealing with Js exceptions
module String: { ... };
Bindings to the functions in String.prototype
module Null: { ... };
Utility functions on null
module Undefined: { ... };
Utility functions on undefined
module Nullable: { ... };
Utility functions on nullable
module Array: { ... };
Bindings to the functions in Array.prototype
module Re: { ... };
Bindings to the functions in RegExp.prototype
module Promise: { ... };
Bindings to JS Promise
functions
module Date: { ... };
Bindings to the functions in JS's Date.prototype
module Dict: { ... };
Utility functions to treat a JS object as a dictionary
module Global: { ... };
Bindings to functions in the JS global namespace
module Json: { ... };
Utility functions to manipulate JSON values
module Math: { ... };
Bindings to the functions in the Math
object
module Obj: { ... };
Utility functions on `Js.t` JS objects
module Typed_array: { ... };
Bindings to the functions in TypedArray.prototype
module Types: { ... };
Utility functions for runtime reflection on JS types
module Float: { ... };
Bindings to functions in JavaScript's Number
that deal with floats
module Int: { ... };
Bindings to functions in JavaScript's Number
that deal with ints
module Bigint: { ... };
Bindings to functions in JavaScript's BigInt
module Console: { ... };
module Set: { ... };
Bindings to functions in Set
module WeakSet: { ... };
Bindings to functions in WeakSet
module Map: { ... };
Bindings to functions in Map
module WeakMap: { ... };
Bindings to functions in WeakMap
module Iterator: { ... };
Bindings to functions on Iterator
module Blob: { ... };
Bindings to Blob
module File: { ... };
Bindings to File
module FormData: { ... };
Bindings to FormData