๐ Search Terms
Template literal type reduction
๐ Version & Regression Information
This changed in 5.5-beta (as reported in #58685).
โฏ Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta&ssl=7&ssc=1&pln=1&pc=1#code/MYewdgzgLgBApmArgWxgURgbxgQxgXhgCIciAaGAIwOMqJgF8BuAKBagE8AHOGAZSgAnAJZgA5sIBmHADwAVeAA8oCACYQY0EeIB8NAAYASTHIb7WLADZxYALwCMALhhHMaMzRJEmMX398A9AEwAPIA1lY2MLYATM4C2hLSMmh6hF4+MEHogoIgggCELEA
๐ป Code
const enum E { a = "a", b = "b" };
type Stringify<T extends string> = `${T}`;
let z1: `${E}` = "a"; // Ok
let z2: Stringify<E> = "a"; // Error!
๐ Actual behavior
Error as indicated.
๐ Expected behavior
No error.
Additional information about the issue
This is a regression from 5.4.5. Error is caused by reduction introduced in #55371.
๐ Search Terms
Template literal type reduction
๐ Version & Regression Information
This changed in 5.5-beta (as reported in #58685).
โฏ Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta&ssl=7&ssc=1&pln=1&pc=1#code/MYewdgzgLgBApmArgWxgURgbxgQxgXhgCIciAaGAIwOMqJgF8BuAKBagE8AHOGAZSgAnAJZgA5sIBmHADwAVeAA8oCACYQY0EeIB8NAAYASTHIb7WLADZxYALwCMALhhHMaMzRJEmMX398A9AEwAPIA1lY2MLYATM4C2hLSMmh6hF4+MEHogoIgggCELEA
๐ป Code
๐ Actual behavior
Error as indicated.
๐ Expected behavior
No error.
Additional information about the issue
This is a regression from 5.4.5. Error is caused by reduction introduced in #55371.