Skip to content

Commit

Permalink
fix(types): rm base pick/omit types as they conflict with more specif…
Browse files Browse the repository at this point in the history
…ic ones
  • Loading branch information
jquense committed Dec 7, 2020
1 parent ecad1a3 commit 14e2c8c
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,7 @@ export default class ObjectSchema<
return next as any;
}

pick<TKey extends keyof TShape>(
keys: TKey[],
): ObjectSchema<
Pick<TShape, TKey>,
TContext,
TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>,
AssertsShape<Pick<TShape, TKey>> | Optionals<TOut>
> {
pick(keys: string[]) {
const picked: any = {};
for (const key of keys) {
if (this.fields[key]) picked[key] = this.fields[key];
Expand All @@ -375,14 +368,7 @@ export default class ObjectSchema<
}) as any;
}

omit<TKey extends keyof TShape>(
keys: TKey[],
): ObjectSchema<
Omit<TShape, TKey>,
TContext,
TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>,
AssertsShape<Omit<TShape, TKey>> | Optionals<TOut>
> {
omit(keys: string[]): any {
const next = this.clone() as any;
const fields = next.fields;
next.fields = {};
Expand Down

0 comments on commit 14e2c8c

Please sign in to comment.