diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 630f459a2ec..8ae2eb242d9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1056,7 +1056,8 @@ namespace ts { !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); } } @@ -1200,6 +1201,24 @@ namespace ts { return false; } + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation: Node, name: string, meaning: SymbolFlags): boolean { + if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule & ~SymbolFlags.Type)) { + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } + } + else if (meaning & (SymbolFlags.Type & ~SymbolFlags.NamespaceModule & ~SymbolFlags.Value)) { + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Type, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, name); + return true; + } + } + return false; + } + function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert(!!(result.flags & SymbolFlags.BlockScopedVariable || result.flags & SymbolFlags.Class || result.flags & SymbolFlags.Enum)); // Block-scoped variables cannot be used before their definition diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 075d4247460..10dc25ef70e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2099,6 +2099,14 @@ "category": "Error", "code": 2707 }, + "Cannot use namespace '{0}' as a value.": { + "category": "Error", + "code": 2708 + }, + "Cannot use namespace '{0}' as a type.": { + "category": "Error", + "code": 2709 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt b/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt index 9fd7043faa6..bc8582debd9 100644 --- a/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt +++ b/tests/baselines/reference/InvalidNonInstantiatedModule.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(5,9): error TS2304: Cannot find name 'M'. -tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(7,15): error TS2304: Cannot find name 'M'. +tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(5,9): error TS2708: Cannot use namespace 'M' as a value. +tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(7,15): error TS2708: Cannot use namespace 'M' as a value. ==== tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts (2 errors) ==== @@ -9,9 +9,9 @@ tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiate var m = M; // Error, not instantiated can not be used as var ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. var x: typeof M; // Error only a namespace ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. \ No newline at end of file diff --git a/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt b/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt index 009d405c0f5..66d9eebb3dd 100644 --- a/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt +++ b/tests/baselines/reference/aliasOnMergedModuleInterface.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2708: Cannot use namespace 'foo' as a value. ==== tests/cases/compiler/aliasOnMergedModuleInterface_1.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2304: Cann z.bar("hello"); // This should be ok var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be error ~~~ -!!! error TS2304: Cannot find name 'foo'. +!!! error TS2708: Cannot use namespace 'foo' as a value. ==== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts (0 errors) ==== declare module "foo" diff --git a/tests/baselines/reference/assignToModule.errors.txt b/tests/baselines/reference/assignToModule.errors.txt index 26121d72a05..0b8b6f27deb 100644 --- a/tests/baselines/reference/assignToModule.errors.txt +++ b/tests/baselines/reference/assignToModule.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/assignToModule.ts(2,1): error TS2304: Cannot find name 'A'. +tests/cases/compiler/assignToModule.ts(2,1): error TS2708: Cannot use namespace 'A' as a value. ==== tests/cases/compiler/assignToModule.ts (1 errors) ==== module A {} A = undefined; // invalid LHS ~ -!!! error TS2304: Cannot find name 'A'. \ No newline at end of file +!!! error TS2708: Cannot use namespace 'A' as a value. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentToReferenceTypes.errors.txt b/tests/baselines/reference/assignmentToReferenceTypes.errors.txt index 7e323479d57..5e42a2e79c6 100644 --- a/tests/baselines/reference/assignmentToReferenceTypes.errors.txt +++ b/tests/baselines/reference/assignmentToReferenceTypes.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/assignmentToReferenceTypes.ts(5,1): error TS2304: Cannot find name 'M'. +tests/cases/compiler/assignmentToReferenceTypes.ts(5,1): error TS2708: Cannot use namespace 'M' as a value. tests/cases/compiler/assignmentToReferenceTypes.ts(9,1): error TS2539: Cannot assign to 'C' because it is not a variable. tests/cases/compiler/assignmentToReferenceTypes.ts(13,1): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/compiler/assignmentToReferenceTypes.ts(16,1): error TS2539: Cannot assign to 'f' because it is not a variable. @@ -11,7 +11,7 @@ tests/cases/compiler/assignmentToReferenceTypes.ts(16,1): error TS2539: Cannot a } M = null; ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. class C { } diff --git a/tests/baselines/reference/assignments.errors.txt b/tests/baselines/reference/assignments.errors.txt index 86bbe75cd4b..cb8b7a17bdf 100644 --- a/tests/baselines/reference/assignments.errors.txt +++ b/tests/baselines/reference/assignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2304: Cannot find name 'M'. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2708: Cannot use namespace 'M' as a value. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): error TS2539: Cannot assign to 'C' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. @@ -19,7 +19,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): er module M { } M = null; // Error ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. class C { } C = null; // Error diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt index b0b0f876be4..d46963caeed 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2322: Ty tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Type 'string' cannot be converted to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Type 'string' cannot be converted to type 'number'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: Cannot find name 'T'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: Cannot use namespace 'T' as a value. ==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (8 errors) ==== @@ -52,7 +52,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: C var f6 = (t = T) => { }; ~ -!!! error TS2304: Cannot find name 'T'. +!!! error TS2708: Cannot use namespace 'T' as a value. var f7 = (t = U) => { return t; }; f7().x; \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 7635608f58e..276654562a1 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -15,7 +15,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(18,38): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(20,17): error TS2689: Cannot extend an interface 'I'. Did you mean 'implements'? tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(23,21): error TS2314: Generic type 'I' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(29,18): error TS2304: Cannot find name 'M'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(29,18): error TS2708: Cannot use namespace 'M' as a value. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(30,24): error TS2314: Generic type 'E' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(31,24): error TS2694: Namespace 'M' has no exported member 'C'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(33,22): error TS2314: Generic type 'I' requires 1 type argument(s). @@ -89,7 +89,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc class D2 extends M.C { } ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. interface D3 { } ~~~ !!! error TS2314: Generic type 'E' requires 1 type argument(s). diff --git a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt index e1b8867d069..1f545bb01f2 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt +++ b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module or namespace element. -tests/cases/compiler/importDeclWithClassModifiers.ts(5,26): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,26): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithClassModifiers.ts(5,28): error TS2694: Namespace 'x' has no exported member 'c'. tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module or namespace element. -tests/cases/compiler/importDeclWithClassModifiers.ts(6,27): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,27): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithClassModifiers.ts(6,29): error TS2694: Namespace 'x' has no exported member 'c'. tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module or namespace element. -tests/cases/compiler/importDeclWithClassModifiers.ts(7,26): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,26): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2694: Namespace 'x' has no exported member 'c'. @@ -18,21 +18,21 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2694: Namesp ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. export private import b = x.c; ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. export static import c = x.c; ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index d69a88964cc..93619813aa2 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. -tests/cases/compiler/importDeclWithDeclareModifier.ts(5,27): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,27): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2694: Namespace 'x' has no exported member 'c'. @@ -12,7 +12,7 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2694: Names ~~~~~~ !!! error TS1029: 'export' modifier must precede 'declare' modifier. ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithExportModifier.errors.txt b/tests/baselines/reference/importDeclWithExportModifier.errors.txt index 56e9a159afb..2a5dbbf74ef 100644 --- a/tests/baselines/reference/importDeclWithExportModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclWithExportModifier.ts(5,19): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithExportModifier.ts(5,19): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithExportModifier.ts(5,21): error TS2694: Namespace 'x' has no exported member 'c'. @@ -9,7 +9,7 @@ tests/cases/compiler/importDeclWithExportModifier.ts(5,21): error TS2694: Namesp } export import a = x.c; ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt index ff3c47e9f33..f9f683c502b 100644 --- a/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt +++ b/tests/baselines/reference/importDeclWithExportModifierAndExportAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,19): error TS2304: Cannot find name 'x'. +tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,19): error TS2708: Cannot use namespace 'x' as a value. tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,21): error TS2694: Namespace 'x' has no exported member 'c'. tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. @@ -10,7 +10,7 @@ tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(6,1): er } export import a = x.c; ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2708: Cannot use namespace 'x' as a value. ~ !!! error TS2694: Namespace 'x' has no exported member 'c'. export = x; diff --git a/tests/baselines/reference/importStatementsInterfaces.errors.txt b/tests/baselines/reference/importStatementsInterfaces.errors.txt index 313365fb191..a43c368a2c2 100644 --- a/tests/baselines/reference/importStatementsInterfaces.errors.txt +++ b/tests/baselines/reference/importStatementsInterfaces.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts(23,19): error TS2304: Cannot find name 'a'. +tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts(23,19): error TS2708: Cannot use namespace 'a' as a value. ==== tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts (1 errors) ==== @@ -26,7 +26,7 @@ tests/cases/conformance/internalModules/codeGeneration/importStatementsInterface import b = a.inA; var m: typeof a; ~ -!!! error TS2304: Cannot find name 'a'. +!!! error TS2708: Cannot use namespace 'a' as a value. var p: b.Point3D; var p = {x:0, y:0, z: 0 }; } diff --git a/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt b/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt index 5be40b5b7b6..cc9cc927d0f 100644 --- a/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt +++ b/tests/baselines/reference/interfaceNameAsIdentifier.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceNameAsIdentifier.ts(4,1): error TS2693: 'C' only refers to a type, but is being used as a value here. -tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2304: Cannot find name 'm2'. +tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2708: Cannot use namespace 'm2' as a value. ==== tests/cases/compiler/interfaceNameAsIdentifier.ts (2 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/interfaceNameAsIdentifier.ts(12,1): error TS2304: Cannot fi m2.C(); ~~ -!!! error TS2304: Cannot find name 'm2'. +!!! error TS2708: Cannot use namespace 'm2' as a value. \ No newline at end of file diff --git a/tests/baselines/reference/memberScope.errors.txt b/tests/baselines/reference/memberScope.errors.txt index 017a28d5f71..7af426828db 100644 --- a/tests/baselines/reference/memberScope.errors.txt +++ b/tests/baselines/reference/memberScope.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/memberScope.ts(4,11): error TS2304: Cannot find name 'Basil'. +tests/cases/compiler/memberScope.ts(4,11): error TS2708: Cannot use namespace 'Basil' as a value. ==== tests/cases/compiler/memberScope.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/memberScope.ts(4,11): error TS2304: Cannot find name 'Basil export module Basil { } var z = Basil.Pepper; ~~~~~ -!!! error TS2304: Cannot find name 'Basil'. +!!! error TS2708: Cannot use namespace 'Basil' as a value. } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAsBaseType.errors.txt b/tests/baselines/reference/moduleAsBaseType.errors.txt index ffa30ad0ab3..fd5b4f581f9 100644 --- a/tests/baselines/reference/moduleAsBaseType.errors.txt +++ b/tests/baselines/reference/moduleAsBaseType.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/moduleAsBaseType.ts(2,17): error TS2304: Cannot find name 'M'. -tests/cases/compiler/moduleAsBaseType.ts(3,21): error TS2304: Cannot find name 'M'. -tests/cases/compiler/moduleAsBaseType.ts(4,21): error TS2304: Cannot find name 'M'. +tests/cases/compiler/moduleAsBaseType.ts(2,17): error TS2708: Cannot use namespace 'M' as a value. +tests/cases/compiler/moduleAsBaseType.ts(3,21): error TS2709: Cannot use namespace 'M' as a type. +tests/cases/compiler/moduleAsBaseType.ts(4,21): error TS2709: Cannot use namespace 'M' as a type. ==== tests/cases/compiler/moduleAsBaseType.ts (3 errors) ==== module M {} class C extends M {} ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2708: Cannot use namespace 'M' as a value. interface I extends M { } ~ -!!! error TS2304: Cannot find name 'M'. +!!! error TS2709: Cannot use namespace 'M' as a type. class C2 implements M { } ~ -!!! error TS2304: Cannot find name 'M'. \ No newline at end of file +!!! error TS2709: Cannot use namespace 'M' as a type. \ No newline at end of file diff --git a/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt b/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt index c387f5d62f4..21abac79217 100644 --- a/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt +++ b/tests/baselines/reference/moduleWithNoValuesAsType.errors.txt @@ -1,20 +1,20 @@ -tests/cases/compiler/moduleWithNoValuesAsType.ts(2,8): error TS2304: Cannot find name 'A'. -tests/cases/compiler/moduleWithNoValuesAsType.ts(7,8): error TS2304: Cannot find name 'B'. -tests/cases/compiler/moduleWithNoValuesAsType.ts(15,8): error TS2304: Cannot find name 'C'. +tests/cases/compiler/moduleWithNoValuesAsType.ts(2,8): error TS2709: Cannot use namespace 'A' as a type. +tests/cases/compiler/moduleWithNoValuesAsType.ts(7,8): error TS2709: Cannot use namespace 'B' as a type. +tests/cases/compiler/moduleWithNoValuesAsType.ts(15,8): error TS2709: Cannot use namespace 'C' as a type. ==== tests/cases/compiler/moduleWithNoValuesAsType.ts (3 errors) ==== module A { } var a: A; // error ~ -!!! error TS2304: Cannot find name 'A'. +!!! error TS2709: Cannot use namespace 'A' as a type. module B { interface I {} } var b: B; // error ~ -!!! error TS2304: Cannot find name 'B'. +!!! error TS2709: Cannot use namespace 'B' as a type. module C { module M { @@ -24,4 +24,4 @@ tests/cases/compiler/moduleWithNoValuesAsType.ts(15,8): error TS2304: Cannot fin var c: C; // error ~ -!!! error TS2304: Cannot find name 'C'. \ No newline at end of file +!!! error TS2709: Cannot use namespace 'C' as a type. \ No newline at end of file diff --git a/tests/baselines/reference/typeUsedAsValueError2.errors.txt b/tests/baselines/reference/typeUsedAsValueError2.errors.txt index 3027abb0e6b..4aac95faa25 100644 --- a/tests/baselines/reference/typeUsedAsValueError2.errors.txt +++ b/tests/baselines/reference/typeUsedAsValueError2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/world.ts(4,1): error TS2693: 'HelloInterface' only refers to a type, but is being used as a value here. -tests/cases/compiler/world.ts(5,1): error TS2304: Cannot find name 'HelloNamespace'. +tests/cases/compiler/world.ts(5,1): error TS2708: Cannot use namespace 'HelloNamespace' as a value. ==== tests/cases/compiler/world.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/world.ts(5,1): error TS2304: Cannot find name 'HelloNamespa !!! error TS2693: 'HelloInterface' only refers to a type, but is being used as a value here. HelloNamespace.world; ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'HelloNamespace'. +!!! error TS2708: Cannot use namespace 'HelloNamespace' as a value. ==== tests/cases/compiler/helloInterface.ts (0 errors) ==== interface HelloInterface { world: any; diff --git a/tests/baselines/reference/typeofInternalModules.errors.txt b/tests/baselines/reference/typeofInternalModules.errors.txt index c98456c3404..5402249ea63 100644 --- a/tests/baselines/reference/typeofInternalModules.errors.txt +++ b/tests/baselines/reference/typeofInternalModules.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/typeofInternalModules.ts(15,16): error TS2304: Cannot find name 'importUninst'. +tests/cases/compiler/typeofInternalModules.ts(15,16): error TS2708: Cannot use namespace 'importUninst' as a value. tests/cases/compiler/typeofInternalModules.ts(17,9): error TS2304: Cannot find name 'Outer'. tests/cases/compiler/typeofInternalModules.ts(19,1): error TS2322: Type 'typeof Outer' is not assignable to type 'typeof instantiated'. Property 'C' is missing in type 'typeof Outer'. -tests/cases/compiler/typeofInternalModules.ts(21,16): error TS2304: Cannot find name 'importUninst'. +tests/cases/compiler/typeofInternalModules.ts(21,16): error TS2708: Cannot use namespace 'importUninst' as a value. tests/cases/compiler/typeofInternalModules.ts(23,1): error TS2322: Type 'typeof instantiated' is not assignable to type 'typeof Outer'. Property 'instantiated' is missing in type 'typeof instantiated'. @@ -24,7 +24,7 @@ tests/cases/compiler/typeofInternalModules.ts(23,1): error TS2322: Type 'typeof var x2: importInst.C = new x1(); var x3: typeof importUninst.P; // Error again ~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'importUninst'. +!!! error TS2708: Cannot use namespace 'importUninst' as a value. var x4: Outer = Outer; ~~~~~ @@ -37,7 +37,7 @@ tests/cases/compiler/typeofInternalModules.ts(23,1): error TS2322: Type 'typeof x5 = Outer.instantiated; var x6: typeof importUninst; ~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'importUninst'. +!!! error TS2708: Cannot use namespace 'importUninst' as a value. var x7: typeof Outer = Outer; x7 = importInst; ~~