[js-es6]Must call `super()` constructor before accessing `this` in classes derived from an extern class with constructor

[js]Must call super() constructor before accessing this in classes derived from an extern class with constructor

-D js-es=6

I found this issue already close, but I still got this error in haxe 4.1.5.

@:native("cc.Component") extern class Component {
	function new();
}

class Main extends Component {

	public function new() {
		super();
		trace('ok');
	}

}

I can’t reproduce the error neither with 4.1.5 nor with the development version of Haxe.

@:native("cc.Component") extern class Component {

    function new();

}

class Main extends Component {

    public var dd:Array<Int>=[];

    public function new() {

        super();

        trace('ok');

    }

    public static function main() {

        

    }

}

@RealyUniqueName after add

 public var dd:Array<Int>=[];

I have the same issue. Haxe 4.2.5.

I was able to reproduce the error here. (Haxe 4.3.6) It seems it only comes when DCE is set to “no”.

In my own project the error happens regardless of DCE setting. I finally got it to compile by removing the “new” function from the extern and the super() calls. Not sure if it will run properly yet.