mrousavy / nitro

🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI
https://nitro.margelo.com
MIT License
578 stars 13 forks source link

Combining optionals with union doesn't always work #125

Closed grabbou closed 1 month ago

grabbou commented 1 month ago

For the following signatures:

Nitrogen will generate enum that are required

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

mrousavy commented 1 month ago

Does event: Type | TypeB | undefined work?

grabbou commented 1 month ago

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

mrousavy commented 1 month ago

Fixed this in https://github.com/mrousavy/nitro/pull/130! :)