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
  • 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
    • t
      t
    • v
      some
    • v
      isSome
    • v
      isSomeValue
    • v
      isNone
    • v
      getExn
    • v
      equal
    • v
      andThen
    • v
      map
    • v
      getWithDefault
    • v
      default
      D
    • v
      filter
    • v
      firstSome
  • 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
  • Undefined
  • Vector
  • WeakMap
  • WeakSet
  • API / Js / Option

    Option

    Provide utilities for option

    t

    RESCRIPT
    type t<'a> = option<'a>

    some

    RESCRIPT
    let some: 'a => option<'a>

    isSome

    RESCRIPT
    let isSome: option<'a> => bool

    isSomeValue

    RESCRIPT
    let isSomeValue: (('a, 'a) => bool, 'a, option<'a>) => bool

    isNone

    RESCRIPT
    let isNone: option<'a> => bool

    getExn

    RESCRIPT
    let getExn: option<'a> => 'a

    equal

    RESCRIPT
    let equal: (('a, 'b) => bool, option<'a>, option<'b>) => bool

    andThen

    RESCRIPT
    let andThen: ('a => option<'b>, option<'a>) => option<'b>

    map

    RESCRIPT
    let map: ('a => 'b, option<'a>) => option<'b>

    getWithDefault

    RESCRIPT
    let getWithDefault: ('a, option<'a>) => 'a

    default

    Deprecated

    Use getWithDefault instead since default has special meaning in ES module

    RESCRIPT
    let default: ('a, option<'a>) => 'a

    filter

    RESCRIPT
    let filter: ('a => bool, option<'a>) => option<'a>

    firstSome

    RESCRIPT
    let firstSome: (option<'a>, option<'a>) => option<'a>
    Types and values
    • t
      t
    • v
      some
    • v
      isSome
    • v
      isSomeValue
    • v
      isNone
    • v
      getExn
    • v
      equal
    • v
      andThen
    • v
      map
    • v
      getWithDefault
    • v
      default
      D
    • v
      filter
    • v
      firstSome

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on