You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This difference likely doesn't affect developers invoking call directly, but it would affect developers that have wrapped Model#call for whatever reason. For example:
functioncall<T=any>(functionPath: string|Path,args?: any[],refPaths?: PathSet,thisPaths?: PathSet[],): ModelResponse<JSONEnvelope<T>>{// Fails because optional parameters will always be passed as `undefined`.returnmodel.call(functionPath,args,refPaths,thisPaths);}
Workaround
The workaround is to use a spread to pass the same number of parameters:
It could be argued both ways that these calling signatures are either the same or different, so I'm unsure on exactly what approach should be taken. Perhaps the input validation can simply ignore a tail of undefineds and validate the rest?
The error message "Invalid argument" is very generic and could include more details to help the developer track down the root cause.
The text was updated successfully, but these errors were encountered:
Context
I was surprised that
Model#call
's arguments validation (source) changes depending on the number of arguments provided. For example:This difference likely doesn't affect developers invoking
call
directly, but it would affect developers that have wrappedModel#call
for whatever reason. For example:Workaround
The workaround is to use a spread to pass the same number of parameters:
Change Request
undefined
s and validate the rest?The text was updated successfully, but these errors were encountered: