Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Model string value from external system

$
0
0

If you explicitly need it to be null or a string and not undefined, you can use Null.t which is defined as

@unboxed
type t<'a> =
  | Value('a)
  | @as(null) Null

(as opposed to Nullable.t which is the same but also with an Undefined case)

type info = {contactPerson: Null.t<string>}

let a = { contactPerson: Value("Foo") }
let b = { contactPerson: Null }

Viewing all articles
Browse latest Browse all 2592

Trending Articles