elsassph / hxtsdgen

TypeScript declaration file generator for Haxe JavaScript output target
65 stars 12 forks source link

Include related, concrete enums, and codegen fixes #16

Closed elsassph closed 5 years ago

elsassph commented 5 years ago
  1. Automatically include related types so not everything has to be annotated!
interface B {
}

@:expose
interface A {
    function f(): B;
}

Will produce:

interface B {
}

export interface A {
    f(): B;
}
  1. Added -D hxtsdgen_enum_ts to generate Abstract Enums as concrete TS files.

With this option both a .d.ts and a .ts are created. The .ts includes concrete const enum declarations so they become compatible with --transpileOnly --preserveConstEnums.

  1. Lots of fixes around packages and enums generation

Should fix #6 and #14

nadako commented 5 years ago

The static function pointer looks a bit hacky and I don't have time for deep code review, but since we have tests and they pass - it should be fine, feel free to merge it :)

elsassph commented 5 years ago

Yes it's quite hacky I agree. Alternative is to do a lot more of refactoring...

tomaskukol commented 5 years ago

It works perfectly with commit 13b31da and can be merged.