Module Js

Types for JS objects

type t('a) = 'a;

This used to be mark a Js object type.

module Fn: { ... };
let toOption: Js__.Js_internal.nullable('a) => option('a);
let undefinedToOption: Js__.Js_internal.undefined('a) => option('a);
let nullToOption: Js__.Js_internal.null('a) => option('a);
let isNullable: Js__.Js_internal.nullable('a) => bool;
let testAny: 'a => bool;

The same as test except that it is more permissive on the types of input

let null: Js__.Js_internal.null('a);

The same as empty in Js.Null will be compiled as null

let undefined: Js__.Js_internal.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 => Js__.Js_internal.null('a) => bool;
let eqUndefined: 'a => Js__.Js_internal.undefined('a) => bool;
let eqNullable: 'a => Js__.Js_internal.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

type null(+'a);

nullable, value of this type can be either null or 'a this type is the same as type t in Null

type undefined(+'a);

value of this type can be either undefined or 'a this type is the same as type t in Undefined

type nullable(+'a);

value of this type can be undefined, null or 'a this type is the same as type t n Null_undefined

type null_undefined(+'a) = nullable('a);
module Array2: { ... };

Provide bindings to Js array

module Exn: { ... };

Provide utilities for dealing with Js exceptions

module Vector: { ... };
module String: { ... };

Provide bindings to JS string

module TypedArray2: { ... };

Provide bindings for JS typed array

nested modules
module Null: { ... };

Provide utilities around 'a null

module Undefined: { ... };

Provide utilities around undefined

module Nullable: { ... };

Provide utilities around null_undefined

module Null_undefined: { ... };
module Array: { ... };

Provide bindings to Js array

module String2: { ... };

Provide bindings to JS string

module Re: { ... };

Provide bindings to Js regex expression

module Promise: { ... };

Provide bindings to JS promise

module Date: { ... };

Provide bindings for JS Date

module Dict: { ... };

Provide utilities for JS dictionary object

module Global: { ... };

Provide bindings to JS global functions in global namespace

module Json: { ... };

Provide utilities for json

module Math: { ... };

Provide bindings for JS Math object

module Obj: { ... };

Provide utilities for Js.t

module Typed_array: { ... };

Provide bindings for JS typed array

module Types: { ... };

Provide utilities for manipulating JS types

module Float: { ... };

Provide utilities for JS float

module Int: { ... };

Provide utilities for int

module Bigint: { ... };

Provide utilities for bigint

module Option: { ... };

Provide utilities for option

module Result: { ... };

Define the interface for result

module List: { ... };

Provide utilities for list

module Console: { ... };
module Set: { ... };

Provides bindings for ES6 Set

module WeakSet: { ... };

Provides bindings for ES6 WeakSet

module Map: { ... };

Provides bindings for ES6 Map

module WeakMap: { ... };

Provides bindings for ES6 WeakMap