dts2hx
dts2hx copied to clipboard
support overload field ?
here is some test class
Engine.d.ts
export declare class Engine {
get canvas(): Canvas;
}
WebGLEngine.d.ts
export declare class WebGLEngine extends Engine {
get canvas(): WebCanvas;
}
current dts2hx won't generate get canvas(): WebCanvas;
package oasis_engine;
/**
WebGL platform engine,support includes WebGL1.0 and WebGL2.0.
**/
@:jsRequire("oasis-engine", "WebGLEngine") extern class WebGLEngine extends Engine {
/**
Create an engine suitable for the WebGL platform.
**/
function new(canvas:Dynamic, ?physics:Dynamic, ?webGLRendererOptions:oasis_engine.rhi_webgl.types.webglrenderer.WebGLRendererOptions);
static var prototype : WebGLEngine;
//where is get canvas(): WebCanvas;
}
test engine from
https://github.com/oasis-engine/engine
In haxe we cannot rewrite the type to WebCanvas like you can in TypeScript
The field is likely there, only it’s on the super type, Engine and returns Canvas
maybe you can generate something like this? @haxiomic
@:native("canvas")
var canvas_overload:WebCanvas;
^ that could work for sure but a little tricky if it's overloaded multiple times
I am hoping native compiler support for overloading the type in externs might arrive one day. Perhaps worth an haxe evolution post for that feature if there isn't already an issue tracking it