Treat +
on string literal types the same way as string templates
#44905
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Bug Report
π Search Terms
string concatenation types, template literal type
β― Playground Link
Playground
π» Code
π Actual behavior
label2
givesError: Type 'string' is not assignable to type '"A1" | "A2" | "B1" | "B2"'.
It should not be a string type as both
Letter
andNum
are clearly defined values.π Expected behavior
label2
andlabel1
should be identical.Template literals and string concatenation should act identical when joining strings.
π Version & Regression Information
Other info
The text was updated successfully, but these errors were encountered: