STATUS: WORK IN PROGRESS, CONTRIBUTIONS WELCOME
This is a TypeScript declaration file generator for the Haxe JavaScript output target.
What it does is generate a .d.ts
file next to the .js
file generated by Haxe compiler,
containing TypeScript declarations for classes and functions exposed from Haxe using the @:expose
metadata.
Just add -lib hxtsdgen
to compiler arguments and it'll do the rest.
To make using Haxe/JS modules from both JavaScript and TypeScript much easier, of course! Just compile your Haxe library to a JS module and use it in TypeScript in a perfectly typed way.
You may ask, how does plain JavaScript benefit here? Well, the thing is, modern JavaScript editors such as VS Code and (I think) IDEA, can download and use TypeScript "typings" for providing hints while editing JavaScript code.
Check out these 3 awesome panes (left-to-right):
Main.hx
(Haxe source code)main.d.ts
(generated TypeScript declarations)test.ts
(TypeScript source code that uses the declarations)