ProbeJS icon indicating copy to clipboard operation
ProbeJS copied to clipboard

[1.20.1]Java Functions was generated without function types in version 7.0.0.

Open zxy19 opened this issue 6 months ago • 0 comments

In version 6.0.1, BiFunction was generated with the following type declaration

    interface BiFunction <T, U, R> {
        abstract apply(arg0: T, arg1: U): R;
        andThen<V>(arg0: Internal.Function_<R, V>): Internal.BiFunction<T, U, V>;
        (arg0: T, arg1: U): R;
    }
    type BiFunction_<T, U, R> = BiFunction<T, U, R> | ((arg0: T, arg1: U)=> R);

And in version 7.0.0, there's no function type declaration ((arg0: T, arg1: U)=> R) with it

export interface $BiFunction<T, U, R> {

 "apply"(arg0: T, arg1: U): R
 "andThen"<V>(arg0: $Function$Type<(any), (any)>): $BiFunction<(T), (U), (V)>

(arg0: T, arg1: U): R
}

export namespace $BiFunction {
const probejs$$marker: never
}
/**
 * Class-specific type exported by ProbeJS, use global Type_
 * types for convenience unless there's a naming conflict.
 */
export type $BiFunction$Type<T, U, R> = ($BiFunction<(T), (U), (R)>);
/**
 * Global type exported for convenience, use class-specific
 * types if there's a naming conflict.
 */
declare global {
export type $BiFunction_<T, U, R> = $BiFunction$Type<(T), (U), (R)>;
}}

And after this change, when using "checkJS", there will be a type error when passing javascript function to java Function parameter.

This is because the function (a,b)=>c dose not has the member apply and andThen, but is required in Function declaration.

If it's possible to also add this function type declare in newer version?

zxy19 avatar Jun 25 '25 15:06 zxy19