COMMUNITY

jQueryExterns overload not working anymore?

After updating to jQueryExtern 3.0 haxe 3.4.4 seems to accept only the last signature of my extern class methods:
Am I missing something?

package jPlugin;

extern class Accordion implements js.jquery.Plugin
{
	public var panels:Array<js.html.HtmlElement>;
	
	@:overload(function( options:Dynamic):js.jquery.JQuery{})
	@:overload(function( op:String, field:String):js.jquery.JQuery{ })
	@:overload(function( op:String, ?field:String, ?val:Dynamic):js.jquery.JQuery{})
	public  function accordion(op:String, field:String):js.jquery.JQuery;
	
}

class Main 
{
	
	static function main() 
	{		
		var root:JQuery = new JQuery('#dummy');
		
		trace( root.accordion('option', 'active'));
		
		trace(new JQuery('#dummy').accordion( 
		{ 
			active:1,
			"autoHeight": false,
			fillSpace: true
		}));
	}
	
}

haxe -lib jQueryExtern -lib CommentString -lib pushstate -cp lib -cp src -js C:/devel/haxe/bi4me/bin/bi4me.js -main Main -dce std --macro js.jquery.Config.addPlugin(‘jPlugin.Accordion’) --macro js.jquery.Config.addPlugin(‘jPlugin.Template’) --macro js.jquery.Config.addPlugin(‘jPlugin.Tabs’)
src/Main.hx:20: lines 20-24 : { fillSpace : Bool, autoHeight : Bool, active : Int } should be String
src/Main.hx:20: lines 20-24 : For function argument ‘op’

I do not tried to compile your code, but you trying to pass autoHeight property name as String to the object.
Try to replace latest trace() function with:

        trace(new JQuery('#dummy').accordion(
		{ 
			active:1,
			autoHeight: false,
			fillSpace: true
		}));

The problem is that jQueryExtern uses a different way to write overload functions. It is more like how they are written for the Java/C# targets.

The following will works:

extern class Accordion implements js.jquery.Plugin
{
	@:overload public function accordion(options:Dynamic):js.jquery.JQuery;
	@:overload public function accordion(op:String, field:String):js.jquery.JQuery;
	@:overload public function accordion(op:String, ?field:String, ?val:Dynamic):js.jquery.JQuery;
	@:overload public function accordion(op:String, field:String):js.jquery.JQuery;
}