Closed
Description
TypeScript Version: 4.1.0-dev
In #40598 we added logic to reduce intersections of string literal types and template literal types. This logic incorrectly produces single-element intersections instead of reducing to the single constituent type. This means that '0'
and `'0' & `${number}`
are not considered identical--even though they display as the same type!
Code
var x: '0';
var x: '0' & `${number}`; // Error: 'x' must be of type '"0"', but here has type '"0"'
Expected behavior:
No error.
Actual behavior:
Error as shown above.
Playground Link:
Related Issues: #40598