mobily / ts-belt

🔧 Fast, modern, and practical utility library for FP in TypeScript.
https://mobily.github.io/ts-belt
MIT License
1.1k stars 30 forks source link

Does the Option types support deserialization for an API? #32

Closed dessalines closed 2 years ago

dessalines commented 2 years ago

I'd like to use these Option types in an API, IE currently an interface might be:

interface Person {
  name: string;
  display_name?: string // I'd like this to be display_name: Option<string>;
  ...
}

Would this be supported?

mobily commented 2 years ago

as far as I understand this issue correctly, it is possible, since under the hood Option<T> is T | null | undefined

feel free to reopen this issue if you need more clarification