Closed donut closed 5 years ago
Hi, this works as expected. The missing part is that we don't have a good story in the interop between bucklescript and javascript on submodule representation, we will revisit it in the future (it is not relevant to the code gen).
If a variant is defined in a submodule with
[@@bs.deriving accessors]
, it generates useless accessors.For example:
generates this JS:
But when that same variant is put in a submodule like so:
it generates this JS, missing the
Boo
andGoomba
accessors and exporting nothing useful:This breaks interop with JavaScript since
Minion
is exported as an array and the only accessor that's generated (Koopa()
), is not exported. On top of that, only accessors for variants with payloads are generated.The output I'd expect is something like this: