Skip to content

Commit

Permalink
fix(#2654): weirdly schema object type
Browse files Browse the repository at this point in the history
  • Loading branch information
fvckDesa committed Aug 24, 2023
1 parent f59be09 commit 49949f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/helpers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,17 @@ export namespace objectUtil {
// [k in keyof T]: undefined extends T[k] ? k : never;
// }[keyof T];

type requiredKeys<T extends object> = {
[k in keyof T]: undefined extends T[k] ? never : k;
type optionalKeys<T extends object> = {
[k in keyof T]: undefined extends T[k] ? k : never;
}[keyof T];

// type alkjsdf = addQuestionMarks<{ a: any }>;

export type addQuestionMarks<
T extends object,
R extends keyof T = requiredKeys<T>
// O extends keyof T = optionalKeys<T>
> = Pick<Required<T>, R> & Partial<T>;
O extends keyof T = optionalKeys<T>
> = Required<T> & Pick<Partial<T>, O>;
// Pick<Required<T>, R> & Pick<Partial<T>, Exclude<keyof T, R>>;
// = { [k in O]?: T[k] } & { [k in R]: T[k] };

export type identity<T> = T;
Expand Down

0 comments on commit 49949f4

Please sign in to comment.