Microsoft/TypeScript
在 GitHub 查看Gracefully handle template literal properties in the parser
Open
#1,057 建立於 2014年11月4日
Domain: Error MessagesEffort: ModerateExperience EnhancementHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
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.