zod 3.25.45 → 3.25.46

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.
@@ -935,6 +935,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
935
935
  const propValues = {};
936
936
  for (const option of def.options) {
937
937
  const pv = option._zod.propValues;
938
+ console.dir(pv, { depth: null });
938
939
  if (!pv || Object.keys(pv).length === 0)
939
940
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
940
941
  for (const [k, v] of Object.entries(pv)) {
@@ -952,6 +953,8 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
952
953
  const map = new Map();
953
954
  for (const o of opts) {
954
955
  const values = o._zod.propValues[def.discriminator];
956
+ if (!values || values.size === 0)
957
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
955
958
  for (const v of values) {
956
959
  if (map.has(v)) {
957
960
  throw new Error(`Duplicate discriminator value "${String(v)}"`);
@@ -904,6 +904,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
904
904
  const propValues = {};
905
905
  for (const option of def.options) {
906
906
  const pv = option._zod.propValues;
907
+ console.dir(pv, { depth: null });
907
908
  if (!pv || Object.keys(pv).length === 0)
908
909
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
909
910
  for (const [k, v] of Object.entries(pv)) {
@@ -921,6 +922,8 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
921
922
  const map = new Map();
922
923
  for (const o of opts) {
923
924
  const values = o._zod.propValues[def.discriminator];
925
+ if (!values || values.size === 0)
926
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
924
927
  for (const v of values) {
925
928
  if (map.has(v)) {
926
929
  throw new Error(`Duplicate discriminator value "${String(v)}"`);
@@ -49,7 +49,9 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
49
49
  /** @internal Indicates that a schema output type should be considered optional inside objects.
50
50
  * @default Required
51
51
  */
52
+ /** @internal */
52
53
  optin?: "optional" | undefined;
54
+ /** @internal */
53
55
  optout?: "optional" | undefined;
54
56
  /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
55
57
  *
@@ -661,8 +663,8 @@ export interface $ZodRecordDef extends $ZodTypeDef {
661
663
  keyType: $ZodRecordKey;
662
664
  valueType: $ZodType;
663
665
  }
664
- type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends Key["_zod"]["output"] ? Record<Key["_zod"]["output"], core.output<Value>> : number extends Key["_zod"]["output"] ? Record<Key["_zod"]["output"], core.output<Value>> : symbol extends Key["_zod"]["output"] ? Record<Key["_zod"]["output"], core.output<Value>> : Partial<Record<Key["_zod"]["output"], core.output<Value>>> : Record<Key["_zod"]["output"], core.output<Value>>;
665
- type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends Key["_zod"]["input"] ? Record<Key["_zod"]["input"], Value["_zod"]["input"]> : number extends Key["_zod"]["input"] ? Record<Key["_zod"]["input"], Value["_zod"]["input"]> : symbol extends Key["_zod"]["input"] ? Record<Key["_zod"]["input"], Value["_zod"]["input"]> : Partial<Record<Key["_zod"]["input"], Value["_zod"]["input"]>> : Record<Key["_zod"]["input"], Value["_zod"]["input"]>;
666
+ export type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : number extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : symbol extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : Partial<Record<core.output<Key>, core.output<Value>>> : Record<core.output<Key>, core.output<Value>>;
667
+ export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : number extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : symbol extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : Partial<Record<core.input<Key>, core.input<Value>>> : Record<core.input<Key>, core.input<Value>>;
666
668
  export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $ZodType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
667
669
  def: $ZodRecordDef;
668
670
  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.25.45",
3
+ "version": "3.25.46",
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",