mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Don't error when 'reserved' names appear in ambient contexts.
Fixes #8293
This commit is contained in:
parent
fed42cc6bd
commit
de4f2797c6
@ -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) {
|
||||
|
||||
@ -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.
|
||||
}
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
8
tests/baselines/reference/ambientNameRestrictions.types
Normal file
8
tests/baselines/reference/ambientNameRestrictions.types
Normal file
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/ambientNameRestrictions.ts ===
|
||||
export declare namespace Foo {
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var static: any;
|
||||
>static : any
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user