COMMUNITY

Support for typescript extern file and split file for class

Hi,
There Is a roaadmap for supporto export import class in es6 with file split for classe. And and idea for a new target that emit code with file .d.ts?

I believe there is support for es6 since haxe 4.0.5 development.
-D js-es=6
(https://github.com/HaxeFoundation/haxe/commit/406d3fb2bfb4016b384082768182a3d470633ed8 )
Support for ts is via haxelib.
https://github.com/elsassph/hxtsdgen
Pretty sure these are not perfect but I thought that OpenFL uses them to provide wider support, although they may manually also patch.
I don’t think there is any timescale attached they will mature with every new pull, but they are probably quite usable given some care?

yes but with big code split of a file for each class can be slow in haxe and should be made in ocaml direclty

I was hoping to eventually see this in Haxe but the issue tracking this was unfortunately closed recently: https://github.com/HaxeFoundation/haxe/issues/5831
I experimented doing this in a custom generator:
https://github.com/benmerckx/genes
There’s also hxgenjs which has been around longer, although the typings are more basic (defaulting to “any”):
https://github.com/kevinresol/hxgenjs
If it doesn’t find its way into the Haxe compiler you could go all the way and implement it as a compiler plugin.

i think that a merge of hxgenjs an hxtsgen can resolve the problem for the typing. but the problem are the performance. if the cache compiler can pass to an api only the files that are change should be possible regenerate only the file js that are changed with the corrispective classes haxe

In genes I managed to only recompile files when needed if you’re using a completion server. Full compile:
image
Recompilation:
image

But in your project you do also the split of js files for class?