Skip to content

Commit 495903e

Browse files
committed
update schema type check for zod function
- z.function() is no longer a Zod schema. Instead, it acts as a standalone "function factory" for defining Zod-validated functions. - .def.type checks schema type. If its `'function'`, fallback to `z.any()`
1 parent b9ab468 commit 495903e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/friendly_errors/param_validator.js

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

232232
let schema = generateTypeSchema(param);
233-
if (!schema || typeof schema.optional !== 'function') {
234-
schema = z.any();
233+
if (schema.def.type === 'function') {
234+
schema = z.any()
235235
}
236236

237237
if (isOptional) {

0 commit comments

Comments
 (0)