Optional base types are currently implemented as an Option container in wasm-as and schema/bind.
But to omit optional fields from the function parameters we need a | null union type.
So the user has to wrap Int in a reference type to be able to omit it, like Number | null.
# optional fields are `Number | null` instead of `Option<i32>`
type Number {
value: Int!
}
type Module {
# opt requires Option.None<i32> if omitted
foo(opt: Int): Boolean
# opt can be omitted
bar(opt: Number): Boolean
}
Option was introduced in #944, but now it seems more important to omit function parameters than to provide nice Optional API, like "isSome()". We should replace Option<i32> with Box<i32> | null.
Optional base types are currently implemented as an Option container in
wasm-asandschema/bind.But to omit optional fields from the function parameters we need a
| nullunion type.So the user has to wrap Int in a reference type to be able to omit it, like
Number | null.Option was introduced in #944, but now it seems more important to omit function parameters than to provide nice Optional API, like "isSome()". We should replace
Option<i32>withBox<i32> | null.