You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It’s not just String.raw, this applies to all tagged template literals, where the top‑level TemplateStringArray contains undefined for an unknown escape, so this should also update TemplateStringsArray:
The definition of TemplateStringArray should include undefined in the top‑level index signature, which should be fixed alongside this to correctly describe the runtime behaviour as of tc39/ecma262@138c9ef.
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.
The definition of TemplateStringArray should include undefined in the top‑level index signature,
I'm afraid such a change will break existing code. undefined is there only if a part of string template contains invalid escape characters, and this information is available in compile-time. I'd suggest replacing TemplateStringsArray with a readonly tuple of strings and undefineds, intersected with {raw: ...}. of equal-sized tuple of strings. This type should be backwards compatible.
Activity
DanielRosenwasser commentedon Feb 20, 2021
Wenlu Wang (@Kingwl) you might be interested in this one.
ExE-Boss commentedon Feb 20, 2021
It’s not just
String.raw, this applies to all tagged template literals, where the top‑levelTemplateStringArraycontainsundefinedfor an unknown escape, so this should also updateTemplateStringsArray:Workbench Repro
Also, this doesn’t occur when the
\ufollows a substitution.Kingwl commentedon Feb 20, 2021
Sorry I'm not 100% sure what your means.
But seems the runtime behavior is as expected.
The current problem is falsely alarm.
Here's some context:
And I have found an PR who try to fix a part of the alarm: #41030
ExE-Boss commentedon Feb 20, 2021
The definition of
TemplateStringArrayshould includeundefinedin the top‑level index signature, which should be fixed alongside this to correctly describe the runtime behaviour as of tc39/ecma262@138c9ef.Kingwl commentedon Feb 20, 2021
Ahhhh Okay. Got the point. Thanks.
elibarzilay commentedon Jun 3, 2021
I think that dealing with octal escapes in all strings #396 should be done before dealing with tagged templates as an exception...
typescript-bot commentedon Apr 14, 2022
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.
Comment by ExE Boss (@ExE-Boss)
❌ Failed: -
Hexadecimal digit expected.Historical Information
❌ Failed: -
Hexadecimal digit expected.bentongxyz commentedon Apr 28, 2022
Hi, is this issue being worked on? I would like to look into this as a first issue.
reverofevil commentedon May 22, 2022
Almost created a duplicate to this issue.
The proposal was here, normative section in ECMA-262 here.
reverofevil commentedon May 22, 2022
ExE Boss (@ExE-Boss)
I'm afraid such a change will break existing code.
undefinedis there only if a part of string template contains invalid escape characters, and this information is available in compile-time. I'd suggest replacingTemplateStringsArraywith areadonlytuple ofstrings andundefineds, intersected with{raw: ...}. of equal-sized tuple ofstrings. This type should be backwards compatible.