Microsoft/TypeScript
Vedi su GitHubGracefully handle template literal properties in the parser
Open
#1057 aperta il 4 nov 2014
Domain: Error MessagesEffort: ModerateExperience EnhancementHelp Wanted
Metriche repository
- Star
- (48.455 star)
- Metriche merge PR
- (Merge medio 6g 17h) (9 PR mergiate in 30 g)
Descrizione
var x = {
a: "Hello"
`b`: 123
}
Right now, the parser encounters the template string, decides it should bail out of object literal parsing, and we more or less recover thinking we have something like the following:
var x = ({ a: "Hello" } `b`) : 123 }
So we'll report an error on what we think is:
{ a: "Hello" } `b`
- On the syntactic layer under ES5 mode, we'll say tagged templates are not supported unless in ES6.
- On the semantic layer, we'll say
{ a: "Hello" }is not invokable.