Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 98cd8b3

Browse filesBrowse files
committed
Fix more excessively deep
1 parent 50e9afb commit 98cd8b3
Copy full SHA for 98cd8b3

File tree

Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed
Open diff view settings
Collapse file

‎packages/zod/src/v4/core/schemas.ts‎

Copy file name to clipboardExpand all lines: packages/zod/src/v4/core/schemas.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
151151
parent?: $ZodType | undefined;
152152
}
153153

154+
export type $ZodStandardSchema<T extends $ZodType> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
155+
154156
export interface $ZodType<O = unknown, I = unknown> {
155157
_zod: $ZodTypeInternals<O, I>;
156-
"~standard": StandardSchemaV1.Props<core.input<this>, core.output<this>>;
158+
"~standard": $ZodStandardSchema<this>;
157159
}
158160

159161
export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
Collapse file

‎play.ts‎

Copy file name to clipboard
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
import { z } from "zod/v4";
1+
// import { z } from "zod/v4";
22

3-
z;
4-
const recordWithBrandedNumberKeys = z.record(z.number().brand("SomeBrand"), z.number());
5-
type recordWithBrandedNumberKeys = z.infer<typeof recordWithBrandedNumberKeys>;
3+
import type { z } from "zod/v4";
4+
5+
export type RefinedSchema<T extends z.core.$ZodType | z.core.$ZodUnion = z.core.$ZodType | z.core.$ZodUnion> =
6+
T extends z.core.$ZodUnion
7+
? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.
8+
: never;
9+
10+
export type RefinedTypeSchema<T extends object> = T;
11+
export type RefinedUnionSchema<T extends z.core.$ZodUnion> = T;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.