mrousavy/nitro

Combining optionals with union doesn't always work

grabbou opened this issue · 3 comments

For the following signatures:

  • (event?: Type | TypeB)
  • (event: Type | TypeB),

Nitrogen will generate enum that are required

I tried to workaround with empty interface, but that doesn't work (see #123)

Does event: Type | TypeB | undefined work?

I tried that, and run codegen twice to make sure. I did not see the difference in generated code at all, so either it was my Xcode going crazy, or this is indeed a bug.

In fact, I tried writing undefined in my original post, but for some reason, it disappeared LOL

Fixed this in #130! :)