Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[js] support outputting a typescript declaration file along with js output #6040
Comments
|
I would like inline haxe js support within Typescript to be also considered since it might be relatively simple fix.
will error on the direct attaching of name the simple non-ideal but pragmatic workround:
Would this not be relatively simple to fix with addition of flag and some complier tweaks?
I also found that I needed to comment out name on base classes.
I am not yet sure on the implications but also not sure of other approaches. In js_Boot.__string_rec
which I hid using an old as1 trick which seems to work.
and also in the same function commented out initialization of k
which is later used
|
|
In reality it seems putting haxe js in typescript is lot more tricky. Perhaps using this flag:"compilerOptions": { |
|
I still see no reason whatsoever for trying to compile haxe/js output with TypeScript compiler, given that it can already use any JS module in a perfectly typed way. It's pointless for a few reasons:
We don't have any resources to this meaningless work, so don't expect any changes regarding this. What I actually started to work on though, is the typescript declaration generator, which will output a It just occured to me that it's not only useful for TypeScript users, but also for plain javascript users that are working in Visual Studio Code and IDEA, because IIRC those can use typescript definition to provide IDE features for javascript as well. |
|
@nadako I think it does make sense. There are many frameworks that are based off TypeScript or ES6 and while I agree you can still target them with Haxe's ES5 output, it's much easier to just target at the ES6/TypeScript-compatible level. Playing at this abstraction level makes it easier to leverage the community efforts - docs, libraries etc. A concrete example of that is Ember 2. Yes, Ember 2 can be used without Ember-CLI, but then it becomes a huge pain in the *ss and 99% of what you can find on the web about it is based off Ember CLI, its build system/pipeline, which by default uses Babel/ES6. So I'd say at least an ES6 compatible target + ability to compile class to separate ES6 files would be great. I think the work @kevinresol ( Cheers! |
|
I agree we should look into outputting per-module js files (shouldn't be that hard), but that's a different matter than trying to make haxe/js output compatible with typescript compiler. |
|
I would find this very interesting. It probably would not be possible to extend Haxe types using TypeScript, though, and I presume some argument types (enums, abstracts) might be a rougher? I wonder about an "openfl.js", used from a TypeScript API if someone preferred |
|
openfl.ts would give you lots more users that don't contribute code but ask millions of questions, certainly would not promote Haxe. Having a way to put Haxe created OpenFL ( especially away3d ) easily into Angular4 typescript component is probably important for some corporate take up, currently it's likely a real headache. |
|
Alright, the discussion diverged here, so I'm going to close this: |
As discussed in #5840 as well as today on IRC, it appears that there's need to use Haxe-generated modules from TypeScript environment. While it's totally possible (TS can interop with any JavaScript module through its externs mechanism), Haxe could simplify the integration process by generating a
.d.tsfile along with the.jsoutput that will contain TypeScript declarations for the stuff being@:exposed.I'm pretty sure this can be easily done with a
onGeneratemacro, so it probably doesn't even needs to be a part of JavaScript generator, and I'd like to experiment with that someday. Contributions are welcome, as always! :)