Closed
Description
🔎 Search Terms
"${string}${number}${string}
", "template literal types number between strings"
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about template literal types
⏯ Playground Link
💻 Code
const myString:`${string}${number}${string}` = 'test123test';
// ^^^^^^^^ Type '"test123test"' is not assignable to type '`${string}${number}${string}`'.ts(2322)
const myString2:`${string}${number}` = 'test123';
// ^^^^^^^^ Type '"test123"' is not assignable to type '`${string}${number}`'.ts(2322)
const myString3:`${number}${string}` = '123test'; // passes for some reason
🙁 Actual behavior
Received error "Type '"test123test"' is not assignable to type '${string}${number}${string}
'.ts(2322)" when pattern matches
🙂 Expected behavior
I expect it to match any literal string type that has a number within it
Additional information about the issue
My real use case is that I would like to be able to exclude/omit patterns like ${string}${number}${string}
, but that's not possible since it doesn't match