Bug Report
π Search Terms
TS2352, sufficiently overlaps
π Version & Regression Information
- This changed between versions 4.7.2 and v4.8.0-dev.20220609
β― Playground Link
Playground link (4.7.2) with relevant code (no error)
Playground link (nightly) with relevant code showing the error
π» Code
functionf<U,T,XextendsU|T>(x: X){const_: U=xasU;// ^^^^^^// Conversion of type 'X' to type 'U' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.// 'U' could be instantiated with an arbitrary type which could be unrelated to 'X'.(2352)}π Actual behavior
This is an error in nightly (4.8.0) but was fine in 4.7.2.
π Expected behavior
The new error doesn't feel helpful to me. I expect assigning U|T to U to be an error. But the explicit cast feels enough to me because U|T seem related to U. I don't feel like casting through unknown should be necessary.
Bug Report
π Search Terms
TS2352, sufficiently overlaps
π Version & Regression Information
β― Playground Link
Playground link (4.7.2) with relevant code (no error)
Playground link (nightly) with relevant code showing the error
π» Code
π Actual behavior
This is an error in nightly (4.8.0) but was fine in 4.7.2.
π Expected behavior
The new error doesn't feel helpful to me. I expect assigning
U|TtoUto be an error. But the explicit cast feels enough to me becauseU|Tseem related toU. I don't feel like casting throughunknownshould be necessary.