Fix #4170, remove error when using import=require syntax in t=ES6 and in ambient context

This is consistent with the behaviour of "export=" in --t=ES6 and in ambient contexts
This commit is contained in:
Mohamed Hegazy
2015-08-13 14:56:27 -07:00
parent 82b78d85d7
commit 7353cfaece
5 changed files with 95 additions and 1 deletions

View File

@@ -13315,7 +13315,7 @@ namespace ts {
}
}
else {
if (languageVersion >= ScriptTarget.ES6) {
if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) {
// Import equals declaration is deprecated in es6 or above
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead);
}