existential types produce invalid TS
johnridesabike opened this issue · comments
@gentype
type rec t = Any('a): t
output:
export type t = { tag: "Any"; value: a };
Cannot find name 'a'.
Property 'value' of exported interface has or is using private name 'a'.
There's no support for exporting GADTs at the moment. It's not clear what TS type they would map to.
Would it be possible for gentype to output type names like any
or unknown
for cases that aren’t supported? Or could it print a warning/error so the user can work around it? Either way, silently outputting invalid code seems unideal.
Indeed, it makes sense to give a warning in this case.
Doing it here: #504
Also, exporting it as opaque in that case, so it's a black box from TS.