Skip to content

Commit a97a789

Browse files
committed
fallback to z.custom() for function validation
1 parent 495903e commit a97a789

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/friendly_errors/param_validator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ function validateParams(p5, fn, lifecycles) {
230230
param = param?.replace(/^\.\.\.(.+)\[\]$/, '$1');
231231

232232
let schema = generateTypeSchema(param);
233+
// Fallback to z.custom() because function types are no longer
234+
// returns a Zod schema.
233235
if (schema.def.type === 'function') {
234-
schema = z.any()
236+
schema = z.custom(val => val instanceof Function)
235237
}
236238

237239
if (isOptional) {

0 commit comments

Comments
 (0)