mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
address code review feedback
This commit is contained in:
parent
aab25a891a
commit
e9fd2bcf0f
@ -1202,10 +1202,17 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation: Node, name: string, meaning: SymbolFlags): boolean {
|
||||
if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule)) {
|
||||
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_here_because_it_has_no_value_export, name);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2099,10 +2099,14 @@
|
||||
"category": "Error",
|
||||
"code": 2707
|
||||
},
|
||||
"Cannot use namespace '{0}' as a value here because it has no value export.": {
|
||||
"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",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(5,9): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
tests/cases/conformance/internalModules/moduleDeclarations/InvalidNonInstantiatedModule.ts(7,15): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
|
||||
var x: typeof M; // Error only a namespace
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/aliasOnMergedModuleInterface_1.ts(5,16): error TS2708: Cannot use namespace 'foo' as a value here because it has no value export.
|
||||
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 TS2708: 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 TS2708: Cannot use namespace 'foo' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'foo' as a value.
|
||||
|
||||
==== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts (0 errors) ====
|
||||
declare module "foo"
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/assignToModule.ts(2,1): error TS2708: Cannot use namespace 'A' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'A' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'A' as a value.
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/assignmentToReferenceTypes.ts(5,1): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
|
||||
class C {
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
|
||||
class C { }
|
||||
C = null; // Error
|
||||
|
||||
@ -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 TS2708: Cannot use namespace 'T' as a value here because it has no value export.
|
||||
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 TS2708: C
|
||||
|
||||
var f6 = (t = T) => { };
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'T' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'T' as a value.
|
||||
var f7 = (t = U) => { return t; };
|
||||
|
||||
f7().x;
|
||||
@ -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<T>' 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<T>' requires 1 type argument(s).
|
||||
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(29,18): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
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<T>' 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<T>' requires 1 type argument(s).
|
||||
@ -89,7 +89,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc
|
||||
|
||||
class D2 extends M.C { }
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
interface D3<T extends M.E> { }
|
||||
~~~
|
||||
!!! error TS2314: Generic type 'E<T>' requires 1 type argument(s).
|
||||
|
||||
@ -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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! 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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! 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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'x' as a value.
|
||||
~
|
||||
!!! error TS2694: Namespace 'x' has no exported member 'c'.
|
||||
var b: a;
|
||||
|
||||
@ -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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'x' as a value.
|
||||
~
|
||||
!!! error TS2694: Namespace 'x' has no exported member 'c'.
|
||||
var b: a;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/importDeclWithExportModifier.ts(5,19): error TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'x' as a value.
|
||||
~
|
||||
!!! error TS2694: Namespace 'x' has no exported member 'c'.
|
||||
var b: a;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/importDeclWithExportModifierAndExportAssignment.ts(5,19): error TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'x' as a value.
|
||||
~
|
||||
!!! error TS2694: Namespace 'x' has no exported member 'c'.
|
||||
export = x;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/internalModules/codeGeneration/importStatementsInterfaces.ts(23,19): error TS2708: Cannot use namespace 'a' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'a' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'a' as a value.
|
||||
var p: b.Point3D;
|
||||
var p = {x:0, y:0, z: 0 };
|
||||
}
|
||||
|
||||
@ -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 TS2708: Cannot use namespace 'm2' as a value here because it has no value export.
|
||||
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 TS2708: Cannot us
|
||||
|
||||
m2.C();
|
||||
~~
|
||||
!!! error TS2708: Cannot use namespace 'm2' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'm2' as a value.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/memberScope.ts(4,11): error TS2708: Cannot use namespace 'Basil' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'B
|
||||
export module Basil { }
|
||||
var z = Basil.Pepper;
|
||||
~~~~~
|
||||
!!! error TS2708: Cannot use namespace 'Basil' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'Basil' as a value.
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
tests/cases/compiler/moduleAsBaseType.ts(2,17): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
tests/cases/compiler/moduleAsBaseType.ts(3,21): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
tests/cases/compiler/moduleAsBaseType.ts(4,21): error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value.
|
||||
interface I extends M { }
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2709: Cannot use namespace 'M' as a type.
|
||||
class C2 implements M { }
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'M' as a value here because it has no value export.
|
||||
!!! error TS2709: Cannot use namespace 'M' as a type.
|
||||
@ -1,20 +1,20 @@
|
||||
tests/cases/compiler/moduleWithNoValuesAsType.ts(2,8): error TS2708: Cannot use namespace 'A' as a value here because it has no value export.
|
||||
tests/cases/compiler/moduleWithNoValuesAsType.ts(7,8): error TS2708: Cannot use namespace 'B' as a value here because it has no value export.
|
||||
tests/cases/compiler/moduleWithNoValuesAsType.ts(15,8): error TS2708: Cannot use namespace 'C' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'A' as a value here because it has no value export.
|
||||
!!! error TS2709: Cannot use namespace 'A' as a type.
|
||||
|
||||
module B {
|
||||
interface I {}
|
||||
}
|
||||
var b: B; // error
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'B' as a value here because it has no value export.
|
||||
!!! 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 TS2708: Cannot use
|
||||
|
||||
var c: C; // error
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'C' as a value here because it has no value export.
|
||||
!!! error TS2709: Cannot use namespace 'C' as a type.
|
||||
@ -1,19 +0,0 @@
|
||||
tests/cases/compiler/namespaceModule.ts(3,1): error TS2708: Cannot use namespace 'z' as a value here because it has no value export.
|
||||
tests/cases/compiler/namespaceModule.ts(9,1): error TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/namespaceModule.ts (2 errors) ====
|
||||
namespace z {}
|
||||
|
||||
z;
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'z' as a value here because it has no value export.
|
||||
|
||||
namespace x {
|
||||
export type z = string;
|
||||
}
|
||||
|
||||
x;
|
||||
~
|
||||
!!! error TS2708: Cannot use namespace 'x' as a value here because it has no value export.
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
//// [namespaceModule.ts]
|
||||
namespace z {}
|
||||
|
||||
z;
|
||||
|
||||
namespace x {
|
||||
export type z = string;
|
||||
}
|
||||
|
||||
x;
|
||||
|
||||
|
||||
//// [namespaceModule.js]
|
||||
z;
|
||||
x;
|
||||
@ -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 TS2708: Cannot use namespace 'HelloNamespace' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'HelloNam
|
||||
!!! error TS2693: 'HelloInterface' only refers to a type, but is being used as a value here.
|
||||
HelloNamespace.world;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2708: Cannot use namespace 'HelloNamespace' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'HelloNamespace' as a value.
|
||||
==== tests/cases/compiler/helloInterface.ts (0 errors) ====
|
||||
interface HelloInterface {
|
||||
world: any;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/typeofInternalModules.ts(15,16): error TS2708: Cannot use namespace 'importUninst' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'importUninst' as a value here because it has no value export.
|
||||
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 TS2708: Cannot use namespace 'importUninst' as a value here because it has no value export.
|
||||
!!! 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 TS2708: Cannot use namespace 'importUninst' as a value here because it has no value export.
|
||||
!!! error TS2708: Cannot use namespace 'importUninst' as a value.
|
||||
var x7: typeof Outer = Outer;
|
||||
x7 = importInst;
|
||||
~~
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
namespace z {}
|
||||
|
||||
z;
|
||||
|
||||
namespace x {
|
||||
export type z = string;
|
||||
}
|
||||
|
||||
x;
|
||||
Loading…
x
Reference in New Issue
Block a user