You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importtype{ConditionalKeys,EmptyObject}from'type-fest'typeConditionalPick<T,V>=Pick<T,ConditionalKeys<T,V>>extends infer Result
? ResultextendsEmptyObject
? never
: Result
: never;
or an IsEqual can do as well:
typeConditionalPick<T,V>=Pick<T,ConditionalKeys<T,V>>extends infer Result
? IsEqual<{},Result>extendstrue
? never
: Result
: never;
Activity
som-sm commentedon Jun 20, 2025
This happens because
ConditionalPickcurrently returns the{}type when no matching key is found.In cases like these, the output should probably be
never.benzaria commentedon Jun 22, 2025
@salisbury-espinosa u can use a wrapper at the moment if urgent!
or an
IsEqualcan do as well:Also I think this can settle the issue?