diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 5ad15f4d5c4..bbc4f5990de 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1377,7 +1377,8 @@ namespace ts { if (inStrictMode && node.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && node.originalKeywordKind <= SyntaxKind.LastFutureReservedWord && - !isIdentifierName(node)) { + !isIdentifierName(node) && + !isInAmbientContext(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { diff --git a/tests/baselines/reference/ambientNameRestrictions.errors.txt b/tests/baselines/reference/ambientNameRestrictions.errors.txt deleted file mode 100644 index 88dc2e13f4d..00000000000 --- a/tests/baselines/reference/ambientNameRestrictions.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/compiler/ambientNameRestrictions.ts(2,14): error TS1214: Identifier expected. 'static' is a reserved word in strict mode. Modules are automatically in strict mode. - - -==== tests/cases/compiler/ambientNameRestrictions.ts (1 errors) ==== - export declare namespace Foo { - export var static: any; - ~~~~~~ -!!! error TS1214: Identifier expected. 'static' is a reserved word in strict mode. Modules are automatically in strict mode. - } - \ No newline at end of file diff --git a/tests/baselines/reference/ambientNameRestrictions.symbols b/tests/baselines/reference/ambientNameRestrictions.symbols new file mode 100644 index 00000000000..d5b3fafaa57 --- /dev/null +++ b/tests/baselines/reference/ambientNameRestrictions.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientNameRestrictions.ts === +export declare namespace Foo { +>Foo : Symbol(Foo, Decl(ambientNameRestrictions.ts, 0, 0)) + + export var static: any; +>static : Symbol(static, Decl(ambientNameRestrictions.ts, 1, 12)) +} + diff --git a/tests/baselines/reference/ambientNameRestrictions.types b/tests/baselines/reference/ambientNameRestrictions.types new file mode 100644 index 00000000000..705319392d8 --- /dev/null +++ b/tests/baselines/reference/ambientNameRestrictions.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/ambientNameRestrictions.ts === +export declare namespace Foo { +>Foo : typeof Foo + + export var static: any; +>static : any +} +