/** @type {com.webcircuits.IDriverFront._serInputs<com.webcircuits.IDriverFront.Inputs>} */
export default function _serInputs(inputs,testing){
test({inputs,testing})
test({inputs:this})
const{
asIDriverFront:{inputsPQs:inputsPQs},
}=this
const _inputs=ser(inputs,inputsPQs)
return _inputs
}
/**
* @param {string} s
*/
function test(s){}
Now, if I just tried to set @type {com.webcircuits.IDriverFront._serInputs}, the compiler would say that the type does not exist which is fair enough since the function is not defined as a type. That''s why there's a $$ before it, and then I do
/** @typedef {typeof $$com.webcircuits.IDriverFront._serInputs} */
com.webcircuits.IDriverFront._serInputs
in externs, so that it basically becomes a type. It's pretty much all good except that checking for correctness of this approach with the test call, I see:
src/class/DriverFront/methods/ser-inputs/setInputs.js:10:6: WARNING - [JSC_TYPE_MISMATCH] actual parameter 1 of test$$module$src$class$DriverFront$methods$ser_inputs$setInputs does not match formal parameter
found : {
inputs: INPUTS,
testing: string
}
required: string
10| test({inputs,testing})
^^^^^^^^^^^^^^^^
src/class/DriverFront/methods/ser-inputs/setInputs.js:11:6: WARNING - [JSC_TYPE_MISMATCH] actual parameter 1 of test$$module$src$class$DriverFront$methods$ser_inputs$setInputs does not match formal parameter
found : {inputs: com.webcircuits.IDriverFront}
required: string
11| test({inputs:this})
^^^^^^^^^^^^^
So it worked as intended because the
this type is resolved as per original function annotation as well as
testing variable type is a string which is right, but the inputs are left as INPUTS so the compiler didn't pick up those generics. Could you please make it possible to use generics via @type {function-ref} as I've just described? The same thing applies if the function is defined in the source code using the same @typedef {typeof $$fn} method in source not just externs.