-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should extend by using a class error in Got library #61
Comments
Hey, thanks for the report :), not sure what's going wrong here! Definitely a bug my end, I'll investigate Edit: turns out in typescript a class can extend an interface – this doesn't work in haxe so to translate to haxe we can merge the interface into the class |
FYI, if you try to run dts2hx on Got, there are a few libs that don't automatically have externs created by dts2hx when running
Is this behavior intended? I know it auto generates on other dependencies, so I'm unsure as to why it doesn't for these four. |
Yeah it should be generating externs automatically if they're used by Got, do you get errors about missing types then? Hmm, my typescript is producing errors if I try to extend a class with an interface ¯\_(ツ)_/¯, maybe it's a recent addition. I'll get to the bottom of it |
Oops, I forgot to include the errors that appear when I run dts2hx on
Everything else runs without errors and just for reference Got shows this output when generating externs, so it's missing the other four:
|
Ahh, I understand whats going on with the interface business: declare var Error: ErrorConstructor And apparently that can be extended as if it was a class. This is on the roadmap as "Exported variables to class promotion", so when that's in, a separate Error class will be generated and this issue will be resolved. Might take a while however as I'm currently not dedicating a lot of time to dts2hx because of other work constraints I'll open a separate issue for the dependency issue, thanks for reporting that too |
Sounds, good. Thanks! |
I'm using Got for http requests and received the following error after using dts2hx to generate externs:
/11,8,0/got/RequestError.hx:7 : Should extend by using a class
referring to this line in
/got/RequestError.hx
:@:jsRequire("got", "RequestError") extern class RequestError extends global.nodejs.ErrnoException
Taking a look at
ErrnoException.hx
we see it's generated as a typedef:As a quick fix I just turned this into a class to get it working.
#15 looks similar and so maybe this isn't a dts2hx issue, but a ts definition problem?
Or should
ErrnoException
be generated as a class since it extendsError
(I'm not familiar with TypeScript)?I also noticed the "Interface extends" line item under your roadmap, so maybe you're already aware of this!
Thanks.
The text was updated successfully, but these errors were encountered: