File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2960,22 +2960,13 @@ function mergeActionsIntoObjects(config: ObjectStackDefinition): ObjectStackDefi
29602960 // `mergeObjects` draws for the same key.
29612961 const declaredObjects : unknown = ( config as { objects ?: unknown } ) . objects ;
29622962 if ( declaredObjects !== undefined && ! Array . isArray ( declaredObjects ) ) {
2963- const parsed = z . array ( z . unknown ( ) ) . safeParse ( declaredObjects ) ;
2964- const issues = parsed . success
2965- ? [ ]
2966- : parsed . error . issues . map ( ( issue ) => ( { ...issue , path : [ 'objects' , ...issue . path ] } ) ) ;
2967- const kind =
2968- declaredObjects === null
2969- ? 'null'
2970- : typeof declaredObjects !== 'object'
2971- ? `a ${ typeof declaredObjects } `
2972- : `a ${ ( declaredObjects as object ) . constructor ?. name ?? 'non-plain' } object` ;
2963+ const { kind, issues } = describeNonArrayCollection ( 'objects' , declaredObjects ) ;
29732964 throw new StackSchemaInvalidError (
29742965 `defineStack validation failed: 'objects' is ${ kind } , not an array. Bound actions cannot be ` +
29752966 `merged into it, and \`strict: false\` skips validation, not this shape — \`composeStacks\` ` +
29762967 `refuses the same stack with the same code. Author 'objects' as an array or in the map form ` +
29772968 `(\`{ name: { … } }\`), or drop \`strict: false\` to have every schema check run.` ,
2978- issues as z . core . $ZodIssue [ ] ,
2969+ issues ,
29792970 ) ;
29802971 }
29812972
You can’t perform that action at this time.
0 commit comments