zod 3.26.0-canary.20250616T185210 → 3.26.0-canary.20250616T222346

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -582,9 +582,7 @@ function keyof(schema) {
582
582
  exports.ZodObject = core.$constructor("ZodObject", (inst, def) => {
583
583
  core.$ZodObject.init(inst, def);
584
584
  exports.ZodType.init(inst, def);
585
- core_1.util.defineLazy(inst, "shape", () => {
586
- return Object.fromEntries(Object.entries(inst._zod.def.shape));
587
- });
585
+ core_1.util.defineLazy(inst, "shape", () => def.shape);
588
586
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
589
587
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
590
588
  inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -427,6 +427,7 @@ function keyof(schema) {
427
427
  exports.ZodMiniObject = core.$constructor("ZodMiniObject", (inst, def) => {
428
428
  core.$ZodObject.init(inst, def);
429
429
  exports.ZodMiniType.init(inst, def);
430
+ core_1.util.defineLazy(inst, "shape", () => def.shape);
430
431
  });
431
432
  function object(shape, params) {
432
433
  const def = {
@@ -478,9 +478,7 @@ export function keyof(schema) {
478
478
  export const ZodObject = /*@__PURE__*/ core.$constructor("ZodObject", (inst, def) => {
479
479
  core.$ZodObject.init(inst, def);
480
480
  ZodType.init(inst, def);
481
- util.defineLazy(inst, "shape", () => {
482
- return Object.fromEntries(Object.entries(inst._zod.def.shape));
483
- });
481
+ util.defineLazy(inst, "shape", () => def.shape);
484
482
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
485
483
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
486
484
  inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -318,6 +318,7 @@ export function keyof(schema) {
318
318
  export const ZodMiniObject = /*@__PURE__*/ core.$constructor("ZodMiniObject", (inst, def) => {
319
319
  core.$ZodObject.init(inst, def);
320
320
  ZodMiniType.init(inst, def);
321
+ util.defineLazy(inst, "shape", () => def.shape);
321
322
  });
322
323
  export function object(shape, params) {
323
324
  const def = {
@@ -392,10 +392,10 @@ export interface ZodArray<T extends core.SomeType = core.$ZodType> extends _ZodT
392
392
  }
393
393
  export declare const ZodArray: core.$constructor<ZodArray>;
394
394
  export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
395
- export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
395
+ export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<Exclude<keyof T["_zod"]["output"], symbol>>;
396
396
  export interface ZodObject<
397
397
  /** @ts-ignore Cast variance */
398
- out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
398
+ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$strip> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
399
399
  shape: Shape;
400
400
  keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
401
401
  /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
@@ -505,7 +505,7 @@ export { _enum as enum };
505
505
  * ```
506
506
  */
507
507
  export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
508
- export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
508
+ export interface ZodLiteral<T extends util.Literal = util.Literal> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
509
509
  values: Set<T>;
510
510
  /** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
511
511
  value: T;
@@ -718,17 +718,17 @@ export interface $ZodEnum<T extends util.EnumLike = util.EnumLike> extends $ZodT
718
718
  _zod: $ZodEnumInternals<T>;
719
719
  }
720
720
  export declare const $ZodEnum: core.$constructor<$ZodEnum>;
721
- export interface $ZodLiteralDef extends $ZodTypeDef {
721
+ export interface $ZodLiteralDef<T extends util.Literal> extends $ZodTypeDef {
722
722
  type: "literal";
723
- values: util.LiteralArray;
723
+ values: T[];
724
724
  }
725
- export interface $ZodLiteralInternals<T extends util.Primitive = util.Primitive> extends $ZodTypeInternals<T, T> {
726
- def: $ZodLiteralDef;
725
+ export interface $ZodLiteralInternals<T extends util.Literal = util.Literal> extends $ZodTypeInternals<T, T> {
726
+ def: $ZodLiteralDef<T>;
727
727
  values: Set<T>;
728
728
  pattern: RegExp;
729
729
  isst: errors.$ZodIssueInvalidValue;
730
730
  }
731
- export interface $ZodLiteral<T extends util.Primitive = util.Primitive> extends $ZodType {
731
+ export interface $ZodLiteral<T extends util.Literal = util.Literal> extends $ZodType {
732
732
  _zod: $ZodLiteralInternals<T>;
733
733
  }
734
734
  export declare const $ZodLiteral: core.$constructor<$ZodLiteral>;
@@ -173,10 +173,10 @@ export interface ZodMiniArray<T extends SomeType = core.$ZodType> extends _ZodMi
173
173
  }
174
174
  export declare const ZodMiniArray: core.$constructor<ZodMiniArray>;
175
175
  export declare function array<T extends SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodMiniArray<T>;
176
- export declare function keyof<T extends ZodMiniObject>(schema: T): ZodMiniLiteral<keyof T["shape"]>;
176
+ export declare function keyof<T extends ZodMiniObject>(schema: T): ZodMiniLiteral<Exclude<keyof T["shape"], symbol>>;
177
177
  export interface ZodMiniObject<
178
178
  /** @ts-ignore Cast variance */
179
- out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends ZodMiniType<any, any, core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
179
+ out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodObjectConfig = core.$strip> extends ZodMiniType<any, any, core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
180
180
  shape: Shape;
181
181
  }
182
182
  export declare const ZodMiniObject: core.$constructor<ZodMiniObject>;
@@ -252,7 +252,7 @@ export { _enum as enum };
252
252
  * ```
253
253
  */
254
254
  export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<T>;
255
- export interface ZodMiniLiteral<T extends util.Primitive = util.Primitive> extends _ZodMiniType<core.$ZodLiteralInternals<T>> {
255
+ export interface ZodMiniLiteral<T extends util.Literal = util.Literal> extends _ZodMiniType<core.$ZodLiteralInternals<T>> {
256
256
  }
257
257
  export declare const ZodMiniLiteral: core.$constructor<ZodMiniLiteral>;
258
258
  export declare function literal<const T extends ReadonlyArray<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodMiniLiteral<T[number]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.26.0-canary.20250616T185210",
3
+ "version": "3.26.0-canary.20250616T222346",
4
4
  "type": "module",
5
5
  "author": "Colin McDonnell <zod@colinhacks.com>",
6
6
  "description": "TypeScript-first schema declaration and validation library with static type inference",