Open dansteren opened 2 years ago
Consider that optional properties result in undefined and not null. The algebraic Option data type can only be one of two explicit properties, Some
or None
. We're currently representing this as a value
or null
. It may not be appropriate to also introduce the concept of undefined
and implicit Option types, which is a foreign concept in Rust (and possibly Motoko, not sure).
Consider the following record type in azle:
This isn't the solution that my brain naturally reaches for. Instead, I would much rather say
The former requires you to instantiate a request like this:
whereas the latter lets you do
We are using the
Opt<T>
type because it is an algebraic datatype that is more similar to Rust/Motoko. We should look into supporting the?
optional properties because I think that will be more intuitive to TS devs.