fable-compiler / ts2fable

Parser of Typescript declaration files
http://fable.io/ts2fable/
Apache License 2.0
224 stars 34 forks source link

Handle extends int enum #454

Closed Booksbaum closed 1 year ago

Booksbaum commented 1 year ago
enum RootKind {
  Alpha = 1,
  Beta = 2,
}
interface InterfaceRootKind<TKind extends RootKind> { }

prev:

type [<AllowNullLiteral>] InterfaceRootKind<'TKind when 'TKind :> RootKind> = interface end

-> :> RootKind is invalid

now:

type [<AllowNullLiteral>] InterfaceRootKind<'TKind when 'TKind : enum<int>> = interface end

Note:
There's no additional XML Comment because that would need handling of outer type instead of just Generic Type Parameter (... and I got lazy... :P ) If we add comments in such cases we should do that for all cases Constraints gets adjusted or removed, not just for enum






Additional:
Increase timeout for tests (15s -> 25s)

previous master CI test failed (with timeout of a test) -- while the same PR CI run succeeded.

Comparing these two runs (master, PR) it seems to be just an "unlucky" run with little CPU allocated: all tests seems to run twice as long (Though that should be still enough for failing test "multiple ts inputs should export one time" (in PR run: 1259ms))