File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/next-safe-action/src Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ import type { Prettify } from "./utils.types";
5
5
type NotObject = number | string | boolean | bigint | symbol | null | undefined | any [ ] ;
6
6
7
7
// Object with an optional list of validation errors.
8
- type VEList = Prettify < { _errors ?: string [ ] } > ;
8
+ type VEList < K = undefined > = K extends any [ ] ? { _errors ?: string [ ] } [ ] : { _errors ?: string [ ] } ;
9
9
10
10
// Creates nested schema validation errors type using recursion.
11
11
type SchemaErrors < S > = {
12
- [ K in keyof S ] ?: S [ K ] extends NotObject ? VEList : Prettify < VEList & SchemaErrors < S [ K ] > > ;
12
+ [ K in keyof S ] ?: S [ K ] extends NotObject ? Prettify < VEList < S [ K ] > > : Prettify < VEList > & SchemaErrors < S [ K ] > ;
13
13
} & { } ;
14
14
15
15
export type IssueWithUnionErrors = StandardSchemaV1 . Issue & {
@@ -21,8 +21,8 @@ export type IssueWithUnionErrors = StandardSchemaV1.Issue & {
21
21
*/
22
22
export type ValidationErrors < S extends StandardSchemaV1 | undefined > = S extends StandardSchemaV1
23
23
? StandardSchemaV1 . InferOutput < S > extends NotObject
24
- ? VEList
25
- : Prettify < VEList & SchemaErrors < StandardSchemaV1 . InferOutput < S > > >
24
+ ? Prettify < VEList >
25
+ : Prettify < VEList > & SchemaErrors < StandardSchemaV1 . InferOutput < S > >
26
26
: undefined ;
27
27
28
28
/**
You can’t perform that action at this time.
0 commit comments