Template literal type ${string}${number}${string}
errors on valid values
#57355
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
🔎 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
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAtgTwMpQE4EswHMBcADAEgG9oNsBfYsAVzgCMBTVSktTLcvGAXhgHIoDaAEYATAGZB0PgG4AUAHoFMFTAB6GzRpgAVBAAcG-AERSoYyUKjG+MdBBhgQsAIYQI6LGBd0ANkagQGCgDIz5CVjIOKlpGZmJSdk4+ADooCAAKCVFRAEo5UEhYRBQo0XwEtgoY+iZOHn4zC1lFZVUtLV1QkyaJGzsHJ1d3T28-AKCQw34IxOqiGlrmPFT0rPEc-MLoeGQqrHEKhdi6yqj63j4LM1kYJRh9NwghGAAzEFQYCBA4I1QGNzgORAA
💻 Code
🙁 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 matchThe text was updated successfully, but these errors were encountered: