tried to simplify your solution
type OptionalFields<T extends Config> = Pick<T,{ [K in keyof T]: T[K] extends false ? K : never }[keyof T]> type Result<C extends Config> = Required<Omit<User, keyof OptionalFields<C>>> declare function getUser<C extends Config>( config: C ): Result<C>;
--edit one more minor improvement
type OptionalFields<T extends Config> = { [K in keyof T]: T[K] extends false ? K : never }[keyof T] type Result<C extends Config> = Required<Omit<User, OptionalFields<C>>>
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
tried to simplify your solution
--edit
one more minor improvement