-
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
typedef with @:native metadata #48
Comments
Hey @clarkjones, you’re right and unfortunately haxe does not have a way to solve this yet! There is a proposal to support More discussion on the haxe repo: |
thanks for the info. |
In this case an interface might do but not in the general case because we need the structure unification rules to apply, so a typedef gives you the most typescript-like behavior here |
Just a note for future self, I think we can solve this by wrapping the typedefs with abstracts – not perfect but it will help as an interim before future compile changes fully resolve the issue typedef StructureTypedef = {
@:native('continue')
function continue_(?overrides:Overrides):js.lib.Promise<Void>;
}
abstract Structure(StructureTypedef) {
@:from static function fromTypedef(obj: StructureTypedef) {
// apply @:native fields
}
} |
when running dts2hx on puppeteer it generates a Request typedef that contains the following.
From what I can tell this only works for classes & interfaces
The text was updated successfully, but these errors were encountered: