Snapchat / djinni

A tool for generating cross-language type declarations and interface bindings. Djinni's new home is in the Snapchat org.
Apache License 2.0
173 stars 50 forks source link

Fix Promise optional in typescript #124

Closed bkotzz closed 1 year ago

bkotzz commented 1 year ago

We currently have a bug where we don't support futures with optionals for Typescript codegen. In particular, foo: future<optional<int>> generates a Typescript signature of Promise<number>.

This may have been omitted at the beginning with external types in general. However it works fine to have optional types in ES6 containers like Array/Set/Map (example).

In this PR we update the codegen to take into account the nullability in the TS generator, then add a new test across the languages. CC @LiFengSC