I think these type should be equal:<p><pre><code> { a: string | undefined }
{ a: string } | { a: undefined }
</code></pre>
These mean same set of values. And if these are equals, the following works:<p><pre><code> Exclude<{ a: string | undefined }, { a: string }> // => { a: undefined }
</code></pre>
But it don't work as I expected. Because { a: string | undefined } is not { a: string } | { a: undefined }.<p>If it works, Exclude<A, B> could be considered as subtraction of set in mathematical context.
I think there is big deals if these types are equals. Why not?
And please tell me related GitHub issues if you know.
Must be happening for a reason:
- Type equivalence is an edge case not covered yet
- Type equivalence calculation is too expensive so that compilation time is preferred than type equivalence completeness<p>If you would, please post it in issues, that'll be great <a href="https://github.com/microsoft/TypeScript/issues" rel="nofollow">https://github.com/microsoft/TypeScript/issues</a>