@@ -149,17 +149,6 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
149149 parent ?: $ZodType | undefined ;
150150}
151151
152- // export interface $ZodTypeInternals<out O = unknown, out I = unknown> extends $ZodTypeInternals {
153- // // "~types": { output: O; input: I };
154- // output: O;
155- // input: I;
156- // }
157-
158- // export interface _$ZodType {
159- // _zod: $ZodTypeInternals;
160- // "~standard": StandardSchemaV1.Props<core.input<this>, core.output<this>>;
161- // }
162-
163152export interface $ZodType < O = unknown , I = unknown > {
164153 _zod : $ZodTypeInternals < O , I > ;
165154 "~standard" : StandardSchemaV1 . Props < core . input < this> , core . output < this> > ;
@@ -1525,7 +1514,10 @@ export interface $ZodObjectInternals<
15251514 /** @ts -ignore Cast variance */
15261515 out Shape extends Readonly < $ZodShape > = Readonly < $ZodShape > ,
15271516 out Config extends $ZodObjectConfig = $ZodObjectConfig ,
1528- > extends $ZodTypeInternals < any , any > {
1517+ > extends $ZodTypeInternals <
1518+ $InferObjectOutputFallback < Shape , Config [ "out" ] > ,
1519+ $InferObjectInputFallback < Shape , Config [ "in" ] >
1520+ > {
15291521 def : $ZodObjectDef < Shape > ;
15301522 config : Config ;
15311523 isst : errors . $ZodIssueInvalidType | errors . $ZodIssueUnrecognizedKeys ;
@@ -1541,6 +1533,36 @@ export type $ZodLooseShape = Record<string, any>;
15411533type OptionalOutSchema = { _zod : { optout : "optional" } } ;
15421534type OptionalInSchema = { _zod : { optin : "optional" } } ;
15431535
1536+ export type $InferObjectOutputFallback <
1537+ T extends $ZodLooseShape ,
1538+ Extra extends Record < string , unknown > ,
1539+ > = string extends keyof T
1540+ ? object
1541+ : keyof ( T & Extra ) extends never
1542+ ? Record < string , never >
1543+ : util . Prettify <
1544+ {
1545+ // this is a simplified fallback type
1546+ // there is no support for key optionality
1547+ - readonly [ k in keyof T ] : core . output < T [ k ] > ;
1548+ } & Extra
1549+ > ;
1550+
1551+ export type $InferObjectInputFallback <
1552+ T extends $ZodLooseShape ,
1553+ Extra extends Record < string , unknown > ,
1554+ > = string extends keyof T
1555+ ? object
1556+ : keyof ( T & Extra ) extends never
1557+ ? Record < string , never >
1558+ : util . Prettify <
1559+ {
1560+ // this is a simplified fallback type
1561+ // there is no support for key optionality
1562+ - readonly [ k in keyof T ] : core . input < T [ k ] > ;
1563+ } & Extra
1564+ > ;
1565+
15441566export type $InferObjectOutput < T extends $ZodLooseShape , Extra extends Record < string , unknown > > = string extends keyof T
15451567 ? object
15461568 : keyof ( T & Extra ) extends never
0 commit comments