From 8936547ac8bbf18534cd08407238de51688627dd Mon Sep 17 00:00:00 2001 From: Igal Klebanov Date: Fri, 16 Dec 2022 16:32:00 +0200 Subject: [PATCH] revert `fa78e13da13be99a111fbdfa778541b668dd2777`. --- deno/lib/types.ts | 8 +++----- src/types.ts | 8 +++----- test-d/object.test-d.ts | 4 ---- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/deno/lib/types.ts b/deno/lib/types.ts index 782cca5bc..5b1594433 100644 --- a/deno/lib/types.ts +++ b/deno/lib/types.ts @@ -1881,11 +1881,9 @@ export type SomeZodObject = ZodObject< export type objectKeyMask = { [k in keyof Obj]?: true }; -export type optionalPickWith = {} extends Obj - ? never - : { - [k in keyof Obj]?: k extends keyof Shape ? Obj[k] : never; - }; +export type optionalPickWith = { + [k in keyof Obj]?: k extends keyof Shape ? Obj[k] : never; +}; function deepPartialify(schema: ZodTypeAny): any { if (schema instanceof ZodObject) { diff --git a/src/types.ts b/src/types.ts index 5edcef948..85f7b6a36 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1881,11 +1881,9 @@ export type SomeZodObject = ZodObject< export type objectKeyMask = { [k in keyof Obj]?: true }; -export type optionalPickWith = {} extends Obj - ? never - : { - [k in keyof Obj]?: k extends keyof Shape ? Obj[k] : never; - }; +export type optionalPickWith = { + [k in keyof Obj]?: k extends keyof Shape ? Obj[k] : never; +}; function deepPartialify(schema: ZodTypeAny): any { if (schema instanceof ZodObject) { diff --git a/test-d/object.test-d.ts b/test-d/object.test-d.ts index 69f2fe834..5f72d5a91 100644 --- a/test-d/object.test-d.ts +++ b/test-d/object.test-d.ts @@ -17,7 +17,6 @@ function testPick() { schema.pick(mask) ); - expectError(schema.pick({})); expectError(schema.pick({ NOT_A_MEMBER: true })); expectError(schema.pick({ hello: true, NOT_A_MEMBER: true })); expectError(schema.pick({ hello: true, foo: true, NOT_A_MEMBER: true })); @@ -31,7 +30,6 @@ function testOmit() { const mask = { foo: true } as const; expectType }>>(schema.omit(mask)); - expectError(schema.omit({})); expectError(schema.omit({ NOT_A_MEMBER: true })); expectError(schema.omit({ hello: true, NOT_A_MEMBER: true })); expectError(schema.omit({ hello: true, foo: true, NOT_A_MEMBER: true })); @@ -51,7 +49,6 @@ function testPartial() { }> >(schema.partial({ hello: true })); - expectError(schema.partial({})); expectError(schema.partial({ NOT_A_MEMBER: true })); expectError(schema.partial({ hello: true, NOT_A_MEMBER: true })); expectError(schema.partial({ hello: true, foo: true, NOT_A_MEMBER: true })); @@ -65,7 +62,6 @@ function testRequired() { z.ZodObject<{ hello: z.ZodLiteral<"world!">; foo: z.ZodLiteral<"bar"> }> >(schema.required({ foo: true })); - expectError(schema.required({})); expectError(schema.required({ NOT_A_MEMBER: true })); expectError(schema.required({ hello: true, NOT_A_MEMBER: true })); expectError(schema.required({ hello: true, foo: true, NOT_A_MEMBER: true }));