Open trevorade opened 1 year ago
https://github.com/Microsoft/TypeScript/issues/27024#issuecomment-845655557 has a robust solution that seems to solve this (TS Playground link). It's a much longer type though, and seemingly not perfect either.
Seemingly, according to Update 1 on this StackOverflow answer, under TypeScript's implementation {a: 1} & {b: 2}
and {a: 1, b: 2}
aren't actually the same. Not sure if that means they should or shouldn't be equal on the type level, though.
microsoft/TypeScript#48100 is an open issue tracking type equality and its definition. Seems that a recursive Simplify
can fix some issues with equality as well.
There are two self-identity bugs that can pretty simply be fixed: TS Playground
Both of these evaluate to false:
The fix is to expand the check a touch:
There's also this intersection bug but I'm unaware of a fix: TS Playground
This evaluates to false:
Upvote & Fund