Disable computed properties in TypeScript 1.4

This commit is contained in:
Jason Freeman
2014-12-11 16:49:24 -08:00
parent b4082cec1b
commit d385f2ebf4
49 changed files with 167 additions and 319 deletions

View File

@@ -431,5 +431,6 @@ module ts {
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported." },
Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported." },
};
}

View File

@@ -1723,5 +1723,9 @@
"'generators' are not currently supported.": {
"category": "Error",
"code": 9001
},
"Computed property names are not currently supported.": {
"category": "Error",
"code": 9002
}
}

View File

@@ -4901,6 +4901,10 @@ module ts {
}
function checkComputedPropertyName(node: ComputedPropertyName) {
// Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4
// Once full support is added, remove this error.
return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported);
if (languageVersion < ScriptTarget.ES6) {
return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
}