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