mlscript
mlscript copied to clipboard
Don't generate ill-formed TS polymorphic types
Currently we use parameter lists in places which are not valid in TS.
Example:
:ts
let t = { a = 5; b = "world"} in if t.a == 1 then 1 else (fun f -> f.b )
//│ res: {b: 'a} -> 'a | 1
//│ // start ts
//│ export declare const res<a>: (arg1: {b: a}) => a | 1
//│ // end ts
We should just fail TS generation here, or widen the type until it's representable.