-
Notifications
You must be signed in to change notification settings - Fork 12.8k
template literal types starting with ${string} don't work when the string has more than 1 character #42903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is working as intended. The pattern matching we use in template literal type inference and assignability checking is (by design) pretty simple. From #40336:
For your example code to behave as you expected we'd have to scan ahead and find the point where the remainder of the string is a valid number. But valid numbers include things like |
i see. can this be changed to a feature suggestion instead of a bug then? |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug ReportSuggestionπ Search Terms
template literal types string
π Version & Regression Information
4.3.0-dev.20210221
β― Playground Link
https://www.typescriptlang.org/play?ts=4.3.0-dev.20210221#code/MYewdgzgLgBAZiEAuGADAJAb2gJwJZgDmAvlmAK4C2ARgKY7GowC8MA5AIYCMATAMxsYAeiFgQMejhA4AsAChQkWNQ44UGbFHxFSmCjXqMW7BCF4DhQgCoBPAA612AIlPmngvBBhjYHCBDxCMA5qABtHKHEoe0c2DVwCEjIqOgZUNgA6IA
π» Code
π Actual behavior
π Expected behavior
no error
The text was updated successfully, but these errors were encountered: