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

Optional field in a record best practice

$
0
0

Personally I only use the optional fields for JS interop, most prominently option objects where usually everything is optional.

I still prefer the strictness of explicitly defined options even if that means that an “empty” instantiation is full of None’s. It’s similar to writing down the cases of a variant explicitly so that you can not forget to handle it when you add a new variant case.


Viewing all articles
Browse latest Browse all 2592

Trending Articles