elsassph / hxtsdgen

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

@:native on classes doesn't rename the output class #19

Closed bary12 closed 5 years ago

bary12 commented 5 years ago

I expect

@:expose
@:native("YourClass")
class MyClass { ... }

to output export class YourClass { ... } but instead it outputs export class MyClass { ... }. A workaround is currently to write

@:expose("YourClass")
@:native("YourClass")
class MyClass { ... }

but this should be unnecessary as the class is compiled to YourClass in the JS output anyway.

elsassph commented 5 years ago

You can omit @:native if you set @:expose("YourClass"), but you're right it should be picked up.

bary12 commented 5 years ago

I think non-js targets ignore @:expose so I still need @:native when compiling to multiple targets.

elsassph commented 5 years ago

Agreed @:native has been overlooked - shouldn't be long to fix.

elsassph commented 5 years ago

@bary12 would you mind trying the fix/19_native branch?

bary12 commented 5 years ago

@bary12 would you mind trying the fix/19_native branch?

Well, if the tests are passing is there really a need for me to clone and figure out how to set up a development branch?

elsassph commented 5 years ago

It's always good to have an approval :)

I'll go ahead but just FYI it's quite easy to point to a repo:

# pull lib from git
haxelib git [project-name] [git-clone-path] [branch]
haxelib git hxtsdgen https://github.com/nadako/hxtsdgen.git fix/19_native

# update git branch
haxelib update hxtsdgen

# cancel git mode
haxelib install hxtsdgen

# verify lib location
haxelib path hxtsdgen

https://lib.haxe.org/documentation/using-haxelib/

elsassph commented 5 years ago

Released as 0.2.0