mlscript icon indicating copy to clipboard operation
mlscript copied to clipboard

Don't generate ill-formed TS polymorphic types

Open LPTK opened this issue 4 years ago • 0 comments

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.

LPTK avatar Feb 28 '22 04:02 LPTK