haxiomic / dts2hx

Converts TypeScript definition files (d.ts) to haxe externs (.hx) via the TypeScript compiler API
MIT License
134 stars 9 forks source link

@actions/core issues #5

Closed Gama11 closed 4 years ago

Gama11 commented 4 years ago

Finally got around to trying this. :)

I followed the getting started steps from the readme and ran npx dts2hx @actions/core, which creates the following:

I noticed the following issues:

core.d.ts also has a bunch of global / root-level functions, which seeem to be ignored entirely. I'm guessing dts2hx is missing support for generating a class automatically for these cases (I would've expected a Core class with static functions to be created). Or are you just waiting for module level function support in Haxe?

Gama11 commented 4 years ago

Also, regarding the package name - maybe it should be actions instead of atactions? I guess the former looks nicer, but has the potential to conflict with other NPM packages? :/

haxiomic commented 4 years ago

I agree it's probably better to not replace '@' with at in this case, I will make a note

Right now the haxe version is under heavily development doesn't yet generate any fields, I'm getting close but check back in a couple weeks (I'll make an announcement on slack when it's ready to try)

(core.d.ts will generate a Core class with static methods)

haxiomic commented 4 years ago

This lib now works :)

Mapping of default lib types to the haxe standard library isn't done yet so it generates js.lib.Promise, but other than that it should be good

(dts2hx as a whole still has a long way to go tho!)

Gama11 commented 4 years ago

Works beautifully! https://github.com/HaxeFlixel/setup-flixel/commit/8b2a5c024d1946a671cf067f642037189b0cc315

Not sure what @valueModeOnly means though?

haxiomic commented 4 years ago

Yey, thanks for the feedback @Gama11

@valueModuleOnly just means that this class doesn't have a class representation in js. Instead it's something like

namespace Core {
      const field: T;
}

It won't be needed when module-level fields arrive. Maybe adding a doc comment would be better but I figured a meta might be useful to someone

Another one is @jsInaccessible, which means there's no path to this symbol in JavaScript