This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • Community
  • X
  • Bluesky
  • GitHub
  • Forum
Js Module
Overview
Js
submodules
  • Array
  • Array2
  • BigInt
  • Blob
  • Console
  • Date
  • Dict
  • Exn
  • File
  • Float
  • Global
  • Int
  • Json
    • Kind
  • List
  • Map
  • Math
  • Null
  • Null_undefined
  • Nullable
  • Obj
  • Option
  • Promise
  • Promise2
  • Re
  • Result
  • Set
  • String
  • String2
  • TypedArray2
    • DataView
    • Float64Array
    • Float32Array
    • Uint32Array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • ArrayBuffer
    Typed_array
    • DataView
    • Float64_array
    • Float64Array
    • Float32_array
    • Float32Array
    • Uint32Array
    • Int32_array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • S
    • ArrayBuffer
    • Type
  • Types
    • t
      symbol
    • t
      bigint_val
    • t
      obj_val
    • t
      undefined_val
    • t
      null_val
    • t
      function_val
    • t
      t
    • v
      test
    • t
      tagged_t
    • v
      classify
  • Undefined
  • Vector
  • WeakMap
  • WeakSet
  • API / Js / Types

    Types

    Provide utilities for manipulating JS types.

    symbol

    RESCRIPT
    type symbol

    Js symbol type (only available in ES6)

    bigint_val

    RESCRIPT
    type bigint_val

    Js bigint type only available in ES2020

    obj_val

    RESCRIPT
    type obj_val

    undefined_val

    RESCRIPT
    type undefined_val

    This type has only one value undefined

    null_val

    RESCRIPT
    type null_val

    This type has only one value null

    function_val

    RESCRIPT
    type function_val

    t

    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>) => bool

    test(value, t) returns true if value is typeof t, otherwise false. This is useful for doing runtime reflection on any given value.

    Examples

    RESCRIPT
    test("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
    Types and values
    • t
      symbol
    • t
      bigint_val
    • t
      obj_val
    • t
      undefined_val
    • t
      null_val
    • t
      function_val
    • t
      t
    • v
      test
    • t
      tagged_t
    • v
      classify

    © 2025 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on