Skip to content

Commit 886a41e

Browse files
committed
Revert namespace
1 parent 70973bb commit 886a41e

10 files changed

+4
-74
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
27342734

27352735
function addDeclarationDiagnostic(id: string, message: DiagnosticMessage) {
27362736
return (declaration: Declaration) => {
2737-
if (!isTypeDeclaration(declaration) && declaration.kind !== SyntaxKind.ClassDeclaration && declaration.kind !== SyntaxKind.ModuleDeclaration) {
2737+
if (!isTypeDeclaration(declaration) && declaration.kind !== SyntaxKind.ClassDeclaration) {
27382738
diagnostics.add(createDiagnosticForNode(declaration, message, id));
27392739
}
27402740
};
@@ -45641,10 +45641,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4564145641
}
4564245642
}
4564345643

45644-
if (node.name.kind === SyntaxKind.Identifier) {
45645-
checkTypeNameIsReserved(node.name, Diagnostics.Namespace_name_cannot_be_0);
45646-
}
45647-
4564845644
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
4564945645

4565045646
function checkModuleDeclarationDiagnostics() {

tests/baselines/reference/parserModuleDeclaration11.errors.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/baselines/reference/parserModuleDeclaration12.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/parserModuleDeclaration6.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/parserModuleDeclaration7.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/parserModuleDeclaration8.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/parserModuleDeclaration9.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/primitiveTypeAsmoduleName.errors.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/baselines/reference/typeNamedUndefined2.errors.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
typeNamedUndefined2.ts(2,22): error TS2819: Namespace name cannot be 'undefined'.
21
typeNamedUndefined2.ts(4,21): error TS2457: Type alias name cannot be 'undefined'.
3-
typeNamedUndefined2.ts(15,18): error TS2819: Namespace name cannot be 'undefined'.
42
typeNamedUndefined2.ts(17,17): error TS2457: Type alias name cannot be 'undefined'.
53

64

7-
==== typeNamedUndefined2.ts (4 errors) ====
5+
==== typeNamedUndefined2.ts (2 errors) ====
86
export namespace ns {
97
export namespace undefined {
10-
~~~~~~~~~
11-
!!! error TS2819: Namespace name cannot be 'undefined'.
128
export const s = Symbol();
139
export type undefined = typeof s;
1410
~~~~~~~~~
@@ -24,8 +20,6 @@ typeNamedUndefined2.ts(17,17): error TS2457: Type alias name cannot be 'undefine
2420
}
2521

2622
export namespace undefined {
27-
~~~~~~~~~
28-
!!! error TS2819: Namespace name cannot be 'undefined'.
2923
export const s = Symbol();
3024
export type undefined = typeof s;
3125
~~~~~~~~~

tests/baselines/reference/undefinedTypeAssignment4.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
undefinedTypeAssignment4.ts(1,7): error TS2414: Class name cannot be 'undefined'.
22
undefinedTypeAssignment4.ts(4,11): error TS2427: Interface name cannot be 'undefined'.
3-
undefinedTypeAssignment4.ts(7,11): error TS2819: Namespace name cannot be 'undefined'.
3+
undefinedTypeAssignment4.ts(7,11): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
44

55

66
==== undefinedTypeAssignment4.ts (3 errors) ====
@@ -16,7 +16,7 @@ undefinedTypeAssignment4.ts(7,11): error TS2819: Namespace name cannot be 'undef
1616
}
1717
namespace undefined {
1818
~~~~~~~~~
19-
!!! error TS2819: Namespace name cannot be 'undefined'.
19+
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
2020
export var x = 42;
2121
}
2222
var x: undefined;

0 commit comments

Comments
 (0)