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
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too