Edoardo Luppi
03/01/2024, 6:59 PMtypealias Done = (err: Any? /* use undefined for default */) -> Unit
typealias Func = (/* this: Context, */ done: Done) -> Unit
external class Test : Runnable {
constructor(title: String, fn: Func)
}
And this usage:
val fn: Func = {
inst.example()
}
suite.addTest(Test("example", fn))
The outputted code for val fn: Func
is:
return function (it) {
$inst.example_3o7jbu_k$();
return Unit_getInstance();
};
Note the it
argument is present even if it's not used.
This is problematic when the JS code checks the number of arguments of the function.
Should the JS compiler get rid of unused arguments like in this case?jw
03/01/2024, 7:02 PMjw
03/01/2024, 7:03 PMEdoardo Luppi
03/01/2024, 7:05 PMEdoardo Luppi
03/01/2024, 7:06 PMOVERLOAD_RESOLUTION_AMBIGUITY
errors.