We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Most of the time when I want to test for equality, I actually care about mutual assignability (aka bivariance), not exact equality.
import {IsEqual, And} from 'type-fest' type IsBivariant<T1, T2> = And<T1 extends T2 ? true : false, T2 extends T1 ? true : false>; type T1 = { k: string } type T2 = { k: string } type T3 = T1 | T2 type test1 = IsEqual<T1, T3>; // false type test2 = IsBivariant<T1, T3>; // true
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbwJIGcCiBHArgQwDYA0cAggHYAmAvnAGZQQhwDkMAnmAKYC0NHKMTAFCC2nOKgBCwAG44owHKRgAeACoBGIqoBMAPjgBeEhTXq4HAB4wOFFHB1wA-HBhQsHOAC5a+FBy3a5lY25HYaTi5uHt40vhy6ANzCoh7hRghwANbe-PKkAOZwlCLsqYHpWTmuwAVFJWKqAMyG9mYAPvbayaUufDBmRqiYuHimWo2JcAD0Uz54fvUe1vzl4ihSsvKKKhrjkzOR7sJAA
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Type description + examples
Most of the time when I want to test for equality, I actually care about mutual assignability (aka bivariance), not exact equality.
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbwJIGcCiBHArgQwDYA0cAggHYAmAvnAGZQQhwDkMAnmAKYC0NHKMTAFCC2nOKgBCwAG44owHKRgAeACoBGIqoBMAPjgBeEhTXq4HAB4wOFFHB1wA-HBhQsHOAC5a+FBy3a5lY25HYaTi5uHt40vhy6ANzCoh7hRghwANbe-PKkAOZwlCLsqYHpWTmuwAVFJWKqAMyG9mYAPvbayaUufDBmRqiYuHimWo2JcAD0Uz54fvUe1vzl4ihSsvKKKhrjkzOR7sJAA
Type source
No response
Search existing types and issues first
Upvote & Fund
The text was updated successfully, but these errors were encountered: