I want to annotate a parameter to a method call to be a function accepting two parameters, first being Error or null and second being an Object or Array of objects. However I seem to not be able to figure out the correct annotation - compiler always gives Bad type annotation.
Example:
/**
* Allows to predefine the callback for a named 'run' method. This is
* useful mostly for application code that has only one consumer for any
* particular named request.
*
* @param {!string} run_name The name of the run to register default callback
* for.
* @param {function(Error, (Array.<Object>|Object)): undefined} callback The callback
* function to execute for the named request if no other callback is provided
* with the request.
*/
_.registerRunCallback = function(run_name, callback) {
this.internalImplementation(run_name, callback);
};
I am not sure if this is actually possible, but I find it to be better than using unknown type.
So my question is how do I do that.