-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
TemplateStringsArray could contain undefined and should always have index 0 #46825
Comments
@DanielRosenwasser
This can indeed be seen in that Playground if the aforementioned option is toggled (both functions are errors and toggling NUIA off silences them). I'm not sure why the expected behavior is for only one case to be an error, though. |
I added a more detailed explanation of the problem |
Yes, now it's clearer. However, both behaviors are expected:
This is an unfortunate reality when
Similar to above, having In both cases, this is not a bug but (at worst) a design limitation: If your expected behavior was possible to implement, |
This isn't quite right; the linked PR uses the tuple type |
Here are the discussion in releated PR #46826 (review): DanielRosenwasser:
LongTengDao:
sandersn:
|
Bug Report
🔎 Search Terms
TemplateStringsArray undefined
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code 1
Playground link with relevant code 2
💻 Code
🙁 Actual behavior
the first sample throw an error (when
"noUncheckedIndexedAccess": true
)the second sample doesn't throw an error (when
"noUncheckedIndexedAccess": false
)🙂 Expected behavior
template.raw
will always be a string):template
could beundefined
):The text was updated successfully, but these errors were encountered: