From 8d364f029614dec32c1852d0bdabbebee8d4bb58 Mon Sep 17 00:00:00 2001 From: Miroslav Petrov Date: Mon, 19 Feb 2024 10:10:43 +0200 Subject: [PATCH] fix: fix .pick(), .omit() generic Type --- deno/lib/helpers/util.ts | 1 + deno/lib/types.ts | 4 ++-- src/helpers/util.ts | 1 + src/types.ts | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deno/lib/helpers/util.ts b/deno/lib/helpers/util.ts index 85419b695..fbbdbfe41 100644 --- a/deno/lib/helpers/util.ts +++ b/deno/lib/helpers/util.ts @@ -16,6 +16,7 @@ export namespace util { export type OmitKeys = Pick>; export type MakePartial = Omit & Partial>; + export type Exactly = T & Record, never>; export const arrayToEnum = ( items: U diff --git a/deno/lib/types.ts b/deno/lib/types.ts index 2354a59ee..4847a36c5 100644 --- a/deno/lib/types.ts +++ b/deno/lib/types.ts @@ -2574,7 +2574,7 @@ export class ZodObject< }) as any; } - pick( + pick>( mask: Mask ): ZodObject>, UnknownKeys, Catchall> { const shape: any = {}; @@ -2591,7 +2591,7 @@ export class ZodObject< }) as any; } - omit( + omit>( mask: Mask ): ZodObject, UnknownKeys, Catchall> { const shape: any = {}; diff --git a/src/helpers/util.ts b/src/helpers/util.ts index 85419b695..fbbdbfe41 100644 --- a/src/helpers/util.ts +++ b/src/helpers/util.ts @@ -16,6 +16,7 @@ export namespace util { export type OmitKeys = Pick>; export type MakePartial = Omit & Partial>; + export type Exactly = T & Record, never>; export const arrayToEnum = ( items: U diff --git a/src/types.ts b/src/types.ts index c60be474e..7bd4551e7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2574,7 +2574,7 @@ export class ZodObject< }) as any; } - pick( + pick>( mask: Mask ): ZodObject>, UnknownKeys, Catchall> { const shape: any = {}; @@ -2591,7 +2591,7 @@ export class ZodObject< }) as any; } - omit( + omit>( mask: Mask ): ZodObject, UnknownKeys, Catchall> { const shape: any = {};