diff --git a/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt new file mode 100644 index 00000000000..9ec8f6892e9 --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt @@ -0,0 +1,17 @@ +module.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== module.d.ts (1 errors) ==== + declare module Point { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var Origin: { x: number; y: number; } + } + +==== function.d.ts (0 errors) ==== + declare function Point(): { x: number; y: number; } + +==== test.ts (0 errors) ==== + var cl: { x: number; y: number; } + var cl = Point(); + var cl = Point.Origin; \ No newline at end of file diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt new file mode 100644 index 00000000000..7495c0262ac --- /dev/null +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.errors.txt @@ -0,0 +1,19 @@ +module.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== module.d.ts (1 errors) ==== + declare module Point { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var Origin: { x: number; y: number; } + } + +==== function.ts (0 errors) ==== + function Point() { + return { x: 0, y: 0 }; + } + +==== test.ts (0 errors) ==== + var cl: { x: number; y: number; } + var cl = Point(); + var cl = Point.Origin; \ No newline at end of file diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt index 10513ef9e6d..657b00c0a0b 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt @@ -1,7 +1,8 @@ +ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,24): error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. -==== ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ==== +==== ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (2 errors) ==== class clodule { id: string; value: T; @@ -10,6 +11,8 @@ ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics } module clodule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // error: duplicate identifier expected export function fn(x: T, y: T): number { return clodule.sfn('a'); diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.errors.txt new file mode 100644 index 00000000000..6f4a62e8a45 --- /dev/null +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.errors.txt @@ -0,0 +1,22 @@ +EnumAndModuleWithSameNameAndCommonRoot.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== EnumAndModuleWithSameNameAndCommonRoot.ts (1 errors) ==== + enum enumdule { + Red, Blue + } + + module enumdule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Point { + constructor(public x: number, public y: number) { } + } + } + + var x: enumdule; + var x = enumdule.Red; + + var y: { x: number; y: number }; + var y = new enumdule.Point(0, 0); \ No newline at end of file diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.errors.txt b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.errors.txt new file mode 100644 index 00000000000..985692c906f --- /dev/null +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.errors.txt @@ -0,0 +1,25 @@ +ExportClassWhichExtendsInterfaceWithInaccessibleType.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportClassWhichExtendsInterfaceWithInaccessibleType.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + interface Point { + x: number; + y: number; + + fromOrigin(p: Point): number; + } + + export class Point2d implements Point { + constructor(public x: number, public y: number) { } + + fromOrigin(p: Point) { + return 1; + } + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.errors.txt b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.errors.txt new file mode 100644 index 00000000000..54701a22f12 --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.errors.txt @@ -0,0 +1,21 @@ +ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Point { + x: number; + y: number; + } + + export class Line { + constructor(public start: Point, public end: Point) { } + } + + export function fromOrigin(p: Point): Line { + return new Line({ x: 0, y: 0 }, p); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.errors.txt b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.errors.txt new file mode 100644 index 00000000000..7d5cd6241ba --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.errors.txt @@ -0,0 +1,21 @@ +ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + class Point { + x: number; + y: number; + } + + export class Line { + constructor(public start: Point, public end: Point) { } + } + + export function fromOrigin(p: Point): Line { + return new Line({ x: 0, y: 0 }, p); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.errors.txt b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.errors.txt new file mode 100644 index 00000000000..825bf9de954 --- /dev/null +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.errors.txt @@ -0,0 +1,21 @@ +ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Point { + x: number; + y: number; + } + + class Line { + constructor(public start: Point, public end: Point) { } + } + + export function fromOrigin(p: Point): Line { + return new Line({ x: 0, y: 0 }, p); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt new file mode 100644 index 00000000000..aabf8bdff6f --- /dev/null +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.errors.txt @@ -0,0 +1,17 @@ +ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + class Point { + constructor(public x: number, public y: number) { } + } + + export var UnitSquare : { + top: { left: Point, right: Point }, + bottom: { left: Point, right: Point } + } = null; + } \ No newline at end of file diff --git a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.errors.txt b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.errors.txt new file mode 100644 index 00000000000..57429a19ff3 --- /dev/null +++ b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.errors.txt @@ -0,0 +1,24 @@ +ExportVariableWithInaccessibleTypeInTypeAnnotation.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ExportVariableWithInaccessibleTypeInTypeAnnotation.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export interface Point { + x: number; + y: number; + } + + // valid since Point is exported + export var Origin: Point = { x: 0, y: 0 }; + + interface Point3d extends Point { + z: number; + } + + // invalid Point3d is not exported + export var Origin3d: Point3d = { x: 0, y: 0, z: 0 }; + } + \ No newline at end of file diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.errors.txt b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.errors.txt new file mode 100644 index 00000000000..a67478b1a01 --- /dev/null +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.errors.txt @@ -0,0 +1,32 @@ +function.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +module.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +module.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== function.ts (1 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function Point() { + return { x: 0, y: 0 }; + } + } + +==== module.ts (2 errors) ==== + module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module Point { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var Origin = { x: 0, y: 0 }; + } + } + +==== test.ts (0 errors) ==== + var fn: () => { x: number; y: number }; + var fn = A.Point; + + var cl: { x: number; y: number; } + var cl = B.Point.Origin; + \ No newline at end of file diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.errors.txt new file mode 100644 index 00000000000..6ffddf6efd1 --- /dev/null +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.errors.txt @@ -0,0 +1,22 @@ +ModuleAndEnumWithSameNameAndCommonRoot.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ModuleAndEnumWithSameNameAndCommonRoot.ts (1 errors) ==== + module enumdule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Point { + constructor(public x: number, public y: number) { } + } + } + + enum enumdule { + Red, Blue + } + + var x: enumdule; + var x = enumdule.Red; + + var y: { x: number; y: number }; + var y = new enumdule.Point(0, 0); \ No newline at end of file diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt index 5578e472334..2decb17efd3 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.errors.txt @@ -1,8 +1,13 @@ +ModuleWithExportedAndNonExportedImportAlias.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ModuleWithExportedAndNonExportedImportAlias.ts(12,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ModuleWithExportedAndNonExportedImportAlias.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ModuleWithExportedAndNonExportedImportAlias.ts(37,21): error TS2339: Property 'Lines' does not exist on type 'typeof Geometry'. -==== ModuleWithExportedAndNonExportedImportAlias.ts (1 errors) ==== +==== ModuleWithExportedAndNonExportedImportAlias.ts (4 errors) ==== module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface Point { x: number; y: number; @@ -14,12 +19,16 @@ ModuleWithExportedAndNonExportedImportAlias.ts(37,21): error TS2339: Property 'L } module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Line { constructor(public start: A.Point, public end: A.Point) { } } } module Geometry { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export import Points = A; import Lines = B; diff --git a/tests/baselines/reference/accessorsInAmbientContext.errors.txt b/tests/baselines/reference/accessorsInAmbientContext.errors.txt index 89cd98a0a0c..1cf20ba2859 100644 --- a/tests/baselines/reference/accessorsInAmbientContext.errors.txt +++ b/tests/baselines/reference/accessorsInAmbientContext.errors.txt @@ -1,3 +1,4 @@ +accessorsInAmbientContext.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. accessorsInAmbientContext.ts(3,17): error TS1183: An implementation cannot be declared in ambient contexts. accessorsInAmbientContext.ts(4,18): error TS1183: An implementation cannot be declared in ambient contexts. accessorsInAmbientContext.ts(6,24): error TS1183: An implementation cannot be declared in ambient contexts. @@ -8,8 +9,10 @@ accessorsInAmbientContext.ts(15,20): error TS1183: An implementation cannot be d accessorsInAmbientContext.ts(16,21): error TS1183: An implementation cannot be declared in ambient contexts. -==== accessorsInAmbientContext.ts (8 errors) ==== +==== accessorsInAmbientContext.ts (9 errors) ==== declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C { get X() { return 1; } ~ diff --git a/tests/baselines/reference/aliasesInSystemModule1.errors.txt b/tests/baselines/reference/aliasesInSystemModule1.errors.txt index cbd259f770a..c0db7b033d7 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.errors.txt +++ b/tests/baselines/reference/aliasesInSystemModule1.errors.txt @@ -1,7 +1,8 @@ aliasesInSystemModule1.ts(1,24): error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +aliasesInSystemModule1.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== aliasesInSystemModule1.ts (1 errors) ==== +==== aliasesInSystemModule1.ts (2 errors) ==== import alias = require('foo'); ~~~~~ !!! error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? @@ -13,6 +14,8 @@ aliasesInSystemModule1.ts(1,24): error TS2792: Cannot find module 'foo'. Did you let z = new cls2(); module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export import cls = alias.Class; let x = new alias.Class(); let y = new cls(); diff --git a/tests/baselines/reference/aliasesInSystemModule2.errors.txt b/tests/baselines/reference/aliasesInSystemModule2.errors.txt index e484e65dd8a..396dede61aa 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.errors.txt +++ b/tests/baselines/reference/aliasesInSystemModule2.errors.txt @@ -1,7 +1,8 @@ aliasesInSystemModule2.ts(1,21): error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +aliasesInSystemModule2.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== aliasesInSystemModule2.ts (1 errors) ==== +==== aliasesInSystemModule2.ts (2 errors) ==== import {alias} from "foo"; ~~~~~ !!! error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? @@ -13,6 +14,8 @@ aliasesInSystemModule2.ts(1,21): error TS2792: Cannot find module 'foo'. Did you let z = new cls2(); module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export import cls = alias.Class; let x = new alias.Class(); let y = new cls(); diff --git a/tests/baselines/reference/ambientDeclarations.errors.txt b/tests/baselines/reference/ambientDeclarations.errors.txt new file mode 100644 index 00000000000..1d5f527da74 --- /dev/null +++ b/tests/baselines/reference/ambientDeclarations.errors.txt @@ -0,0 +1,85 @@ +ambientDeclarations.ts(55,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientDeclarations.ts(61,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ambientDeclarations.ts (2 errors) ==== + // Ambient variable without type annotation + declare var n; + + // Ambient variable with type annotation + declare var m: string; + + // Ambient function with no type annotations + declare function fn1(); + + // Ambient function with type annotations + declare function fn2(n: string): number; + + // Ambient function with valid overloads + declare function fn3(n: string): number; + declare function fn4(n: number, y: number): string; + + // Ambient function with optional parameters + declare function fn5(x, y?); + declare function fn6(e?); + declare function fn7(x, y?, ...z); + declare function fn8(y?, ...z: number[]); + declare function fn9(...q: {}[]); + declare function fn10(...q: T[]); + + // Ambient class + declare class cls { + constructor(); + method(): cls; + static static(p): number; + static q; + private fn(); + private static fns(); + } + + // Ambient enum + declare enum E1 { + x, + y, + z + } + + // Ambient enum with integer literal initializer + declare enum E2 { + q, + a = 1, + b, + c = 2, + d + } + + // Ambient enum members are always exported with or without export keyword + declare enum E3 { + A + } + declare module E3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var B; + } + var x = E3.B; + + // Ambient module + declare module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x; + function fn(): number; + } + + // Ambient module members are always exported with or without export keyword + var p = M1.x; + var q = M1.fn(); + + // Ambient external module in the global module + // Ambient external module with a string literal name that is a top level external module name + declare module 'external1' { + var q; + } + + \ No newline at end of file diff --git a/tests/baselines/reference/ambientDeclarations.types b/tests/baselines/reference/ambientDeclarations.types index c403f220e08..fa48dbc4bbf 100644 --- a/tests/baselines/reference/ambientDeclarations.types +++ b/tests/baselines/reference/ambientDeclarations.types @@ -4,6 +4,7 @@ // Ambient variable without type annotation declare var n; >n : any +> : ^^^ // Ambient variable with type annotation declare var m: string; @@ -42,18 +43,23 @@ declare function fn5(x, y?); >fn5 : (x: any, y?: any) => any > : ^ ^^^^^^^ ^^^^^^^^^^^^^^ >x : any +> : ^^^ >y : any +> : ^^^ declare function fn6(e?); >fn6 : (e?: any) => any > : ^ ^^^^^^^^^^^^^^ >e : any +> : ^^^ declare function fn7(x, y?, ...z); >fn7 : (x: any, y?: any, ...z: any[]) => any > : ^ ^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ >x : any +> : ^^^ >y : any +> : ^^^ >z : any[] > : ^^^^^ @@ -61,6 +67,7 @@ declare function fn8(y?, ...z: number[]); >fn8 : (y?: any, ...z: number[]) => any > : ^ ^^^^^^^^^^^ ^^ ^^^^^^^^ >y : any +> : ^^^ >z : number[] > : ^^^^^^^^ @@ -90,9 +97,11 @@ declare class cls { >static : (p: any) => number > : ^ ^^^^^^^^^^ >p : any +> : ^^^ static q; >q : any +> : ^^^ private fn(); >fn : () => any @@ -166,10 +175,13 @@ declare module E3 { var B; >B : any +> : ^^^ } var x = E3.B; >x : any +> : ^^^ >E3.B : any +> : ^^^ >E3 : typeof E3 > : ^^^^^^^^^ >B : any @@ -182,6 +194,7 @@ declare module M1 { var x; >x : any +> : ^^^ function fn(): number; >fn : () => number @@ -191,7 +204,9 @@ declare module M1 { // Ambient module members are always exported with or without export keyword var p = M1.x; >p : any +> : ^^^ >M1.x : any +> : ^^^ >M1 : typeof M1 > : ^^^^^^^^^ >x : any @@ -217,6 +232,7 @@ declare module 'external1' { var q; >q : any +> : ^^^ } diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index ce20862cdb8..5c8f3b4b2ef 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -2,6 +2,7 @@ ambientErrors.ts(2,17): error TS1039: Initializers are not allowed in ambient co ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. ambientErrors.ts(20,24): error TS1183: An implementation cannot be declared in ambient contexts. ambientErrors.ts(29,9): error TS1066: In ambient enum declarations member initializer must be constant expression. +ambientErrors.ts(33,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ambientErrors.ts(34,13): error TS1039: Initializers are not allowed in ambient contexts. ambientErrors.ts(35,19): error TS1183: An implementation cannot be declared in ambient contexts. ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts. @@ -9,12 +10,13 @@ ambientErrors.ts(38,13): error TS1039: Initializers are not allowed in ambient c ambientErrors.ts(39,23): error TS1183: An implementation cannot be declared in ambient contexts. ambientErrors.ts(40,14): error TS1183: An implementation cannot be declared in ambient contexts. ambientErrors.ts(41,22): error TS1183: An implementation cannot be declared in ambient contexts. +ambientErrors.ts(46,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name. ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== ambientErrors.ts (14 errors) ==== +==== ambientErrors.ts (16 errors) ==== // Ambient variable with an initializer declare var x = 4; ~ @@ -56,6 +58,8 @@ ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a m // Ambient module with initializers for values, bodies for functions / classes declare module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x = 3; ~ !!! error TS1039: Initializers are not allowed in ambient contexts. @@ -83,6 +87,8 @@ ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a m // Ambient external module not in the global module module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare module 'nope' { } ~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. diff --git a/tests/baselines/reference/ambientInsideNonAmbient.errors.txt b/tests/baselines/reference/ambientInsideNonAmbient.errors.txt new file mode 100644 index 00000000000..87f04fecf80 --- /dev/null +++ b/tests/baselines/reference/ambientInsideNonAmbient.errors.txt @@ -0,0 +1,30 @@ +ambientInsideNonAmbient.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientInsideNonAmbient.ts(6,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientInsideNonAmbient.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientInsideNonAmbient.ts(14,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ambientInsideNonAmbient.ts (4 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare var x; + export declare function f(); + export declare class C { } + export declare enum E { } + export declare module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + declare var x; + declare function f(); + declare class C { } + declare enum E { } + declare module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } \ No newline at end of file diff --git a/tests/baselines/reference/ambientInsideNonAmbient.types b/tests/baselines/reference/ambientInsideNonAmbient.types index f9d70628698..fbabcf0fd11 100644 --- a/tests/baselines/reference/ambientInsideNonAmbient.types +++ b/tests/baselines/reference/ambientInsideNonAmbient.types @@ -7,6 +7,7 @@ module M { export declare var x; >x : any +> : ^^^ export declare function f(); >f : () => any @@ -29,6 +30,7 @@ module M2 { declare var x; >x : any +> : ^^^ declare function f(); >f : () => any diff --git a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.errors.txt b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.errors.txt index 32d0fa85f96..3a653a94ba2 100644 --- a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.errors.txt +++ b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.errors.txt @@ -1,19 +1,31 @@ +ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(3,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(3,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(9,21): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(11,1): error TS2304: Cannot find name 'declare'. ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(11,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(11,16): error TS2819: Namespace name cannot be 'debugger'. ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts(11,25): error TS1005: ';' expected. -==== ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts (4 errors) ==== +==== ambientModuleDeclarationWithReservedIdentifierInDottedPath.ts (8 errors) ==== // https://github.com/microsoft/TypeScript/issues/7840 declare module chrome.debugger { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare var tabId: number; } export const tabId = chrome.debugger.tabId; declare module test.class {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare module debugger {} // still an error ~~~~~~~ diff --git a/tests/baselines/reference/ambientModuleExports.errors.txt b/tests/baselines/reference/ambientModuleExports.errors.txt new file mode 100644 index 00000000000..1c4f09c44cd --- /dev/null +++ b/tests/baselines/reference/ambientModuleExports.errors.txt @@ -0,0 +1,28 @@ +ambientModuleExports.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ambientModuleExports.ts(11,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ambientModuleExports.ts (2 errors) ==== + declare module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function a():void; + var b:number; + class C {} + } + + Foo.a(); + Foo.b; + var c = new Foo.C(); + + declare module Foo2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function a(): void; + export var b: number; + export class C { } + } + + Foo2.a(); + Foo2.b; + var c2 = new Foo2.C(); \ No newline at end of file diff --git a/tests/baselines/reference/ambientModuleWithTemplateLiterals.errors.txt b/tests/baselines/reference/ambientModuleWithTemplateLiterals.errors.txt new file mode 100644 index 00000000000..92c2c9b5f2a --- /dev/null +++ b/tests/baselines/reference/ambientModuleWithTemplateLiterals.errors.txt @@ -0,0 +1,26 @@ +ambientModuleWithTemplateLiterals.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ambientModuleWithTemplateLiterals.ts (1 errors) ==== + declare module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + enum Bar { + a = `1`, + b = '2', + c = '3' + } + + export const a = 'string'; + export const b = `template`; + + export const c = Bar.a; + export const d = Bar['b']; + export const e = Bar[`c`]; + } + + Foo.a; + Foo.b; + Foo.c; + Foo.d; + Foo.e; \ No newline at end of file diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.errors.txt b/tests/baselines/reference/anyAssignabilityInInheritance.errors.txt new file mode 100644 index 00000000000..0b93ab491ad --- /dev/null +++ b/tests/baselines/reference/anyAssignabilityInInheritance.errors.txt @@ -0,0 +1,97 @@ +anyAssignabilityInInheritance.ts(67,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +anyAssignabilityInInheritance.ts(75,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== anyAssignabilityInInheritance.ts (2 errors) ==== + // any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted + + interface I { + [x: string]: any; + foo: any; // ok, any identical to itself + } + + var a: any; + + declare function foo2(x: number): number; + declare function foo2(x: any): any; + var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload) + + declare function foo3(x: string): string; + declare function foo3(x: any): any; + var r3 = foo3(a); // any + + declare function foo4(x: boolean): boolean; + declare function foo4(x: any): any; + var r3 = foo3(a); // any + + declare function foo5(x: Date): Date; + declare function foo5(x: any): any; + var r3 = foo3(a); // any + + declare function foo6(x: RegExp): RegExp; + declare function foo6(x: any): any; + var r3 = foo3(a); // any + + declare function foo7(x: { bar: number }): { bar: number }; + declare function foo7(x: any): any; + var r3 = foo3(a); // any + + declare function foo8(x: number[]): number[]; + declare function foo8(x: any): any; + var r3 = foo3(a); // any + + interface I8 { foo: string } + declare function foo9(x: I8): I8; + declare function foo9(x: any): any; + var r3 = foo3(a); // any + + class A { foo: number; } + declare function foo10(x: A): A; + declare function foo10(x: any): any; + var r3 = foo3(a); // any + + class A2 { foo: T; } + declare function foo11(x: A2): A2; + declare function foo11(x: any): any; + var r3 = foo3(a); // any + + declare function foo12(x: (x) => number): (x) => number; + declare function foo12(x: any): any; + var r3 = foo3(a); // any + + declare function foo13(x: (x: T) => T): (x: T) => T; + declare function foo13(x: any): any; + var r3 = foo3(a); // any + + enum E { A } + declare function foo14(x: E): E; + declare function foo14(x: any): any; + var r3 = foo3(a); // any + + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + declare function foo15(x: typeof f): typeof f; + declare function foo15(x: any): any; + var r3 = foo3(a); // any + + class CC { baz: string } + module CC { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + declare function foo16(x: CC): CC; + declare function foo16(x: any): any; + var r3 = foo3(a); // any + + declare function foo17(x: Object): Object; + declare function foo17(x: any): any; + var r3 = foo3(a); // any + + declare function foo18(x: {}): {}; + declare function foo18(x: any): any; + var r3 = foo3(a); // any \ No newline at end of file diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.types b/tests/baselines/reference/anyAssignabilityInInheritance.types index 9d3dfd80917..3ef4dc934f2 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.types +++ b/tests/baselines/reference/anyAssignabilityInInheritance.types @@ -10,10 +10,12 @@ interface I { foo: any; // ok, any identical to itself >foo : any +> : ^^^ } var a: any; >a : any +> : ^^^ declare function foo2(x: number): number; >foo2 : { (x: number): number; (x: any): any; } @@ -25,13 +27,17 @@ declare function foo2(x: any): any; >foo2 : { (x: number): number; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload) >r3 : any +> : ^^^ >foo2(a) : any +> : ^^^ >foo2 : { (x: number): number; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo3(x: string): string; >foo3 : { (x: string): string; (x: any): any; } @@ -43,13 +49,17 @@ declare function foo3(x: any): any; >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo4(x: boolean): boolean; >foo4 : { (x: boolean): boolean; (x: any): any; } @@ -61,13 +71,17 @@ declare function foo4(x: any): any; >foo4 : { (x: boolean): boolean; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo5(x: Date): Date; >foo5 : { (x: Date): Date; (x: any): any; } @@ -79,13 +93,17 @@ declare function foo5(x: any): any; >foo5 : { (x: Date): Date; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo6(x: RegExp): RegExp; >foo6 : { (x: RegExp): RegExp; (x: any): any; } @@ -97,13 +115,17 @@ declare function foo6(x: any): any; >foo6 : { (x: RegExp): RegExp; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo7(x: { bar: number }): { bar: number }; >foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; } @@ -119,13 +141,17 @@ declare function foo7(x: any): any; >foo7 : { (x: { bar: number; }): { bar: number; }; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo8(x: number[]): number[]; >foo8 : { (x: number[]): number[]; (x: any): any; } @@ -137,13 +163,17 @@ declare function foo8(x: any): any; >foo8 : { (x: number[]): number[]; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ interface I8 { foo: string } >foo : string @@ -159,13 +189,17 @@ declare function foo9(x: any): any; >foo9 : { (x: I8): I8; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ class A { foo: number; } >A : A @@ -183,13 +217,17 @@ declare function foo10(x: any): any; >foo10 : { (x: A): A; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ class A2 { foo: T; } >A2 : A2 @@ -207,13 +245,17 @@ declare function foo11(x: any): any; >foo11 : { (x: A2): A2; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo12(x: (x) => number): (x) => number; >foo12 : { (x: (x: any) => number): (x: any) => number; (x: any): any; } @@ -221,19 +263,25 @@ declare function foo12(x: (x) => number): (x) => number; >x : (x: any) => number > : ^ ^^^^^^^^^^ >x : any +> : ^^^ >x : any +> : ^^^ declare function foo12(x: any): any; >foo12 : { (x: (x: any) => number): (x: any) => number; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo13(x: (x: T) => T): (x: T) => T; >foo13 : { (x: (x: T) => T): (x: T) => T; (x: any): any; } @@ -249,13 +297,17 @@ declare function foo13(x: any): any; >foo13 : { (x: (x: T) => T): (x: T) => T; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ enum E { A } >E : E @@ -273,13 +325,17 @@ declare function foo14(x: any): any; >foo14 : { (x: E): E; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ function f() { } >f : typeof f @@ -309,13 +365,17 @@ declare function foo15(x: any): any; >foo15 : { (x: typeof f): typeof f; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ class CC { baz: string } >CC : CC @@ -343,13 +403,17 @@ declare function foo16(x: any): any; >foo16 : { (x: CC): CC; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo17(x: Object): Object; >foo17 : { (x: Object): Object; (x: any): any; } @@ -361,13 +425,17 @@ declare function foo17(x: any): any; >foo17 : { (x: Object): Object; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ declare function foo18(x: {}): {}; >foo18 : { (x: {}): {}; (x: any): any; } @@ -379,11 +447,15 @@ declare function foo18(x: any): any; >foo18 : { (x: {}): {}; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >x : any +> : ^^^ var r3 = foo3(a); // any >r3 : any +> : ^^^ >foo3(a) : any +> : ^^^ >foo3 : { (x: string): string; (x: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a : any +> : ^^^ diff --git a/tests/baselines/reference/anyAssignableToEveryType2.errors.txt b/tests/baselines/reference/anyAssignableToEveryType2.errors.txt new file mode 100644 index 00000000000..d266c5c5ee6 --- /dev/null +++ b/tests/baselines/reference/anyAssignableToEveryType2.errors.txt @@ -0,0 +1,139 @@ +anyAssignableToEveryType2.ts(89,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +anyAssignableToEveryType2.ts(99,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== anyAssignableToEveryType2.ts (2 errors) ==== + // any is not a subtype of any other types, but is assignable, all the below should work + + interface I { + [x: string]: any; + foo: any; // ok, any identical to itself + } + + + interface I2 { + [x: string]: number; + foo: any; + } + + + interface I3 { + [x: string]: string; + foo: any; + } + + + interface I4 { + [x: string]: boolean; + foo: any; + } + + + interface I5 { + [x: string]: Date; + foo: any; + } + + + interface I6 { + [x: string]: RegExp; + foo: any; + } + + + interface I7 { + [x: string]: { bar: number }; + foo: any; + } + + + interface I8 { + [x: string]: number[]; + foo: any; + } + + + interface I9 { + [x: string]: I8; + foo: any; + } + + class A { foo: number; } + interface I10 { + [x: string]: A; + foo: any; + } + + class A2 { foo: T; } + interface I11 { + [x: string]: A2; + foo: any; + } + + + interface I12 { + [x: string]: (x) => number; + foo: any; + } + + + interface I13 { + [x: string]: (x: T) => T; + foo: any; + } + + + enum E { A } + interface I14 { + [x: string]: E; + foo: any; + } + + + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + interface I15 { + [x: string]: typeof f; + foo: any; + } + + + class c { baz: string } + module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + interface I16 { + [x: string]: typeof c; + foo: any; + } + + + interface I17 { + [x: string]: T; + foo: any; + } + + + interface I18 { + [x: string]: U; + foo: any; + } + + + interface I19 { + [x: string]: Object; + foo: any; + } + + + interface I20 { + [x: string]: {}; + foo: any; + } + \ No newline at end of file diff --git a/tests/baselines/reference/anyAssignableToEveryType2.types b/tests/baselines/reference/anyAssignableToEveryType2.types index 00d846e3451..b38a8522e0b 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.types +++ b/tests/baselines/reference/anyAssignableToEveryType2.types @@ -10,6 +10,7 @@ interface I { foo: any; // ok, any identical to itself >foo : any +> : ^^^ } @@ -20,6 +21,7 @@ interface I2 { foo: any; >foo : any +> : ^^^ } @@ -30,6 +32,7 @@ interface I3 { foo: any; >foo : any +> : ^^^ } @@ -40,6 +43,7 @@ interface I4 { foo: any; >foo : any +> : ^^^ } @@ -50,6 +54,7 @@ interface I5 { foo: any; >foo : any +> : ^^^ } @@ -60,6 +65,7 @@ interface I6 { foo: any; >foo : any +> : ^^^ } @@ -72,6 +78,7 @@ interface I7 { foo: any; >foo : any +> : ^^^ } @@ -82,6 +89,7 @@ interface I8 { foo: any; >foo : any +> : ^^^ } @@ -92,6 +100,7 @@ interface I9 { foo: any; >foo : any +> : ^^^ } class A { foo: number; } @@ -107,6 +116,7 @@ interface I10 { foo: any; >foo : any +> : ^^^ } class A2 { foo: T; } @@ -122,6 +132,7 @@ interface I11 { foo: any; >foo : any +> : ^^^ } @@ -130,9 +141,11 @@ interface I12 { >x : string > : ^^^^^^ >x : any +> : ^^^ foo: any; >foo : any +> : ^^^ } @@ -145,6 +158,7 @@ interface I13 { foo: any; >foo : any +> : ^^^ } @@ -161,6 +175,7 @@ interface I14 { foo: any; >foo : any +> : ^^^ } @@ -187,6 +202,7 @@ interface I15 { foo: any; >foo : any +> : ^^^ } @@ -215,6 +231,7 @@ interface I16 { foo: any; >foo : any +> : ^^^ } @@ -225,6 +242,7 @@ interface I17 { foo: any; >foo : any +> : ^^^ } @@ -235,6 +253,7 @@ interface I18 { foo: any; >foo : any +> : ^^^ } @@ -245,6 +264,7 @@ interface I19 { foo: any; >foo : any +> : ^^^ } @@ -255,5 +275,6 @@ interface I20 { foo: any; >foo : any +> : ^^^ } diff --git a/tests/baselines/reference/arrayAssignmentTest5.errors.txt b/tests/baselines/reference/arrayAssignmentTest5.errors.txt index a8263630dea..f1784b5ea31 100644 --- a/tests/baselines/reference/arrayAssignmentTest5.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest5.errors.txt @@ -1,9 +1,12 @@ +arrayAssignmentTest5.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrayAssignmentTest5.ts(23,17): error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]'. Property 'state' is missing in type 'IToken' but required in type 'IStateToken'. -==== arrayAssignmentTest5.ts (1 errors) ==== +==== arrayAssignmentTest5.ts (2 errors) ==== module Test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface IState { } interface IToken { diff --git a/tests/baselines/reference/arrayBestCommonTypes.errors.txt b/tests/baselines/reference/arrayBestCommonTypes.errors.txt new file mode 100644 index 00000000000..16ce6d27d49 --- /dev/null +++ b/tests/baselines/reference/arrayBestCommonTypes.errors.txt @@ -0,0 +1,116 @@ +arrayBestCommonTypes.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +arrayBestCommonTypes.ts(54,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== arrayBestCommonTypes.ts (2 errors) ==== + module EmptyTypes { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface iface { } + class base implements iface { } + class base2 implements iface { } + class derived extends base { } + + + class f { + public voidIfAny(x: boolean, y?: boolean): number; + public voidIfAny(x: string, y?: boolean): number; + public voidIfAny(x: number, y?: boolean): number; + public voidIfAny(x: any, y = false): any { return null; } + + public x() { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); + + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); + + (this.voidIfAny([[3, 4], [null]][0][0])); + + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + + var anyObj: any = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + + var ifaceObj: iface = null; + var baseObj = new base(); + var base2Obj = new base2(); + + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + } + } + } + + module NonEmptyTypes { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface iface { x: string; } + class base implements iface { x: string; y: string; } + class base2 implements iface { x: string; z: string; } + class derived extends base { a: string; } + + + class f { + public voidIfAny(x: boolean, y?: boolean): number; + public voidIfAny(x: string, y?: boolean): number; + public voidIfAny(x: number, y?: boolean): number; + public voidIfAny(x: any, y = false): any { return null; } + + public x() { + (this.voidIfAny([4, 2][0])); + (this.voidIfAny([4, 2, undefined][0])); + (this.voidIfAny([undefined, 2, 4][0])); + (this.voidIfAny([null, 2, 4][0])); + (this.voidIfAny([2, 4, null][0])); + (this.voidIfAny([undefined, 4, null][0])); + + (this.voidIfAny(['', "q"][0])); + (this.voidIfAny(['', "q", undefined][0])); + (this.voidIfAny([undefined, "q", ''][0])); + (this.voidIfAny([null, "q", ''][0])); + (this.voidIfAny(["q", '', null][0])); + (this.voidIfAny([undefined, '', null][0])); + + (this.voidIfAny([[3, 4], [null]][0][0])); + + + var t1: { x: number; y: base; }[] = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; + var t2: { x: boolean; y: base; }[] = [{ x: true, y: new derived() }, { x: false, y: new base() }]; + var t3: { x: string; y: base; }[] = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + + var anyObj: any = null; + // Order matters here so test all the variants + var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; + var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; + var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + + var ifaceObj: iface = null; + var baseObj = new base(); + var base2Obj = new base2(); + + var b1 = [baseObj, base2Obj, ifaceObj]; + var b2 = [base2Obj, baseObj, ifaceObj]; + var b3 = [baseObj, ifaceObj, base2Obj]; + var b4 = [ifaceObj, baseObj, base2Obj]; + } + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 2ed7f2c9d8f..2355370b311 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -53,6 +53,7 @@ module EmptyTypes { >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } > : ^^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ >x : any +> : ^^^ >y : boolean > : ^^^^^^^ >false : false @@ -495,6 +496,7 @@ module EmptyTypes { var anyObj: any = null; >anyObj : any +> : ^^^ // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -525,7 +527,9 @@ module EmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" @@ -539,7 +543,9 @@ module EmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" @@ -583,7 +589,9 @@ module EmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" @@ -735,6 +743,7 @@ module NonEmptyTypes { >voidIfAny : { (x: boolean, y?: boolean): number; (x: string, y?: boolean): number; (x: number, y?: boolean): number; } > : ^^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ >x : any +> : ^^^ >y : boolean > : ^^^^^^^ >false : false @@ -1177,6 +1186,7 @@ module NonEmptyTypes { var anyObj: any = null; >anyObj : any +> : ^^^ // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -1207,7 +1217,9 @@ module NonEmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" @@ -1221,7 +1233,9 @@ module NonEmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" @@ -1265,7 +1279,9 @@ module NonEmptyTypes { >{ x: anyObj, y: 'a' } : { x: any; y: string; } > : ^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >anyObj : any +> : ^^^ >y : string > : ^^^^^^ >'a' : "a" diff --git a/tests/baselines/reference/arrowFunctionContexts.errors.txt b/tests/baselines/reference/arrowFunctionContexts.errors.txt index 1e27fe36348..6dfffc9d65b 100644 --- a/tests/baselines/reference/arrowFunctionContexts.errors.txt +++ b/tests/baselines/reference/arrowFunctionContexts.errors.txt @@ -1,12 +1,15 @@ arrowFunctionContexts.ts(2,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. arrowFunctionContexts.ts(30,9): error TS18033: Type '() => number' is not assignable to type 'number' as required for computed enum member values. arrowFunctionContexts.ts(31,16): error TS2332: 'this' cannot be referenced in current location. +arrowFunctionContexts.ts(35,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +arrowFunctionContexts.ts(41,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrowFunctionContexts.ts(43,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. arrowFunctionContexts.ts(71,13): error TS18033: Type '() => number' is not assignable to type 'number' as required for computed enum member values. arrowFunctionContexts.ts(72,20): error TS2332: 'this' cannot be referenced in current location. +arrowFunctionContexts.ts(76,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== arrowFunctionContexts.ts (6 errors) ==== +==== arrowFunctionContexts.ts (9 errors) ==== // Arrow function used in with statement with (window) { ~~~~~~~~~~~~~ @@ -48,12 +51,16 @@ arrowFunctionContexts.ts(72,20): error TS2332: 'this' cannot be referenced in cu // Arrow function as module variable initializer module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a = (s) => ''; var b = (s) => s; } // Repeat above for module members that are functions? (necessary to redo all of them?) module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // Arrow function used in with statement with (window) { ~~~~~~~~~~~~~ @@ -95,6 +102,8 @@ arrowFunctionContexts.ts(72,20): error TS2332: 'this' cannot be referenced in cu // Arrow function as module variable initializer module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a = (s) => ''; var b = (s) => s; } diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt index 925b762414f..b5211462da3 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt @@ -1,14 +1,18 @@ +arrowFunctionsMissingTokens.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrowFunctionsMissingTokens.ts(2,16): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(4,22): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(6,17): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(8,36): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(10,42): error TS1005: '=>' expected. +arrowFunctionsMissingTokens.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +arrowFunctionsMissingTokens.ts(14,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrowFunctionsMissingTokens.ts(15,23): error TS1005: '{' expected. arrowFunctionsMissingTokens.ts(17,29): error TS1005: '{' expected. arrowFunctionsMissingTokens.ts(19,24): error TS1005: '{' expected. arrowFunctionsMissingTokens.ts(21,43): error TS1005: '{' expected. arrowFunctionsMissingTokens.ts(23,49): error TS1005: '{' expected. arrowFunctionsMissingTokens.ts(25,23): error TS1005: '{' expected. +arrowFunctionsMissingTokens.ts(28,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrowFunctionsMissingTokens.ts(29,23): error TS1109: Expression expected. arrowFunctionsMissingTokens.ts(31,29): error TS1109: Expression expected. arrowFunctionsMissingTokens.ts(33,24): error TS1109: Expression expected. @@ -17,15 +21,19 @@ arrowFunctionsMissingTokens.ts(37,49): error TS1109: Expression expected. arrowFunctionsMissingTokens.ts(39,23): error TS1109: Expression expected. arrowFunctionsMissingTokens.ts(40,5): error TS1128: Declaration or statement expected. arrowFunctionsMissingTokens.ts(41,1): error TS1128: Declaration or statement expected. +arrowFunctionsMissingTokens.ts(43,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. arrowFunctionsMissingTokens.ts(44,14): error TS1109: Expression expected. arrowFunctionsMissingTokens.ts(46,21): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(48,14): error TS2304: Cannot find name 'x'. arrowFunctionsMissingTokens.ts(50,35): error TS1005: '=>' expected. arrowFunctionsMissingTokens.ts(52,41): error TS1005: '=>' expected. +arrowFunctionsMissingTokens.ts(55,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== arrowFunctionsMissingTokens.ts (24 errors) ==== +==== arrowFunctionsMissingTokens.ts (30 errors) ==== module missingArrowsWithCurly { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = () { }; ~ !!! error TS1005: '=>' expected. @@ -48,7 +56,11 @@ arrowFunctionsMissingTokens.ts(52,41): error TS1005: '=>' expected. } module missingCurliesWithArrow { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module withStatement { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = () => var k = 10;}; ~~~ !!! error TS1005: '{' expected. @@ -75,6 +87,8 @@ arrowFunctionsMissingTokens.ts(52,41): error TS1005: '=>' expected. } module withoutStatement { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = () => }; ~ !!! error TS1109: Expression expected. @@ -106,6 +120,8 @@ arrowFunctionsMissingTokens.ts(52,41): error TS1005: '=>' expected. !!! error TS1128: Declaration or statement expected. module ce_nEst_pas_une_arrow_function { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = (); ~ !!! error TS1109: Expression expected. @@ -128,6 +144,8 @@ arrowFunctionsMissingTokens.ts(52,41): error TS1005: '=>' expected. } module okay { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = () => { }; var b = (): void => { } diff --git a/tests/baselines/reference/asiPreventsParsingAsAmbientExternalModule02.errors.txt b/tests/baselines/reference/asiPreventsParsingAsAmbientExternalModule02.errors.txt new file mode 100644 index 00000000000..a8ef0e30c40 --- /dev/null +++ b/tests/baselines/reference/asiPreventsParsingAsAmbientExternalModule02.errors.txt @@ -0,0 +1,15 @@ +asiPreventsParsingAsAmbientExternalModule02.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== asiPreventsParsingAsAmbientExternalModule02.ts (1 errors) ==== + var declare: number; + var module: string; + + module container { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + declare // this is the identifier 'declare' + module // this is the identifier 'module' + "my external module" // this is just a string + { } // this is a block body + } \ No newline at end of file diff --git a/tests/baselines/reference/assignToExistingClass.errors.txt b/tests/baselines/reference/assignToExistingClass.errors.txt index aa2cfd5c1e9..68d6dba6e37 100644 --- a/tests/baselines/reference/assignToExistingClass.errors.txt +++ b/tests/baselines/reference/assignToExistingClass.errors.txt @@ -1,8 +1,11 @@ +assignToExistingClass.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignToExistingClass.ts(8,13): error TS2629: Cannot assign to 'Mocked' because it is a class. -==== assignToExistingClass.ts (1 errors) ==== +==== assignToExistingClass.ts (2 errors) ==== module Test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Mocked { myProp: string; } diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index c91ddb00897..8a7ae753e96 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -1,3 +1,5 @@ +assignmentCompatWithCallSignatures4.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatWithCallSignatures4.ts(9,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithCallSignatures4.ts(45,9): error TS2322: Type '(x: number) => string[]' is not assignable to type '(x: T) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'number'. @@ -47,6 +49,7 @@ assignmentCompatWithCallSignatures4.ts(74,9): error TS2322: Type '(x: { a: strin Types of property 'a' are incompatible. Type 'T' is not assignable to type 'string'. Type 'Base' is not assignable to type 'string'. +assignmentCompatWithCallSignatures4.ts(85,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithCallSignatures4.ts(89,9): error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. @@ -63,16 +66,20 @@ assignmentCompatWithCallSignatures4.ts(96,9): error TS2322: Type '(x: T) => s 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== assignmentCompatWithCallSignatures4.ts (15 errors) ==== +==== assignmentCompatWithCallSignatures4.ts (18 errors) ==== // These are mostly permitted with the current loose rules. All ok unless otherwise noted. module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } module WithNonGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // target type with non-generic call signatures var a2: (x: number) => string[]; var a7: (x: (arg: Base) => Derived) => (r: Base) => Derived2; @@ -211,6 +218,8 @@ assignmentCompatWithCallSignatures4.ts(96,9): error TS2322: Type '(x: T) => s } module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // target type has generic call signature var a2: (x: T) => T[]; var b2: (x: T) => string[]; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index 9c654f2e09c..fa621d063db 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -1,3 +1,5 @@ +assignmentCompatWithConstructSignatures4.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatWithConstructSignatures4.ts(9,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithConstructSignatures4.ts(45,9): error TS2322: Type 'new (x: number) => string[]' is not assignable to type 'new (x: T) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'number'. @@ -63,6 +65,7 @@ assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. Type '(a: any) => any' provides no match for the signature 'new (a: T): T'. +assignmentCompatWithConstructSignatures4.ts(85,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithConstructSignatures4.ts(89,9): error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. @@ -79,16 +82,20 @@ assignmentCompatWithConstructSignatures4.ts(96,9): error TS2322: Type 'new (x 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== assignmentCompatWithConstructSignatures4.ts (19 errors) ==== +==== assignmentCompatWithConstructSignatures4.ts (22 errors) ==== // checking assignment compatibility relations for function types. module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } module WithNonGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // target type with non-generic call signatures var a2: new (x: number) => string[]; var a7: new (x: (arg: Base) => Derived) => (r: Base) => Derived2; @@ -247,6 +254,8 @@ assignmentCompatWithConstructSignatures4.ts(96,9): error TS2322: Type 'new (x } module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // target type has generic call signature var a2: new (x: T) => T[]; var b2: new (x: T) => string[]; diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index d92429833fb..59108f3d0e4 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,7 +1,9 @@ +assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(14,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. Target signature provides too few arguments. Expected 1 or more, but got 0. assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. Target signature provides too few arguments. Expected 2 or more, but got 1. +assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(39,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(63,9): error TS2322: Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -91,16 +93,19 @@ assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(91,9): error Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. +assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(95,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. Target signature provides too few arguments. Expected 1 or more, but got 0. assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. Target signature provides too few arguments. Expected 2 or more, but got 1. -==== assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts (29 errors) ==== +==== assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts (32 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the target for assignment module ClassTypeParam { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { a: () => T; a2: (x?: T) => T; @@ -143,6 +148,8 @@ assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): erro } module GenericSignaturesInvalid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base2 { a: () => T; @@ -336,6 +343,8 @@ assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): erro } module GenericSignaturesValid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base2 { a: () => T; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index f990fc308dc..3459fb10be4 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -4,6 +4,7 @@ assignmentCompatWithNumericIndexer.ts(14,1): error TS2322: Type 'A' is not assig assignmentCompatWithNumericIndexer.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. Type 'Base' is missing the following properties from type 'Derived2': baz, bar +assignmentCompatWithNumericIndexer.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. 'number' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -22,7 +23,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as Type 'Base' is missing the following properties from type 'Derived2': baz, bar -==== assignmentCompatWithNumericIndexer.ts (6 errors) ==== +==== assignmentCompatWithNumericIndexer.ts (7 errors) ==== // Derived type indexer must be subtype of base type indexer interface Base { foo: string; } @@ -52,6 +53,8 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { [x: number]: T; } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers.errors.txt new file mode 100644 index 00000000000..78826b6dd81 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.errors.txt @@ -0,0 +1,94 @@ +assignmentCompatWithObjectMembers.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatWithObjectMembers.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatWithObjectMembers.ts (2 errors) ==== + // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M + // no errors expected + + module SimpleTypes { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class S { foo: string; } + class T { foo: string; } + var s: S; + var t: T; + + interface S2 { foo: string; } + interface T2 { foo: string; } + var s2: S2; + var t2: T2; + + var a: { foo: string; } + var b: { foo: string; } + + var a2 = { foo: '' }; + var b2 = { foo: '' }; + + s = t; + t = s; + s = s2; + s = a2; + + s2 = t2; + t2 = s2; + s2 = t; + s2 = b; + s2 = a2; + + a = b; + b = a; + a = s; + a = s2; + a = a2; + + a2 = b2; + b2 = a2; + a2 = b; + a2 = t2; + a2 = t; + } + + module ObjectTypes { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class S { foo: S; } + class T { foo: T; } + var s: S; + var t: T; + + interface S2 { foo: S2; } + interface T2 { foo: T2; } + var s2: S2; + var t2: T2; + + var a: { foo: typeof a; } + var b: { foo: typeof b; } + + var a2 = { foo: a2 }; + var b2 = { foo: b2 }; + + s = t; + t = s; + s = s2; + s = a2; + + s2 = t2; + t2 = s2; + s2 = t; + s2 = b; + s2 = a2; + + a = b; + b = a; + a = s; + a = s2; + a = a2; + + a2 = b2; + b2 = a2; + a2 = b; + a2 = t2; + a2 = t; + + } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.types b/tests/baselines/reference/assignmentCompatWithObjectMembers.types index 415c4c29ef9..606738c4504 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers.types +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.types @@ -287,17 +287,23 @@ module ObjectTypes { var a2 = { foo: a2 }; >a2 : any +> : ^^^ >{ foo: a2 } : { foo: any; } > : ^^^^^^^^^^^^^ >foo : any +> : ^^^ >a2 : any +> : ^^^ var b2 = { foo: b2 }; >b2 : any +> : ^^^ >{ foo: b2 } : { foo: any; } > : ^^^^^^^^^^^^^ >foo : any +> : ^^^ >b2 : any +> : ^^^ s = t; >s = t : T @@ -325,9 +331,11 @@ module ObjectTypes { s = a2; >s = a2 : any +> : ^^^ >s : S > : ^ >a2 : any +> : ^^^ s2 = t2; >s2 = t2 : T2 @@ -363,9 +371,11 @@ module ObjectTypes { s2 = a2; >s2 = a2 : any +> : ^^^ >s2 : S2 > : ^^ >a2 : any +> : ^^^ a = b; >a = b : { foo: typeof b; } @@ -401,24 +411,33 @@ module ObjectTypes { a = a2; >a = a2 : any +> : ^^^ >a : { foo: typeof a; } > : ^^^^^^^ ^^^ >a2 : any +> : ^^^ a2 = b2; >a2 = b2 : any +> : ^^^ >a2 : any +> : ^^^ >b2 : any +> : ^^^ b2 = a2; >b2 = a2 : any +> : ^^^ >b2 : any +> : ^^^ >a2 : any +> : ^^^ a2 = b; >a2 = b : { foo: typeof b; } > : ^^^^^^^ ^^^ >a2 : any +> : ^^^ >b : { foo: typeof b; } > : ^^^^^^^ ^^^ @@ -426,6 +445,7 @@ module ObjectTypes { >a2 = t2 : T2 > : ^^ >a2 : any +> : ^^^ >t2 : T2 > : ^^ @@ -433,6 +453,7 @@ module ObjectTypes { >a2 = t : T > : ^ >a2 : any +> : ^^^ >t : T > : ^ diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt index 72885e82376..5b967ab8958 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt @@ -1,3 +1,4 @@ +assignmentCompatWithObjectMembers4.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembers4.ts(24,5): error TS2322: Type 'T' is not assignable to type 'S'. Types of property 'foo' are incompatible. Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. @@ -37,6 +38,7 @@ assignmentCompatWithObjectMembers4.ts(44,5): error TS2322: Type 'T2' is not assi assignmentCompatWithObjectMembers4.ts(45,5): error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +assignmentCompatWithObjectMembers4.ts(48,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembers4.ts(70,5): error TS2322: Type 'S' is not assignable to type 'T'. Types of property 'foo' are incompatible. Property 'baz' is missing in type 'Base' but required in type 'Derived2'. @@ -51,10 +53,12 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' Property 'baz' is missing in type 'Base' but required in type 'Derived2'. -==== assignmentCompatWithObjectMembers4.ts (17 errors) ==== +==== assignmentCompatWithObjectMembers4.ts (19 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M module OnlyDerived { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Base { baz: string; } @@ -165,6 +169,8 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' } module WithBase { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Base { baz: string; } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt index 1a1a1012004..3936f36cee6 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt @@ -1,3 +1,4 @@ +assignmentCompatWithObjectMembersAccessibility.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersAccessibility.ts(31,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'. Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(36,5): error TS2322: Type 'E' is not assignable to type 'Base'. @@ -14,6 +15,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(50,5): error TS2322: Type 'I' Property 'foo' is private in type 'E' but not in type 'I'. assignmentCompatWithObjectMembersAccessibility.ts(51,5): error TS2322: Type 'D' is not assignable to type 'E'. Property 'foo' is private in type 'E' but not in type 'D'. +assignmentCompatWithObjectMembersAccessibility.ts(56,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersAccessibility.ts(81,5): error TS2322: Type 'Base' is not assignable to type '{ foo: string; }'. Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(82,5): error TS2322: Type 'I' is not assignable to type '{ foo: string; }'. @@ -48,10 +50,12 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' Property 'foo' is private in type 'E' but not in type 'D'. -==== assignmentCompatWithObjectMembersAccessibility.ts (24 errors) ==== +==== assignmentCompatWithObjectMembersAccessibility.ts (26 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M module TargetIsPublic { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets class Base { public foo: string; @@ -129,6 +133,8 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' } module TargetIsPublic { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets class Base { private foo: string; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt index 61823707205..d0b5ee6f8cf 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt @@ -1,3 +1,5 @@ +assignmentCompatWithObjectMembersOptionality.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatWithObjectMembersOptionality.ts(49,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersOptionality.ts(73,5): error TS2322: Type 'D' is not assignable to type 'C'. Property 'opt' is optional in type 'D' but required in type 'C'. assignmentCompatWithObjectMembersOptionality.ts(74,5): error TS2322: Type 'E' is not assignable to type 'C'. @@ -12,7 +14,7 @@ assignmentCompatWithObjectMembersOptionality.ts(84,5): error TS2322: Type 'E' is Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. -==== assignmentCompatWithObjectMembersOptionality.ts (6 errors) ==== +==== assignmentCompatWithObjectMembersOptionality.ts (8 errors) ==== // Derived member is not optional but base member is, should be ok class Base { foo: string; } @@ -20,6 +22,8 @@ assignmentCompatWithObjectMembersOptionality.ts(84,5): error TS2322: Type 'E' is class Derived2 extends Derived { baz: string; } module TargetHasOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets interface C { opt?: Base @@ -62,6 +66,8 @@ assignmentCompatWithObjectMembersOptionality.ts(84,5): error TS2322: Type 'E' is } module SourceHasOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets interface C { opt: Base diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt index f1ba1224c45..447a01a4dae 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt @@ -1,3 +1,4 @@ +assignmentCompatWithObjectMembersOptionality2.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersOptionality2.ts(33,5): error TS2559: Type 'D' has no properties in common with type 'C'. assignmentCompatWithObjectMembersOptionality2.ts(34,5): error TS2559: Type 'E' has no properties in common with type 'C'. assignmentCompatWithObjectMembersOptionality2.ts(35,5): error TS2559: Type 'F' has no properties in common with type 'C'. @@ -7,6 +8,7 @@ assignmentCompatWithObjectMembersOptionality2.ts(38,5): error TS2559: Type 'F' h assignmentCompatWithObjectMembersOptionality2.ts(39,5): error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'. assignmentCompatWithObjectMembersOptionality2.ts(40,5): error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'. assignmentCompatWithObjectMembersOptionality2.ts(41,5): error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'. +assignmentCompatWithObjectMembersOptionality2.ts(50,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersOptionality2.ts(74,5): error TS2741: Property 'opt' is missing in type 'D' but required in type 'C'. assignmentCompatWithObjectMembersOptionality2.ts(75,5): error TS2741: Property 'opt' is missing in type 'E' but required in type 'C'. assignmentCompatWithObjectMembersOptionality2.ts(76,5): error TS2741: Property 'opt' is missing in type 'F' but required in type 'C'. @@ -18,7 +20,7 @@ assignmentCompatWithObjectMembersOptionality2.ts(85,5): error TS2741: Property ' assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2741: Property 'opt' is missing in type 'F' but required in type '{ opt: Base; }'. -==== assignmentCompatWithObjectMembersOptionality2.ts (18 errors) ==== +==== assignmentCompatWithObjectMembersOptionality2.ts (20 errors) ==== // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N @@ -27,6 +29,8 @@ assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2741: Property ' class Derived2 extends Derived { baz: string; } module TargetHasOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets interface C { opt?: Base @@ -87,6 +91,8 @@ assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2741: Property ' } module SourceHasOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // targets interface C { opt: Base diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt index 6c85c052e03..6e552101a10 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt @@ -1,3 +1,4 @@ +assignmentCompatWithObjectMembersStringNumericNames.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersStringNumericNames.ts(21,5): error TS2741: Property ''1'' is missing in type 'T' but required in type 'S'. assignmentCompatWithObjectMembersStringNumericNames.ts(22,5): error TS2741: Property ''1.'' is missing in type 'S' but required in type 'T'. assignmentCompatWithObjectMembersStringNumericNames.ts(24,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. @@ -14,6 +15,7 @@ assignmentCompatWithObjectMembersStringNumericNames.ts(36,5): error TS2741: Prop assignmentCompatWithObjectMembersStringNumericNames.ts(38,5): error TS2741: Property ''1.0'' is missing in type '{ '1': string; }' but required in type '{ '1.0': string; }'. assignmentCompatWithObjectMembersStringNumericNames.ts(39,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type '{ '1': string; }'. assignmentCompatWithObjectMembersStringNumericNames.ts(42,5): error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. +assignmentCompatWithObjectMembersStringNumericNames.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithObjectMembersStringNumericNames.ts(65,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. assignmentCompatWithObjectMembersStringNumericNames.ts(71,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S2'. assignmentCompatWithObjectMembersStringNumericNames.ts(73,5): error TS2741: Property ''1.'' is missing in type '{ 1: string; baz?: string; }' but required in type '{ '1.': string; bar?: string; }'. @@ -29,11 +31,13 @@ assignmentCompatWithObjectMembersStringNumericNames.ts(83,5): error TS2741: Prop assignmentCompatWithObjectMembersStringNumericNames.ts(84,5): error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. -==== assignmentCompatWithObjectMembersStringNumericNames.ts (29 errors) ==== +==== assignmentCompatWithObjectMembersStringNumericNames.ts (31 errors) ==== // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // string named numeric properties work correctly, errors below unless otherwise noted module JustStrings { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class S { '1': string; } class T { '1.': string; } var s: S; @@ -123,6 +127,8 @@ assignmentCompatWithObjectMembersStringNumericNames.ts(84,5): error TS2741: Prop } module NumbersAndStrings { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class S { '1': string; } class T { 1: string; } var s: S; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index ea6734d5a86..44ce794ef75 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -4,6 +4,7 @@ assignmentCompatWithStringIndexer.ts(15,1): error TS2322: Type 'A' is not assign assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'Base' is missing the following properties from type 'Derived2': baz, bar +assignmentCompatWithStringIndexer.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. @@ -28,7 +29,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass Type 'Base' is missing the following properties from type 'Derived2': baz, bar -==== assignmentCompatWithStringIndexer.ts (8 errors) ==== +==== assignmentCompatWithStringIndexer.ts (9 errors) ==== // index signatures must be compatible in assignments interface Base { foo: string; } @@ -59,6 +60,8 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass !!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { [x: string]: T; } diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index c330a9fa38b..d7a62851141 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -4,6 +4,7 @@ assignmentCompatWithStringIndexer2.ts(15,1): error TS2322: Type 'A' is not assig assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'Base' is missing the following properties from type 'Derived2': baz, bar +assignmentCompatWithStringIndexer2.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. @@ -28,7 +29,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as Type 'Base' is missing the following properties from type 'Derived2': baz, bar -==== assignmentCompatWithStringIndexer2.ts (8 errors) ==== +==== assignmentCompatWithStringIndexer2.ts (9 errors) ==== // index signatures must be compatible in assignments interface Base { foo: string; } @@ -59,6 +60,8 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { [x: string]: T; } diff --git a/tests/baselines/reference/assignmentCompatability1.errors.txt b/tests/baselines/reference/assignmentCompatability1.errors.txt new file mode 100644 index 00000000000..b9a357e7471 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability1.errors.txt @@ -0,0 +1,18 @@ +assignmentCompatability1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability1.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatability1.ts (2 errors) ==== + module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; + export var __val__obj4 = obj4; + } + module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var aa = {};; + export var __val__aa = aa; + } + __test2__.__val__aa = __test1__.__val__obj4 \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability11.errors.txt b/tests/baselines/reference/assignmentCompatability11.errors.txt index 73418f7911f..a1cc9070a56 100644 --- a/tests/baselines/reference/assignmentCompatability11.errors.txt +++ b/tests/baselines/reference/assignmentCompatability11.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability11.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability11.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability11.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'number'. -==== assignmentCompatability11.ts (1 errors) ==== +==== assignmentCompatability11.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: 1}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability12.errors.txt b/tests/baselines/reference/assignmentCompatability12.errors.txt index 4156d20c5a2..51bdab4bff0 100644 --- a/tests/baselines/reference/assignmentCompatability12.errors.txt +++ b/tests/baselines/reference/assignmentCompatability12.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability12.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability12.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability12.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string'. -==== assignmentCompatability12.ts (1 errors) ==== +==== assignmentCompatability12.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: "1"}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability13.errors.txt b/tests/baselines/reference/assignmentCompatability13.errors.txt index 99b3a3e41f3..920ea45abfc 100644 --- a/tests/baselines/reference/assignmentCompatability13.errors.txt +++ b/tests/baselines/reference/assignmentCompatability13.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability13.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability13.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability13.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }'. Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. -==== assignmentCompatability13.ts (1 errors) ==== +==== assignmentCompatability13.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: "1"}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability14.errors.txt b/tests/baselines/reference/assignmentCompatability14.errors.txt index f32b599604b..0bb119dd877 100644 --- a/tests/baselines/reference/assignmentCompatability14.errors.txt +++ b/tests/baselines/reference/assignmentCompatability14.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability14.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability14.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability14.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean'. -==== assignmentCompatability14.ts (1 errors) ==== +==== assignmentCompatability14.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: true}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability15.errors.txt b/tests/baselines/reference/assignmentCompatability15.errors.txt index a3726fb2e9f..3b3667ea1c6 100644 --- a/tests/baselines/reference/assignmentCompatability15.errors.txt +++ b/tests/baselines/reference/assignmentCompatability15.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability15.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability15.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability15.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'boolean'. -==== assignmentCompatability15.ts (1 errors) ==== +==== assignmentCompatability15.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: true}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability16.errors.txt b/tests/baselines/reference/assignmentCompatability16.errors.txt index 060dd9436aa..2db9ea103e5 100644 --- a/tests/baselines/reference/assignmentCompatability16.errors.txt +++ b/tests/baselines/reference/assignmentCompatability16.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability16.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability16.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability16.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'any[]'. -==== assignmentCompatability16.ts (1 errors) ==== +==== assignmentCompatability16.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: [1]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability17.errors.txt b/tests/baselines/reference/assignmentCompatability17.errors.txt index 5b644b0f014..995a40b797d 100644 --- a/tests/baselines/reference/assignmentCompatability17.errors.txt +++ b/tests/baselines/reference/assignmentCompatability17.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability17.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability17.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability17.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: any[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'any[]'. -==== assignmentCompatability17.ts (1 errors) ==== +==== assignmentCompatability17.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: [1]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability18.errors.txt b/tests/baselines/reference/assignmentCompatability18.errors.txt index dd7d8528858..285f7297fed 100644 --- a/tests/baselines/reference/assignmentCompatability18.errors.txt +++ b/tests/baselines/reference/assignmentCompatability18.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability18.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability18.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability18.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'number[]'. -==== assignmentCompatability18.ts (1 errors) ==== +==== assignmentCompatability18.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: [1]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability19.errors.txt b/tests/baselines/reference/assignmentCompatability19.errors.txt index 111f623baf5..c3e0454f95c 100644 --- a/tests/baselines/reference/assignmentCompatability19.errors.txt +++ b/tests/baselines/reference/assignmentCompatability19.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability19.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability19.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability19.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'number[]'. -==== assignmentCompatability19.ts (1 errors) ==== +==== assignmentCompatability19.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: [1]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability2.errors.txt b/tests/baselines/reference/assignmentCompatability2.errors.txt new file mode 100644 index 00000000000..39620ad064d --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability2.errors.txt @@ -0,0 +1,18 @@ +assignmentCompatability2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability2.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatability2.ts (2 errors) ==== + module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; + export var __val__obj4 = obj4; + } + module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var aa:{};; + export var __val__aa = aa; + } + __test2__.__val__aa = __test1__.__val__obj4 \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability20.errors.txt b/tests/baselines/reference/assignmentCompatability20.errors.txt index 249ded8a2dc..c408fe1fd85 100644 --- a/tests/baselines/reference/assignmentCompatability20.errors.txt +++ b/tests/baselines/reference/assignmentCompatability20.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability20.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability20.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability20.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string[]'. -==== assignmentCompatability20.ts (1 errors) ==== +==== assignmentCompatability20.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: ["1"]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability21.errors.txt b/tests/baselines/reference/assignmentCompatability21.errors.txt index cdee4dd3d2e..f37708746ec 100644 --- a/tests/baselines/reference/assignmentCompatability21.errors.txt +++ b/tests/baselines/reference/assignmentCompatability21.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability21.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability21.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability21.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'string[]'. -==== assignmentCompatability21.ts (1 errors) ==== +==== assignmentCompatability21.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: ["1"]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability22.errors.txt b/tests/baselines/reference/assignmentCompatability22.errors.txt index da9cd1e4c57..e3e26c9bd07 100644 --- a/tests/baselines/reference/assignmentCompatability22.errors.txt +++ b/tests/baselines/reference/assignmentCompatability22.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability22.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability22.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability22.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean[]'. -==== assignmentCompatability22.ts (1 errors) ==== +==== assignmentCompatability22.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {one: [true]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability23.errors.txt b/tests/baselines/reference/assignmentCompatability23.errors.txt index 0b3b422b60c..ee6e5643d77 100644 --- a/tests/baselines/reference/assignmentCompatability23.errors.txt +++ b/tests/baselines/reference/assignmentCompatability23.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability23.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability23.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability23.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: boolean[]; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'boolean[]'. -==== assignmentCompatability23.ts (1 errors) ==== +==== assignmentCompatability23.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = {two: [true]}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability24.errors.txt b/tests/baselines/reference/assignmentCompatability24.errors.txt index 7298208241e..3b981b3c458 100644 --- a/tests/baselines/reference/assignmentCompatability24.errors.txt +++ b/tests/baselines/reference/assignmentCompatability24.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability24.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability24.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability24.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. -==== assignmentCompatability24.ts (1 errors) ==== +==== assignmentCompatability24.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj = function f(a: Tstring) { return a; };; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability25.errors.txt b/tests/baselines/reference/assignmentCompatability25.errors.txt index 8c1a2431ba6..28d6201b59b 100644 --- a/tests/baselines/reference/assignmentCompatability25.errors.txt +++ b/tests/baselines/reference/assignmentCompatability25.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability25.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability25.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability25.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: number; }'. Types of property 'two' are incompatible. Type 'string' is not assignable to type 'number'. -==== assignmentCompatability25.ts (1 errors) ==== +==== assignmentCompatability25.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{two:number;};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability26.errors.txt b/tests/baselines/reference/assignmentCompatability26.errors.txt index 014f618d473..3bbe0a9a5c8 100644 --- a/tests/baselines/reference/assignmentCompatability26.errors.txt +++ b/tests/baselines/reference/assignmentCompatability26.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability26.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability26.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability26.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string'. -==== assignmentCompatability26.ts (1 errors) ==== +==== assignmentCompatability26.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:string;};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability27.errors.txt b/tests/baselines/reference/assignmentCompatability27.errors.txt index 1dae5a7495c..969a310a35f 100644 --- a/tests/baselines/reference/assignmentCompatability27.errors.txt +++ b/tests/baselines/reference/assignmentCompatability27.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability27.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability27.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability27.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }'. Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. -==== assignmentCompatability27.ts (1 errors) ==== +==== assignmentCompatability27.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{two:string;};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability28.errors.txt b/tests/baselines/reference/assignmentCompatability28.errors.txt index fda541dc3f3..8ab437417b1 100644 --- a/tests/baselines/reference/assignmentCompatability28.errors.txt +++ b/tests/baselines/reference/assignmentCompatability28.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability28.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability28.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability28.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean'. -==== assignmentCompatability28.ts (1 errors) ==== +==== assignmentCompatability28.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:boolean;};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability29.errors.txt b/tests/baselines/reference/assignmentCompatability29.errors.txt index 3e9056460ad..c0cdc11e309 100644 --- a/tests/baselines/reference/assignmentCompatability29.errors.txt +++ b/tests/baselines/reference/assignmentCompatability29.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability29.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability29.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability29.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: any[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'any[]'. -==== assignmentCompatability29.ts (1 errors) ==== +==== assignmentCompatability29.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:any[];};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability3.errors.txt b/tests/baselines/reference/assignmentCompatability3.errors.txt new file mode 100644 index 00000000000..29d5f059649 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability3.errors.txt @@ -0,0 +1,18 @@ +assignmentCompatability3.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability3.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatability3.ts (2 errors) ==== + module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; + export var __val__obj4 = obj4; + } + module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var obj = {one: 1}; + export var __val__obj = obj; + } + __test2__.__val__obj = __test1__.__val__obj4 \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability30.errors.txt b/tests/baselines/reference/assignmentCompatability30.errors.txt index 4dfa8802383..479def51f9e 100644 --- a/tests/baselines/reference/assignmentCompatability30.errors.txt +++ b/tests/baselines/reference/assignmentCompatability30.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability30.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability30.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability30.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: number[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'number[]'. -==== assignmentCompatability30.ts (1 errors) ==== +==== assignmentCompatability30.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:number[];};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability31.errors.txt b/tests/baselines/reference/assignmentCompatability31.errors.txt index 680c03f7e7d..8fe27163cf0 100644 --- a/tests/baselines/reference/assignmentCompatability31.errors.txt +++ b/tests/baselines/reference/assignmentCompatability31.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability31.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability31.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability31.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: string[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'string[]'. -==== assignmentCompatability31.ts (1 errors) ==== +==== assignmentCompatability31.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:string[];};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability32.errors.txt b/tests/baselines/reference/assignmentCompatability32.errors.txt index dd1d9838a47..fc0520d89c5 100644 --- a/tests/baselines/reference/assignmentCompatability32.errors.txt +++ b/tests/baselines/reference/assignmentCompatability32.errors.txt @@ -1,14 +1,20 @@ +assignmentCompatability32.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability32.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability32.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ one: boolean[]; }'. Types of property 'one' are incompatible. Type 'number' is not assignable to type 'boolean[]'. -==== assignmentCompatability32.ts (1 errors) ==== +==== assignmentCompatability32.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{one:boolean[];};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability33.errors.txt b/tests/baselines/reference/assignmentCompatability33.errors.txt index ca248ffd6f4..a47c39fedab 100644 --- a/tests/baselines/reference/assignmentCompatability33.errors.txt +++ b/tests/baselines/reference/assignmentCompatability33.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability33.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability33.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability33.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. -==== assignmentCompatability33.ts (1 errors) ==== +==== assignmentCompatability33.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj: { (a: Tstring): Tstring; }; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability34.errors.txt b/tests/baselines/reference/assignmentCompatability34.errors.txt index 5519c0c36d8..a6c20a2928a 100644 --- a/tests/baselines/reference/assignmentCompatability34.errors.txt +++ b/tests/baselines/reference/assignmentCompatability34.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability34.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability34.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability34.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber'. -==== assignmentCompatability34.ts (1 errors) ==== +==== assignmentCompatability34.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var obj: { (a:Tnumber):Tnumber;}; export var __val__obj = obj; } diff --git a/tests/baselines/reference/assignmentCompatability35.errors.txt b/tests/baselines/reference/assignmentCompatability35.errors.txt index 2a1082e2ffa..c03b1163da4 100644 --- a/tests/baselines/reference/assignmentCompatability35.errors.txt +++ b/tests/baselines/reference/assignmentCompatability35.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability35.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability35.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability35.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ [index: number]: number; }'. Index signature for type 'number' is missing in type 'interfaceWithPublicAndOptional'. -==== assignmentCompatability35.ts (1 errors) ==== +==== assignmentCompatability35.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{[index:number]:number;};; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability36.errors.txt b/tests/baselines/reference/assignmentCompatability36.errors.txt new file mode 100644 index 00000000000..449a610965a --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability36.errors.txt @@ -0,0 +1,18 @@ +assignmentCompatability36.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability36.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatability36.ts (2 errors) ==== + module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; + export var __val__obj4 = obj4; + } + module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var aa:{[index:string]:any;};; + export var __val__aa = aa; + } + __test2__.__val__aa = __test1__.__val__obj4 \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability37.errors.txt b/tests/baselines/reference/assignmentCompatability37.errors.txt index eeeaf566b53..e4c3aa1ffa5 100644 --- a/tests/baselines/reference/assignmentCompatability37.errors.txt +++ b/tests/baselines/reference/assignmentCompatability37.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability37.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability37.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability37.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any'. -==== assignmentCompatability37.ts (1 errors) ==== +==== assignmentCompatability37.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{ new (param: Tnumber); };; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability38.errors.txt b/tests/baselines/reference/assignmentCompatability38.errors.txt index d8c6d710d73..d15795cbd51 100644 --- a/tests/baselines/reference/assignmentCompatability38.errors.txt +++ b/tests/baselines/reference/assignmentCompatability38.errors.txt @@ -1,13 +1,19 @@ +assignmentCompatability38.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability38.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentCompatability38.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any'. -==== assignmentCompatability38.ts (1 errors) ==== +==== assignmentCompatability38.ts (3 errors) ==== module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; export var __val__obj4 = obj4; } module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var aa:{ new (param: Tstring); };; export var __val__aa = aa; } diff --git a/tests/baselines/reference/assignmentCompatability4.errors.txt b/tests/baselines/reference/assignmentCompatability4.errors.txt new file mode 100644 index 00000000000..11794503078 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatability4.errors.txt @@ -0,0 +1,18 @@ +assignmentCompatability4.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentCompatability4.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== assignmentCompatability4.ts (2 errors) ==== + module __test1__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface interfaceWithPublicAndOptional { one: T; two?: U; }; var obj4: interfaceWithPublicAndOptional = { one: 1 };; + export var __val__obj4 = obj4; + } + module __test2__ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var aa:{one:number;};; + export var __val__aa = aa; + } + __test2__.__val__aa = __test1__.__val__obj4 \ No newline at end of file diff --git a/tests/baselines/reference/assignmentLHSIsValue.errors.txt b/tests/baselines/reference/assignmentLHSIsValue.errors.txt index cd5a9761cef..b7cb73a22e7 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/assignmentLHSIsValue.errors.txt @@ -3,6 +3,7 @@ assignmentLHSIsValue.ts(7,13): error TS2364: The left-hand side of an assignment assignmentLHSIsValue.ts(8,21): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. assignmentLHSIsValue.ts(11,18): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. assignmentLHSIsValue.ts(13,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +assignmentLHSIsValue.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentLHSIsValue.ts(17,1): error TS2631: Cannot assign to 'M' because it is a namespace. assignmentLHSIsValue.ts(19,1): error TS2629: Cannot assign to 'C' because it is a class. assignmentLHSIsValue.ts(22,1): error TS2628: Cannot assign to 'E' because it is an enum. @@ -39,7 +40,7 @@ assignmentLHSIsValue.ts(69,1): error TS2364: The left-hand side of an assignment assignmentLHSIsValue.ts(70,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -==== assignmentLHSIsValue.ts (39 errors) ==== +==== assignmentLHSIsValue.ts (40 errors) ==== // expected error for all the LHS of assignments var value: any; @@ -66,6 +67,8 @@ assignmentLHSIsValue.ts(70,1): error TS2364: The left-hand side of an assignment // identifiers: module, class, enum, function module M { export var a; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M = value; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt index 168cb6b653b..a03153ff96e 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt @@ -1,10 +1,13 @@ assignmentToParenthesizedIdentifiers.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'. assignmentToParenthesizedIdentifiers.ts(5,1): error TS2322: Type 'string' is not assignable to type 'number'. +assignmentToParenthesizedIdentifiers.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentToParenthesizedIdentifiers.ts(13,1): error TS2322: Type 'string' is not assignable to type 'number'. assignmentToParenthesizedIdentifiers.ts(14,1): error TS2322: Type 'string' is not assignable to type 'number'. assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type 'string' is not assignable to type 'number'. assignmentToParenthesizedIdentifiers.ts(17,1): error TS2631: Cannot assign to 'M' because it is a namespace. assignmentToParenthesizedIdentifiers.ts(18,2): error TS2631: Cannot assign to 'M' because it is a namespace. +assignmentToParenthesizedIdentifiers.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +assignmentToParenthesizedIdentifiers.ts(21,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. assignmentToParenthesizedIdentifiers.ts(25,5): error TS2631: Cannot assign to 'M3' because it is a namespace. assignmentToParenthesizedIdentifiers.ts(31,11): error TS2322: Type 'string' is not assignable to type 'number'. assignmentToParenthesizedIdentifiers.ts(32,13): error TS2322: Type 'string' is not assignable to type 'number'. @@ -24,7 +27,7 @@ assignmentToParenthesizedIdentifiers.ts(69,1): error TS2629: Cannot assign to 'C assignmentToParenthesizedIdentifiers.ts(70,2): error TS2629: Cannot assign to 'C' because it is a class. -==== assignmentToParenthesizedIdentifiers.ts (24 errors) ==== +==== assignmentToParenthesizedIdentifiers.ts (27 errors) ==== var x: number; x = 3; // OK (x) = 3; // OK @@ -36,6 +39,8 @@ assignmentToParenthesizedIdentifiers.ts(70,2): error TS2629: Cannot assign to 'C !!! error TS2322: Type 'string' is not assignable to type 'number'. module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var y: number; } M.y = 3; // OK @@ -59,7 +64,11 @@ assignmentToParenthesizedIdentifiers.ts(70,2): error TS2629: Cannot assign to 'C !!! error TS2631: Cannot assign to 'M' because it is a namespace. module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var x: number; } diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.errors.txt index d31f2dc0c77..b8a6124468e 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.errors.txt +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.errors.txt @@ -1,7 +1,8 @@ asyncAwaitIsolatedModules_es2017.ts(1,27): error TS2792: Cannot find module 'missing'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +asyncAwaitIsolatedModules_es2017.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== asyncAwaitIsolatedModules_es2017.ts (1 errors) ==== +==== asyncAwaitIsolatedModules_es2017.ts (2 errors) ==== import { MyPromise } from "missing"; ~~~~~~~~~ !!! error TS2792: Cannot find module 'missing'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? @@ -41,5 +42,7 @@ asyncAwaitIsolatedModules_es2017.ts(1,27): error TS2792: Cannot find module 'mis } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export async function f1() { } } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt index db8a11aa869..296fc8854f4 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt @@ -1,7 +1,8 @@ asyncAwaitIsolatedModules_es5.ts(1,27): error TS2307: Cannot find module 'missing' or its corresponding type declarations. +asyncAwaitIsolatedModules_es5.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== asyncAwaitIsolatedModules_es5.ts (1 errors) ==== +==== asyncAwaitIsolatedModules_es5.ts (2 errors) ==== import { MyPromise } from "missing"; ~~~~~~~~~ !!! error TS2307: Cannot find module 'missing' or its corresponding type declarations. @@ -41,5 +42,7 @@ asyncAwaitIsolatedModules_es5.ts(1,27): error TS2307: Cannot find module 'missin } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export async function f1() { } } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.errors.txt index 9ee15a6cc8b..b2f78c6c320 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.errors.txt +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.errors.txt @@ -1,7 +1,8 @@ asyncAwaitIsolatedModules_es6.ts(1,27): error TS2792: Cannot find module 'missing'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +asyncAwaitIsolatedModules_es6.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== asyncAwaitIsolatedModules_es6.ts (1 errors) ==== +==== asyncAwaitIsolatedModules_es6.ts (2 errors) ==== import { MyPromise } from "missing"; ~~~~~~~~~ !!! error TS2792: Cannot find module 'missing'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? @@ -41,5 +42,7 @@ asyncAwaitIsolatedModules_es6.ts(1,27): error TS2792: Cannot find module 'missin } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export async function f1() { } } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwait_es2017.errors.txt b/tests/baselines/reference/asyncAwait_es2017.errors.txt new file mode 100644 index 00000000000..c7731eb3b61 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es2017.errors.txt @@ -0,0 +1,52 @@ +asyncAwait_es2017.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== asyncAwait_es2017.ts (1 errors) ==== + type MyPromise = Promise; + declare var MyPromise: typeof Promise; + declare var p: Promise; + declare var mp: MyPromise; + + async function f0() { } + async function f1(): Promise { } + async function f3(): MyPromise { } + + let f4 = async function() { } + let f5 = async function(): Promise { } + let f6 = async function(): MyPromise { } + + let f7 = async () => { }; + let f8 = async (): Promise => { }; + let f9 = async (): MyPromise => { }; + let f10 = async () => p; + let f11 = async () => mp; + let f12 = async (): Promise => mp; + let f13 = async (): MyPromise => p; + + let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } + }; + + class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export async function f1() { } + } + + async function f14() { + block: { + await 1; + break block; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwait_es5.errors.txt b/tests/baselines/reference/asyncAwait_es5.errors.txt new file mode 100644 index 00000000000..dc5a0416086 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5.errors.txt @@ -0,0 +1,52 @@ +asyncAwait_es5.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== asyncAwait_es5.ts (1 errors) ==== + type MyPromise = Promise; + declare var MyPromise: typeof Promise; + declare var p: Promise; + declare var mp: MyPromise; + + async function f0() { } + async function f1(): Promise { } + async function f3(): MyPromise { } + + let f4 = async function() { } + let f5 = async function(): Promise { } + let f6 = async function(): MyPromise { } + + let f7 = async () => { }; + let f8 = async (): Promise => { }; + let f9 = async (): MyPromise => { }; + let f10 = async () => p; + let f11 = async () => mp; + let f12 = async (): Promise => mp; + let f13 = async (): MyPromise => p; + + let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } + }; + + class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export async function f1() { } + } + + async function f14() { + block: { + await 1; + break block; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwait_es6.errors.txt b/tests/baselines/reference/asyncAwait_es6.errors.txt new file mode 100644 index 00000000000..1a82a8f0ede --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es6.errors.txt @@ -0,0 +1,52 @@ +asyncAwait_es6.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== asyncAwait_es6.ts (1 errors) ==== + type MyPromise = Promise; + declare var MyPromise: typeof Promise; + declare var p: Promise; + declare var mp: MyPromise; + + async function f0() { } + async function f1(): Promise { } + async function f3(): MyPromise { } + + let f4 = async function() { } + let f5 = async function(): Promise { } + let f6 = async function(): MyPromise { } + + let f7 = async () => { }; + let f8 = async (): Promise => { }; + let f9 = async (): MyPromise => { }; + let f10 = async () => p; + let f11 = async () => mp; + let f12 = async (): Promise => mp; + let f13 = async (): MyPromise => p; + + let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } + }; + + class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export async function f1() { } + } + + async function f14() { + block: { + await 1; + break block; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals5.errors.txt b/tests/baselines/reference/augmentExportEquals5.errors.txt new file mode 100644 index 00000000000..b2167f9312d --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals5.errors.txt @@ -0,0 +1,84 @@ +express.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== express.d.ts (1 errors) ==== + declare module Express { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Request { } + export interface Response { } + export interface Application { } + } + + declare module "express" { + function e(): e.Express; + namespace e { + interface IRoute { + all(...handler: RequestHandler[]): IRoute; + } + + interface IRouterMatcher { + (name: string|RegExp, ...handlers: RequestHandler[]): T; + } + + interface IRouter extends RequestHandler { + route(path: string): IRoute; + } + + export function Router(options?: any): Router; + + export interface Router extends IRouter {} + + interface Errback { (err: Error): void; } + + interface Request extends Express.Request { + + get (name: string): string; + } + + interface Response extends Express.Response { + charset: string; + } + + interface ErrorRequestHandler { + (err: any, req: Request, res: Response, next: Function): any; + } + + interface RequestHandler { + (req: Request, res: Response, next: Function): any; + } + + interface Handler extends RequestHandler {} + + interface RequestParamHandler { + (req: Request, res: Response, next: Function, param: any): any; + } + + interface Application extends IRouter, Express.Application { + routes: any; + } + + interface Express extends Application { + createApplication(): Application; + } + + var static: any; + } + + export = e; + } + +==== augmentation.ts (0 errors) ==== + /// + import * as e from "express"; + declare module "express" { + interface Request { + id: number; + } + } + +==== consumer.ts (0 errors) ==== + import { Request } from "express"; + import "./augmentation"; + let x: Request; + const y = x.id; \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals5.types b/tests/baselines/reference/augmentExportEquals5.types index 7c512800e3d..4575e304240 100644 --- a/tests/baselines/reference/augmentExportEquals5.types +++ b/tests/baselines/reference/augmentExportEquals5.types @@ -49,6 +49,7 @@ declare module "express" { >Router : (options?: any) => Router > : ^ ^^^ ^^^^^ >options : any +> : ^^^ export interface Router extends IRouter {} @@ -79,6 +80,7 @@ declare module "express" { interface ErrorRequestHandler { (err: any, req: Request, res: Response, next: Function): any; >err : any +> : ^^^ >req : Request > : ^^^^^^^ >res : Response @@ -108,6 +110,7 @@ declare module "express" { >next : Function > : ^^^^^^^^ >param : any +> : ^^^ } interface Application extends IRouter, Express.Application { @@ -116,6 +119,7 @@ declare module "express" { routes: any; >routes : any +> : ^^^ } interface Express extends Application { @@ -126,6 +130,7 @@ declare module "express" { var static: any; >static : any +> : ^^^ } export = e; diff --git a/tests/baselines/reference/augmentedTypesClass3.errors.txt b/tests/baselines/reference/augmentedTypesClass3.errors.txt new file mode 100644 index 00000000000..d7057c3ddca --- /dev/null +++ b/tests/baselines/reference/augmentedTypesClass3.errors.txt @@ -0,0 +1,25 @@ +augmentedTypesClass3.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesClass3.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesClass3.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== augmentedTypesClass3.ts (3 errors) ==== + // class then module + class c5 { public foo() { } } + module c5 { } // should be ok + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + class c5a { public foo() { } } + module c5a { var y = 2; } // should be ok + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + class c5b { public foo() { } } + module c5b { export var y = 2; } // should be ok + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + //// class then import + class c5c { public foo() { } } + //import c5c = require(''); \ No newline at end of file diff --git a/tests/baselines/reference/augmentedTypesFunction.errors.txt b/tests/baselines/reference/augmentedTypesFunction.errors.txt index 241e7464609..1b39b3eadc0 100644 --- a/tests/baselines/reference/augmentedTypesFunction.errors.txt +++ b/tests/baselines/reference/augmentedTypesFunction.errors.txt @@ -10,9 +10,13 @@ augmentedTypesFunction.ts(16,10): error TS2814: Function with bodies can only me augmentedTypesFunction.ts(17,7): error TS2813: Class declaration cannot implement overload list for 'y3a'. augmentedTypesFunction.ts(20,10): error TS2567: Enum declarations can only merge with namespace or other enum declarations. augmentedTypesFunction.ts(21,6): error TS2567: Enum declarations can only merge with namespace or other enum declarations. +augmentedTypesFunction.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesFunction.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesFunction.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesFunction.ts(34,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== augmentedTypesFunction.ts (12 errors) ==== +==== augmentedTypesFunction.ts (16 errors) ==== // function then var function y1() { } // error ~~ @@ -66,15 +70,23 @@ augmentedTypesFunction.ts(21,6): error TS2567: Enum declarations can only merge // function then internal module function y5() { } module y5 { } // ok since module is not instantiated + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function y5a() { } module y5a { var y = 2; } // should be an error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function y5b() { } module y5b { export var y = 3; } // should be an error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function y5c() { } module y5c { export interface I { foo(): void } } // should be an error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // function then import, messes with other errors //function y6() { } diff --git a/tests/baselines/reference/augmentedTypesModules.errors.txt b/tests/baselines/reference/augmentedTypesModules.errors.txt index c5e17402e5b..5145aaeee5d 100644 --- a/tests/baselines/reference/augmentedTypesModules.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules.errors.txt @@ -1,20 +1,53 @@ +augmentedTypesModules.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(5,8): error TS2300: Duplicate identifier 'm1a'. augmentedTypesModules.ts(6,5): error TS2300: Duplicate identifier 'm1a'. +augmentedTypesModules.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(8,8): error TS2300: Duplicate identifier 'm1b'. augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'. +augmentedTypesModules.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'. augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'. +augmentedTypesModules.ts(22,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(25,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +augmentedTypesModules.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(28,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +augmentedTypesModules.ts(33,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(35,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(39,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(48,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(51,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +augmentedTypesModules.ts(55,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(58,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(61,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(63,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(67,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(70,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(74,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(77,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(80,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(83,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(86,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(91,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(92,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +augmentedTypesModules.ts(95,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== augmentedTypesModules.ts (9 errors) ==== +==== augmentedTypesModules.ts (38 errors) ==== // module then var module m1 { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var m1 = 1; // Should be allowed module m1a { var y = 2; } // error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2300: Duplicate identifier 'm1a'. var m1a = 1; // error @@ -22,6 +55,8 @@ augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be !!! error TS2300: Duplicate identifier 'm1a'. module m1b { export var y = 2; } // error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2300: Duplicate identifier 'm1b'. var m1b = 1; // error @@ -29,11 +64,15 @@ augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be !!! error TS2300: Duplicate identifier 'm1b'. module m1c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { foo(): void; } } var m1c = 1; // Should be allowed module m1d { // error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2300: Duplicate identifier 'm1d'. export class I { foo() { } } @@ -44,14 +83,20 @@ augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be // module then function module m2 { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function m2() { }; // ok since the module is not instantiated module m2a { var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2a() { }; // error since the module is instantiated module m2b { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2b() { }; // error since the module is instantiated @@ -59,69 +104,111 @@ augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be // should be errors to have function first function m2c() { }; module m2c { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module m2d { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare function m2d(): void; declare function m2e(): void; module m2e { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function m2f() { }; module m2f { export interface I { foo(): void } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function m2g() { }; module m2g { export class C { foo() { } } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // module then class module m3 { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class m3 { } // ok since the module is not instantiated module m3a { var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. class m3a { foo() { } } // error, class isn't ambient or declared before the module class m3b { foo() { } } module m3b { var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class m3c { foo() { } } module m3c { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class m3d { foo(): void } module m3d { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module m3e { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class m3e { foo(): void } declare class m3f { foo(): void } module m3f { export interface I { foo(): void } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class m3g { foo(): void } module m3g { export class C { foo() { } } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // module then enum // should be errors module m4 { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum m4 { } module m4a { var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum m4a { One } module m4b { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum m4b { One } module m4c { interface I { foo(): void } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum m4c { One } module m4d { class C { foo() { } } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum m4d { One } //// module then module module m5 { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module m5 { export interface I { foo(): void } } // should already be reasonably well covered + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // module then import module m6 { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. //import m6 = require(''); \ No newline at end of file diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.errors.txt b/tests/baselines/reference/binopAssignmentShouldHaveType.errors.txt new file mode 100644 index 00000000000..b2d4a4f8274 --- /dev/null +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.errors.txt @@ -0,0 +1,25 @@ +binopAssignmentShouldHaveType.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== binopAssignmentShouldHaveType.ts (1 errors) ==== + declare var console; + "use strict"; + module Test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Bug { + getName():string { + return "name"; + } + bug() { + var name:string= null; + if ((name= this.getName()).length > 0) { + console.log(name); + } + } + } + } + + + + \ No newline at end of file diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.types b/tests/baselines/reference/binopAssignmentShouldHaveType.types index b070ae3a4c2..44caf85b146 100644 --- a/tests/baselines/reference/binopAssignmentShouldHaveType.types +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.types @@ -3,6 +3,7 @@ === binopAssignmentShouldHaveType.ts === declare var console; >console : any +> : ^^^ "use strict"; >"use strict" : "use strict" @@ -58,7 +59,9 @@ module Test { console.log(name); >console.log(name) : any +> : ^^^ >console.log : any +> : ^^^ >console : any > : ^^^ >log : any diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt index 3f827e0f4e9..13f708984f8 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,4 @@ +bitwiseNotOperatorWithAnyOtherType.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. bitwiseNotOperatorWithAnyOtherType.ts(34,24): error TS18050: The value 'undefined' cannot be used here. bitwiseNotOperatorWithAnyOtherType.ts(35,24): error TS18050: The value 'null' cannot be used here. bitwiseNotOperatorWithAnyOtherType.ts(46,26): error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'. @@ -5,7 +6,7 @@ bitwiseNotOperatorWithAnyOtherType.ts(47,26): error TS2365: Operator '+' cannot bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -==== bitwiseNotOperatorWithAnyOtherType.ts (5 errors) ==== +==== bitwiseNotOperatorWithAnyOtherType.ts (6 errors) ==== // ~ operator on any type var ANY: any; @@ -26,6 +27,8 @@ bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.errors.txt b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.errors.txt new file mode 100644 index 00000000000..4766eb0cdbb --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.errors.txt @@ -0,0 +1,50 @@ +bitwiseNotOperatorWithNumberType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== bitwiseNotOperatorWithNumberType.ts (1 errors) ==== + // ~ operator on number type + var NUMBER: number; + var NUMBER1: number[] = [1, 2]; + + function foo(): number { return 1; } + + class A { + public a: number; + static foo() { return 1; } + } + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var n: number; + } + + var objA = new A(); + + // number type var + var ResultIsNumber1 = ~NUMBER; + var ResultIsNumber2 = ~NUMBER1; + + // number type literal + var ResultIsNumber3 = ~1; + var ResultIsNumber4 = ~{ x: 1, y: 2}; + var ResultIsNumber5 = ~{ x: 1, y: (n: number) => { return n; } }; + + // number type expressions + var ResultIsNumber6 = ~objA.a; + var ResultIsNumber7 = ~M.n; + var ResultIsNumber8 = ~NUMBER1[0]; + var ResultIsNumber9 = ~foo(); + var ResultIsNumber10 = ~A.foo(); + var ResultIsNumber11 = ~(NUMBER + NUMBER); + + // multiple ~ operators + var ResultIsNumber12 = ~~NUMBER; + var ResultIsNumber13 = ~~~(NUMBER + NUMBER); + + // miss assignment operators + ~NUMBER; + ~NUMBER1; + ~foo(); + ~objA.a; + ~M.n; + ~objA.a, M.n; \ No newline at end of file diff --git a/tests/baselines/reference/bluebirdStaticThis.errors.txt b/tests/baselines/reference/bluebirdStaticThis.errors.txt index 0c1f2baf595..4abada67c63 100644 --- a/tests/baselines/reference/bluebirdStaticThis.errors.txt +++ b/tests/baselines/reference/bluebirdStaticThis.errors.txt @@ -5,9 +5,10 @@ bluebirdStaticThis.ts(57,109): error TS2694: Namespace '"bluebirdStaticThis".Pro bluebirdStaticThis.ts(58,91): error TS2694: Namespace '"bluebirdStaticThis".Promise' has no exported member 'Inspection'. bluebirdStaticThis.ts(59,91): error TS2694: Namespace '"bluebirdStaticThis".Promise' has no exported member 'Inspection'. bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"bluebirdStaticThis".Promise' has no exported member 'Inspection'. +bluebirdStaticThis.ts(111,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== bluebirdStaticThis.ts (6 errors) ==== +==== bluebirdStaticThis.ts (7 errors) ==== // This version is reduced from the full d.ts by removing almost all the tests // and all the comments. // Then it adds explicit `this` arguments to the static members. @@ -133,6 +134,8 @@ bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"bluebirdStaticThis".Prom } export declare module Promise { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface Thenable { then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt index 70c88dd9043..593455dfae8 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt @@ -1,3 +1,5 @@ +callSignatureAssignabilityInInheritance.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +callSignatureAssignabilityInInheritance.ts(34,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. callSignatureAssignabilityInInheritance.ts(57,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. The types returned by 'a(...)' are incompatible between these types. Type 'string' is not assignable to type 'number'. @@ -7,8 +9,10 @@ callSignatureAssignabilityInInheritance.ts(63,15): error TS2430: Interface 'I3' 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== callSignatureAssignabilityInInheritance.ts (2 errors) ==== +==== callSignatureAssignabilityInInheritance.ts (4 errors) ==== module CallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's (x: number): void; @@ -42,6 +46,8 @@ callSignatureAssignabilityInInheritance.ts(63,15): error TS2430: Interface 'I3' } module MemberWithCallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's a: (x: number) => void; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 9f6a5043893..e5e234a1d75 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -1,3 +1,5 @@ +callSignatureAssignabilityInInheritance3.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +callSignatureAssignabilityInInheritance3.ts(10,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. callSignatureAssignabilityInInheritance3.ts(51,19): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. @@ -26,6 +28,7 @@ callSignatureAssignabilityInInheritance3.ts(80,19): error TS2430: Interface 'I7' Type '{ a: string; b: number; }' is not assignable to type '{ a: Base; b: Base; }'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'Base'. +callSignatureAssignabilityInInheritance3.ts(94,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. callSignatureAssignabilityInInheritance3.ts(100,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'. The types returned by 'a2(...)' are incompatible between these types. Type 'string[]' is not assignable to type 'T[]'. @@ -37,17 +40,21 @@ callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7 Type 'T' is not assignable to type 'string'. -==== callSignatureAssignabilityInInheritance3.ts (6 errors) ==== +==== callSignatureAssignabilityInInheritance3.ts (9 errors) ==== // checking subtype relations for function types as it relates to contextual signature instantiation // error cases module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } module WithNonGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // base type with non-generic call signatures interface A { a2: (x: number) => string[]; @@ -164,6 +171,8 @@ callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7 } module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // base type has generic call signature interface B { a2: (x: T) => T[]; diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.errors.txt b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.errors.txt new file mode 100644 index 00000000000..1be56883648 --- /dev/null +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.errors.txt @@ -0,0 +1,135 @@ +callSignatureWithoutReturnTypeAnnotationInference.ts(74,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +callSignatureWithoutReturnTypeAnnotationInference.ts(97,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +callSignatureWithoutReturnTypeAnnotationInference.ts(107,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +callSignatureWithoutReturnTypeAnnotationInference.ts(116,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== callSignatureWithoutReturnTypeAnnotationInference.ts (4 errors) ==== + // Call signatures without a return type should infer one from the function body (if present) + + // Simple types + function foo(x) { + return 1; + } + var r = foo(1); + + function foo2(x) { + return foo(x); + } + var r2 = foo2(1); + + function foo3() { + return foo3(); + } + var r3 = foo3(); + + function foo4(x: T) { + return x; + } + var r4 = foo4(1); + + function foo5(x) { + if (true) { + return 1; + } else { + return 2; + } + } + var r5 = foo5(1); + + function foo6(x) { + try { + } + catch (e) { + return []; + } + finally { + return []; + } + } + var r6 = foo6(1); + + function foo7(x) { + return typeof x; + } + var r7 = foo7(1); + + // object types + function foo8(x: number) { + return { x: x }; + } + var r8 = foo8(1); + + interface I { + foo: string; + } + function foo9(x: number) { + var i: I; + return i; + } + var r9 = foo9(1); + + class C { + foo: string; + } + function foo10(x: number) { + var c: C; + return c; + } + var r10 = foo10(1); + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 1; + export class C { foo: string } + } + function foo11() { + return M; + } + var r11 = foo11(); + + // merged declarations + interface I2 { + x: number; + } + interface I2 { + y: number; + } + function foo12() { + var i2: I2; + return i2; + } + var r12 = foo12(); + + function m1() { return 1; } + module m1 { export var y = 2; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo13() { + return m1; + } + var r13 = foo13(); + + class c1 { + foo: string; + constructor(x) { } + } + module c1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 1; + } + function foo14() { + return c1; + } + var r14 = foo14(); + + enum e1 { A } + module e1 { export var y = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo15() { + return e1; + } + var r15 = foo15(); \ No newline at end of file diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types index 724f9957388..c269d0732a1 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types @@ -8,6 +8,7 @@ function foo(x) { >foo : (x: any) => number > : ^ ^^^^^^^^^^^^^^^^ >x : any +> : ^^^ return 1; >1 : 1 @@ -27,6 +28,7 @@ function foo2(x) { >foo2 : (x: any) => number > : ^ ^^^^^^^^^^^^^^^^ >x : any +> : ^^^ return foo(x); >foo(x) : number @@ -34,6 +36,7 @@ function foo2(x) { >foo : (x: any) => number > : ^ ^^^^^^^^^^^^^^^^ >x : any +> : ^^^ } var r2 = foo2(1); >r2 : number @@ -87,6 +90,7 @@ function foo5(x) { >foo5 : (x: any) => 1 | 2 > : ^ ^^^^^^^^^^^^^^^ >x : any +> : ^^^ if (true) { >true : true @@ -116,11 +120,13 @@ function foo6(x) { >foo6 : (x: any) => any[] > : ^ ^^^^^^^^^^^^^^^ >x : any +> : ^^^ try { } catch (e) { >e : any +> : ^^^ return []; >[] : undefined[] @@ -146,11 +152,13 @@ function foo7(x) { >foo7 : (x: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ return typeof x; >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any +> : ^^^ } var r7 = foo7(1); >r7 : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" @@ -351,6 +359,7 @@ class c1 { constructor(x) { } >x : any +> : ^^^ } module c1 { >c1 : typeof c1 diff --git a/tests/baselines/reference/chainedImportAlias.errors.txt b/tests/baselines/reference/chainedImportAlias.errors.txt new file mode 100644 index 00000000000..1c4520095ab --- /dev/null +++ b/tests/baselines/reference/chainedImportAlias.errors.txt @@ -0,0 +1,15 @@ +chainedImportAlias_file0.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== chainedImportAlias_file1.ts (0 errors) ==== + import x = require('./chainedImportAlias_file0'); + import y = x; + y.m.foo(); + +==== chainedImportAlias_file0.ts (1 errors) ==== + export module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo() { } + } + \ No newline at end of file diff --git a/tests/baselines/reference/checkForObjectTooStrict.errors.txt b/tests/baselines/reference/checkForObjectTooStrict.errors.txt index a4ab6e628c1..3463be46b7a 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.errors.txt +++ b/tests/baselines/reference/checkForObjectTooStrict.errors.txt @@ -1,8 +1,11 @@ +checkForObjectTooStrict.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. checkForObjectTooStrict.ts(3,18): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module CommonJS. -==== checkForObjectTooStrict.ts (1 errors) ==== +==== checkForObjectTooStrict.ts (2 errors) ==== module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Object { ~~~~~~ diff --git a/tests/baselines/reference/circularImportAlias.errors.txt b/tests/baselines/reference/circularImportAlias.errors.txt index 3b3fa010f7e..7a900ad9f1f 100644 --- a/tests/baselines/reference/circularImportAlias.errors.txt +++ b/tests/baselines/reference/circularImportAlias.errors.txt @@ -1,10 +1,14 @@ +circularImportAlias.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. circularImportAlias.ts(5,30): error TS2449: Class 'C' used before its declaration. +circularImportAlias.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== circularImportAlias.ts (1 errors) ==== +==== circularImportAlias.ts (3 errors) ==== // expected no error module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export import a = A; export class D extends a.C { ~ @@ -15,6 +19,8 @@ circularImportAlias.ts(5,30): error TS2449: Class 'C' used before its declaratio } module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class C { name: string } export import b = B; } diff --git a/tests/baselines/reference/classAndInterfaceMerge.d.errors.txt b/tests/baselines/reference/classAndInterfaceMerge.d.errors.txt new file mode 100644 index 00000000000..2a330ae4cd6 --- /dev/null +++ b/tests/baselines/reference/classAndInterfaceMerge.d.errors.txt @@ -0,0 +1,33 @@ +classAndInterfaceMerge.d.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +classAndInterfaceMerge.d.ts(22,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== classAndInterfaceMerge.d.ts (2 errors) ==== + interface C { } + + declare class C { } + + interface C { } + + interface C { } + + declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + interface C1 { } + + class C1 { } + + interface C1 { } + + interface C1 { } + + export class C2 { } + } + + declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface C2 { } + } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt index 9c3cbd75f77..1aea32039a1 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt @@ -3,12 +3,13 @@ classExtendsEveryObjectType.ts(6,18): error TS2507: Type '{ foo: any; }' is not classExtendsEveryObjectType.ts(6,25): error TS2693: 'string' only refers to a type, but is being used as a value here. classExtendsEveryObjectType.ts(6,31): error TS1005: ',' expected. classExtendsEveryObjectType.ts(8,18): error TS2507: Type '{ foo: string; }' is not a constructor function type. +classExtendsEveryObjectType.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. classExtendsEveryObjectType.ts(11,18): error TS2507: Type 'typeof M' is not a constructor function type. classExtendsEveryObjectType.ts(14,18): error TS2507: Type '() => void' is not a constructor function type. classExtendsEveryObjectType.ts(16,18): error TS2507: Type 'undefined[]' is not a constructor function type. -==== classExtendsEveryObjectType.ts (8 errors) ==== +==== classExtendsEveryObjectType.ts (9 errors) ==== interface I { foo: string; } @@ -29,6 +30,8 @@ classExtendsEveryObjectType.ts(16,18): error TS2507: Type 'undefined[]' is not a !!! error TS2507: Type '{ foo: string; }' is not a constructor function type. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C4 extends M { } // error ~ !!! error TS2507: Type 'typeof M' is not a constructor function type. diff --git a/tests/baselines/reference/classTypeParametersInStatics.errors.txt b/tests/baselines/reference/classTypeParametersInStatics.errors.txt index 1f86d11c6cd..23fdbd2f6f3 100644 --- a/tests/baselines/reference/classTypeParametersInStatics.errors.txt +++ b/tests/baselines/reference/classTypeParametersInStatics.errors.txt @@ -1,10 +1,13 @@ +classTypeParametersInStatics.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. classTypeParametersInStatics.ts(12,40): error TS2302: Static members cannot reference class type parameters. classTypeParametersInStatics.ts(13,29): error TS2302: Static members cannot reference class type parameters. classTypeParametersInStatics.ts(13,43): error TS2302: Static members cannot reference class type parameters. -==== classTypeParametersInStatics.ts (3 errors) ==== +==== classTypeParametersInStatics.ts (4 errors) ==== module Editor { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class List { diff --git a/tests/baselines/reference/classdecl.errors.txt b/tests/baselines/reference/classdecl.errors.txt new file mode 100644 index 00000000000..fb901836fe2 --- /dev/null +++ b/tests/baselines/reference/classdecl.errors.txt @@ -0,0 +1,105 @@ +classdecl.ts(39,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +classdecl.ts(50,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +classdecl.ts(52,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== classdecl.ts (3 errors) ==== + class a { + //constructor (); + constructor (n: number); + constructor (s: string); + constructor (ns: any) { + + } + + public pgF() { } + + public pv; + public get d() { + return 30; + } + public set d(a: number) { + } + + public static get p2() { + return { x: 30, y: 40 }; + } + + private static d2() { + } + private static get p3() { + return "string"; + } + private pv3; + + private foo(n: number): string; + private foo(s: string): string; + private foo(ns: any) { + return ns.toString(); + } + } + + class b extends a { + } + + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class b { + } + class d { + } + + + export interface ib { + } + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c extends b { + } + export class ib2 implements m1.ib { + } + } + } + + class c extends m1.b { + } + + class ib2 implements m1.ib { + } + + declare class aAmbient { + constructor (n: number); + constructor (s: string); + public pgF(): void; + public pv; + public d : number; + static p2 : { x: number; y: number; }; + static d2(); + static p3; + private pv3; + private foo(s); + } + + class d { + private foo(n: number): string; + private foo(s: string): string; + private foo(ns: any) { + return ns.toString(); + } + } + + class e { + private foo(s: string): string; + private foo(n: number): string; + private foo(ns: any) { + return ns.toString(); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/classdecl.types b/tests/baselines/reference/classdecl.types index 51fb325e330..7c0c8ea1095 100644 --- a/tests/baselines/reference/classdecl.types +++ b/tests/baselines/reference/classdecl.types @@ -16,6 +16,7 @@ class a { constructor (ns: any) { >ns : any +> : ^^^ } @@ -25,6 +26,7 @@ class a { public pv; >pv : any +> : ^^^ public get d() { >d : number @@ -72,6 +74,7 @@ class a { } private pv3; >pv3 : any +> : ^^^ private foo(n: number): string; >foo : { (n: number): string; (s: string): string; } @@ -89,10 +92,13 @@ class a { >foo : { (n: number): string; (s: string): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >ns : any +> : ^^^ return ns.toString(); >ns.toString() : any +> : ^^^ >ns.toString : any +> : ^^^ >ns : any > : ^^^ >toString : any @@ -184,6 +190,7 @@ declare class aAmbient { public pv; >pv : any +> : ^^^ public d : number; >d : number @@ -203,14 +210,17 @@ declare class aAmbient { static p3; >p3 : any +> : ^^^ private pv3; >pv3 : any +> : ^^^ private foo(s); >foo : (s: any) => any > : ^ ^^^^^^^^^^^^^ >s : any +> : ^^^ } class d { @@ -233,10 +243,13 @@ class d { >foo : { (n: number): string; (s: string): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >ns : any +> : ^^^ return ns.toString(); >ns.toString() : any +> : ^^^ >ns.toString : any +> : ^^^ >ns : any > : ^^^ >toString : any @@ -264,10 +277,13 @@ class e { >foo : { (s: string): string; (n: number): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >ns : any +> : ^^^ return ns.toString(); >ns.toString() : any +> : ^^^ >ns.toString : any +> : ^^^ >ns : any > : ^^^ >toString : any diff --git a/tests/baselines/reference/clinterfaces.errors.txt b/tests/baselines/reference/clinterfaces.errors.txt new file mode 100644 index 00000000000..fbd4fdf7843 --- /dev/null +++ b/tests/baselines/reference/clinterfaces.errors.txt @@ -0,0 +1,31 @@ +clinterfaces.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== clinterfaces.ts (1 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class C { } + interface C { } + interface D { } + class D { } + } + + interface Foo { + a: string; + } + + class Foo{ + b: number; + } + + class Bar{ + b: number; + } + + interface Bar { + a: string; + } + + export = Foo; + \ No newline at end of file diff --git a/tests/baselines/reference/cloduleTest1.errors.txt b/tests/baselines/reference/cloduleTest1.errors.txt new file mode 100644 index 00000000000..c5abbc1e4a5 --- /dev/null +++ b/tests/baselines/reference/cloduleTest1.errors.txt @@ -0,0 +1,17 @@ +cloduleTest1.ts(5,3): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== cloduleTest1.ts (1 errors) ==== + declare function $(selector: string): $; + interface $ { + addClass(className: string): $; + } + module $ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface AjaxSettings { + } + export function ajax(options: AjaxSettings) { } + } + var it: $ = $('.foo').addClass('bar'); + \ No newline at end of file diff --git a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt index 22851740d13..18e9bdb4274 100644 --- a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt +++ b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt @@ -1,9 +1,13 @@ +cloduleWithPriorInstantiatedModule.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +cloduleWithPriorInstantiatedModule.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== cloduleWithPriorInstantiatedModule.ts (1 errors) ==== +==== cloduleWithPriorInstantiatedModule.ts (3 errors) ==== // Non-ambient & instantiated module. module Moclodule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~~~~~~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export interface Someinterface { @@ -17,6 +21,8 @@ cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A namespace declaratio // Instantiated module. module Moclodule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Manager { } } \ No newline at end of file diff --git a/tests/baselines/reference/clodulesDerivedClasses.errors.txt b/tests/baselines/reference/clodulesDerivedClasses.errors.txt index 416a7bba148..6ac63e7c88b 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.errors.txt +++ b/tests/baselines/reference/clodulesDerivedClasses.errors.txt @@ -1,14 +1,22 @@ +clodulesDerivedClasses.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +clodulesDerivedClasses.ts(5,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. clodulesDerivedClasses.ts(9,7): error TS2417: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape'. Types of property 'Utils' are incompatible. Property 'convert' is missing in type 'typeof Path.Utils' but required in type 'typeof Shape.Utils'. +clodulesDerivedClasses.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +clodulesDerivedClasses.ts(14,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== clodulesDerivedClasses.ts (1 errors) ==== +==== clodulesDerivedClasses.ts (5 errors) ==== class Shape { id: number; } module Shape.Utils { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function convert(): Shape { return null;} } @@ -23,6 +31,10 @@ clodulesDerivedClasses.ts(9,7): error TS2417: Class static side 'typeof Path' in } module Path.Utils { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function convert2(): Path { return null; } diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.errors.txt b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.errors.txt new file mode 100644 index 00000000000..8fb4b71cb56 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.errors.txt @@ -0,0 +1,35 @@ +collisionCodeGenModuleWithConstructorChildren.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionCodeGenModuleWithConstructorChildren.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionCodeGenModuleWithConstructorChildren.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionCodeGenModuleWithConstructorChildren.ts (3 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 3; + class c { + constructor(M, p = x) { + } + } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class d { + constructor(private M, p = x) { + } + } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class d2 { + constructor() { + var M = 10; + var p = x; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types index 1f34f6bd21a..df5d32e8db9 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.types @@ -17,6 +17,7 @@ module M { constructor(M, p = x) { >M : any +> : ^^^ >p : number > : ^^^^^^ >x : number @@ -35,6 +36,7 @@ module M { constructor(private M, p = x) { >M : any +> : ^^^ >p : number > : ^^^^^^ >x : number diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.errors.txt b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.errors.txt new file mode 100644 index 00000000000..0a81b17d027 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.errors.txt @@ -0,0 +1,31 @@ +collisionCodeGenModuleWithFunctionChildren.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionCodeGenModuleWithFunctionChildren.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionCodeGenModuleWithFunctionChildren.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionCodeGenModuleWithFunctionChildren.ts (3 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 3; + function fn(M, p = x) { } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function fn2() { + var M; + var p = x; + } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function fn3() { + function M() { + var p = x; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types index 9e0e58bacdd..7fc42d5f52a 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.types @@ -15,6 +15,7 @@ module M { >fn : (M: any, p?: number) => void > : ^ ^^^^^^^ ^^^^^^^^^^^^^^^^^^ >M : any +> : ^^^ >p : number > : ^^^^^^ >x : number @@ -31,6 +32,7 @@ module M { var M; >M : any +> : ^^^ var p = x; >p : number diff --git a/tests/baselines/reference/collisionExportsRequireAndAmbientEnum.errors.txt b/tests/baselines/reference/collisionExportsRequireAndAmbientEnum.errors.txt new file mode 100644 index 00000000000..48eb9846704 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndAmbientEnum.errors.txt @@ -0,0 +1,73 @@ +collisionExportsRequireAndAmbientEnum_externalmodule.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientEnum_externalmodule.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientEnum_globalFile.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientEnum_globalFile.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndAmbientEnum_externalmodule.ts (2 errors) ==== + export declare enum require { + _thisVal1, + _thisVal2, + } + export declare enum exports { + _thisVal1, + _thisVal2, + } + declare module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + enum require { + _thisVal1, + _thisVal2, + } + enum exports { + _thisVal1, + _thisVal2, + } + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare enum require { + _thisVal1, + _thisVal2, + } + export declare enum exports { + _thisVal1, + _thisVal2, + } + } + +==== collisionExportsRequireAndAmbientEnum_globalFile.ts (2 errors) ==== + declare enum require { + _thisVal1, + _thisVal2, + } + declare enum exports { + _thisVal1, + _thisVal2, + } + declare module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + enum require { + _thisVal1, + _thisVal2, + } + enum exports { + _thisVal1, + _thisVal2, + } + } + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare enum require { + _thisVal1, + _thisVal2, + } + export declare enum exports { + _thisVal1, + _thisVal2, + } + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndAmbientFunction.errors.txt b/tests/baselines/reference/collisionExportsRequireAndAmbientFunction.errors.txt new file mode 100644 index 00000000000..ba056b13de1 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndAmbientFunction.errors.txt @@ -0,0 +1,22 @@ +collisionExportsRequireAndAmbientFunction.ts(5,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientFunction.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndAmbientFunction.ts (2 errors) ==== + export declare function exports(): number; + + export declare function require(): string[]; + + declare module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function exports(): string; + function require(): number; + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare function exports(): string; + export declare function require(): string[]; + var a = 10; + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndAmbientFunctionInGlobalFile.errors.txt b/tests/baselines/reference/collisionExportsRequireAndAmbientFunctionInGlobalFile.errors.txt new file mode 100644 index 00000000000..0b5a044386a --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndAmbientFunctionInGlobalFile.errors.txt @@ -0,0 +1,20 @@ +collisionExportsRequireAndAmbientFunctionInGlobalFile.ts(3,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientFunctionInGlobalFile.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndAmbientFunctionInGlobalFile.ts (2 errors) ==== + declare function exports(): number; + declare function require(): string; + declare module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function exports(): string[]; + function require(): number[]; + } + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare function exports(): string; + export declare function require(): string; + var a = 10; + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndAmbientModule.errors.txt b/tests/baselines/reference/collisionExportsRequireAndAmbientModule.errors.txt new file mode 100644 index 00000000000..f645cc36dc4 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndAmbientModule.errors.txt @@ -0,0 +1,143 @@ +collisionExportsRequireAndAmbientModule_externalmodule.ts(1,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(10,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(19,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(20,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(26,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(33,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(34,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_externalmodule.ts(40,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(7,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(13,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(14,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(20,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(27,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(28,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndAmbientModule_globalFile.ts(34,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndAmbientModule_externalmodule.ts (8 errors) ==== + export declare module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + export function foo(): require.I { + return null; + } + export declare module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + export function foo2(): exports.I { + return null; + } + declare module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + export declare module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + var a = 10; + } + +==== collisionExportsRequireAndAmbientModule_globalFile.ts (8 errors) ==== + declare module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + declare module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + declare module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + } + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export declare module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + export declare module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + export class C { + } + } + + var a = 10; + } + \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt b/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt index 37da5848b8d..f08b87c8401 100644 --- a/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndEnum.errors.txt @@ -1,8 +1,12 @@ collisionExportsRequireAndEnum_externalmodule.ts(1,13): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +collisionExportsRequireAndEnum_externalmodule.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndEnum_externalmodule.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndEnum_globalFile.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndEnum_globalFile.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== collisionExportsRequireAndEnum_externalmodule.ts (2 errors) ==== +==== collisionExportsRequireAndEnum_externalmodule.ts (4 errors) ==== export enum require { // Error ~~~~~~~ !!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. @@ -16,6 +20,8 @@ collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate _thisVal2, } module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum require { _thisVal1, _thisVal2, @@ -26,6 +32,8 @@ collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate } } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum require { _thisVal1, _thisVal2, @@ -36,7 +44,7 @@ collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate } } -==== collisionExportsRequireAndEnum_globalFile.ts (0 errors) ==== +==== collisionExportsRequireAndEnum_globalFile.ts (2 errors) ==== enum require { _thisVal1, _thisVal2, @@ -46,6 +54,8 @@ collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate _thisVal2, } module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enum require { _thisVal1, _thisVal2, @@ -56,6 +66,8 @@ collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate } } module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum require { _thisVal1, _thisVal2, diff --git a/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt b/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt index a5cf85435ca..dc96f069625 100644 --- a/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndFunction.errors.txt @@ -1,8 +1,10 @@ collisionExportsRequireAndFunction.ts(1,17): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. +collisionExportsRequireAndFunction.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndFunction.ts(15,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== collisionExportsRequireAndFunction.ts (2 errors) ==== +==== collisionExportsRequireAndFunction.ts (4 errors) ==== export function exports() { ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. @@ -14,6 +16,8 @@ collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier return "require"; } module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function exports() { return 1; } @@ -22,6 +26,8 @@ collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier } } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function exports() { return 1; } diff --git a/tests/baselines/reference/collisionExportsRequireAndFunctionInGlobalFile.errors.txt b/tests/baselines/reference/collisionExportsRequireAndFunctionInGlobalFile.errors.txt new file mode 100644 index 00000000000..497fb9a8fbd --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndFunctionInGlobalFile.errors.txt @@ -0,0 +1,31 @@ +collisionExportsRequireAndFunctionInGlobalFile.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndFunctionInGlobalFile.ts(15,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndFunctionInGlobalFile.ts (2 errors) ==== + function exports() { + return 1; + } + function require() { + return "require"; + } + module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function exports() { + return 1; + } + function require() { + return "require"; + } + } + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function exports() { + return 1; + } + export function require() { + return "require"; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt b/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt index 25e9a3c14a1..491e128db2d 100644 --- a/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndInternalModuleAlias.errors.txt @@ -1,9 +1,14 @@ +collisionExportsRequireAndInternalModuleAlias.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. collisionExportsRequireAndInternalModuleAlias.ts(5,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. +collisionExportsRequireAndInternalModuleAlias.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndInternalModuleAlias.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== collisionExportsRequireAndInternalModuleAlias.ts (2 errors) ==== +==== collisionExportsRequireAndInternalModuleAlias.ts (5 errors) ==== export module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c { } } @@ -17,6 +22,8 @@ collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate i new require(); module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import exports = m.c; import require = m.c; new exports(); @@ -24,6 +31,8 @@ collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate i } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export import exports = m.c; export import require = m.c; new exports(); diff --git a/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt b/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt index be62e07875d..30ca5a455b3 100644 --- a/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt +++ b/tests/baselines/reference/collisionExportsRequireAndModule.errors.txt @@ -1,9 +1,27 @@ +collisionExportsRequireAndModule_externalmodule.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. collisionExportsRequireAndModule_externalmodule.ts(1,15): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. +collisionExportsRequireAndModule_externalmodule.ts(10,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +collisionExportsRequireAndModule_externalmodule.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_externalmodule.ts(20,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_externalmodule.ts(26,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_externalmodule.ts(33,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_externalmodule.ts(34,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_externalmodule.ts(40,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(14,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(20,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(27,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(28,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndModule_globalFile.ts(34,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== collisionExportsRequireAndModule_externalmodule.ts (2 errors) ==== +==== collisionExportsRequireAndModule_externalmodule.ts (10 errors) ==== export module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~~~~ !!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. export interface I { @@ -15,6 +33,8 @@ collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplica return null; } export module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. export interface I { @@ -26,13 +46,19 @@ collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplica return null; } module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { @@ -40,13 +66,19 @@ collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplica } } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } export module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { @@ -54,27 +86,37 @@ collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplica } } -==== collisionExportsRequireAndModule_globalFile.ts (0 errors) ==== +==== collisionExportsRequireAndModule_globalFile.ts (8 errors) ==== module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { @@ -82,13 +124,19 @@ collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplica } } module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module require { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { } } export module exports { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { } export class C { diff --git a/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.errors.txt b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.errors.txt new file mode 100644 index 00000000000..af14a1c10d6 --- /dev/null +++ b/tests/baselines/reference/collisionExportsRequireAndUninstantiatedModule.errors.txt @@ -0,0 +1,23 @@ +collisionExportsRequireAndUninstantiatedModule.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +collisionExportsRequireAndUninstantiatedModule.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== collisionExportsRequireAndUninstantiatedModule.ts (2 errors) ==== + export module require { // no error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + } + export function foo(): require.I { + return null; + } + export module exports { // no error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + } + } + export function foo2(): exports.I { + return null; + } \ No newline at end of file diff --git a/tests/baselines/reference/commentOnAmbientModule.errors.txt b/tests/baselines/reference/commentOnAmbientModule.errors.txt new file mode 100644 index 00000000000..d76928e347b --- /dev/null +++ b/tests/baselines/reference/commentOnAmbientModule.errors.txt @@ -0,0 +1,34 @@ +a.ts(7,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +a.ts(12,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +b.ts(2,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== b.ts (1 errors) ==== + /// + declare module E { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class foobar extends D.bar { + foo(); + } + } +==== a.ts (2 errors) ==== + /*!========= + Keep this pinned comment + ========= + */ + + /*! Don't keep this pinned comment */ + declare module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo(); + } + + // Don't keep this comment. + declare module D { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class bar { } + } + \ No newline at end of file diff --git a/tests/baselines/reference/commentOnElidedModule1.errors.txt b/tests/baselines/reference/commentOnElidedModule1.errors.txt new file mode 100644 index 00000000000..ba89ef34f55 --- /dev/null +++ b/tests/baselines/reference/commentOnElidedModule1.errors.txt @@ -0,0 +1,29 @@ +a.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +a.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +b.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== b.ts (1 errors) ==== + /// + module ElidedModule3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } +==== a.ts (2 errors) ==== + /*!================= + Keep this pinned + ================= + */ + + /*! Don't keep this pinned comment */ + module ElidedModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + + // Don't keep this comment. + module ElidedModule2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + \ No newline at end of file diff --git a/tests/baselines/reference/commentsExternalModules.errors.txt b/tests/baselines/reference/commentsExternalModules.errors.txt new file mode 100644 index 00000000000..1cd65a4cfa8 --- /dev/null +++ b/tests/baselines/reference/commentsExternalModules.errors.txt @@ -0,0 +1,73 @@ +commentsExternalModules_0.ts(2,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules_0.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules_0.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules_0.ts(36,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsExternalModules_1.ts (0 errors) ==== + /**This is on import declaration*/ + import extMod = require("commentsExternalModules_0"); // trailing comment1 + extMod.m1.fooExport(); + var newVar = new extMod.m1.m2.c(); + extMod.m4.fooExport(); + var newVar2 = new extMod.m4.m2.c(); + +==== commentsExternalModules_0.ts (4 errors) ==== + /** Module comment*/ + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment*/ + export var b: number; + /** foo's comment*/ + function foo() { + return b; + } + /** m2 comments*/ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment;*/ + export class c { + }; + /** i*/ + export var i = new c(); + } + /** exported function*/ + export function fooExport() { + return foo(); + } + } + m1.fooExport(); + var myvar = new m1.m2.c(); + + /** Module comment */ + export module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment */ + export var b: number; + /** foo's comment + */ + function foo() { + return b; + } + /** m2 comments + */ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment; */ + export class c { + }; + /** i */ + export var i = new c(); + } + /** exported function */ + export function fooExport() { + return foo(); + } + } + m4.fooExport(); + var myvar2 = new m4.m2.c(); + \ No newline at end of file diff --git a/tests/baselines/reference/commentsExternalModules2.errors.txt b/tests/baselines/reference/commentsExternalModules2.errors.txt new file mode 100644 index 00000000000..994c2e8f835 --- /dev/null +++ b/tests/baselines/reference/commentsExternalModules2.errors.txt @@ -0,0 +1,73 @@ +commentsExternalModules2_0.ts(2,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(36,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsExternalModules_1.ts (0 errors) ==== + /**This is on import declaration*/ + import extMod = require("commentsExternalModules2_0"); // trailing comment 1 + extMod.m1.fooExport(); + export var newVar = new extMod.m1.m2.c(); + extMod.m4.fooExport(); + export var newVar2 = new extMod.m4.m2.c(); + +==== commentsExternalModules2_0.ts (4 errors) ==== + /** Module comment*/ + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment*/ + export var b: number; + /** foo's comment*/ + function foo() { + return b; + } + /** m2 comments*/ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment;*/ + export class c { + }; + /** i*/ + export var i = new c(); + } + /** exported function*/ + export function fooExport() { + return foo(); + } + } + m1.fooExport(); + var myvar = new m1.m2.c(); + + /** Module comment */ + export module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment */ + export var b: number; + /** foo's comment + */ + function foo() { + return b; + } + /** m2 comments + */ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment; */ + export class c { + }; + /** i */ + export var i = new c(); + } + /** exported function */ + export function fooExport() { + return foo(); + } + } + m4.fooExport(); + var myvar2 = new m4.m2.c(); + \ No newline at end of file diff --git a/tests/baselines/reference/commentsExternalModules3.errors.txt b/tests/baselines/reference/commentsExternalModules3.errors.txt new file mode 100644 index 00000000000..06fba7b1646 --- /dev/null +++ b/tests/baselines/reference/commentsExternalModules3.errors.txt @@ -0,0 +1,73 @@ +commentsExternalModules2_0.ts(2,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsExternalModules2_0.ts(36,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsExternalModules_1.ts (0 errors) ==== + /**This is on import declaration*/ + import extMod = require("./commentsExternalModules2_0"); // trailing comment 1 + extMod.m1.fooExport(); + export var newVar = new extMod.m1.m2.c(); + extMod.m4.fooExport(); + export var newVar2 = new extMod.m4.m2.c(); + +==== commentsExternalModules2_0.ts (4 errors) ==== + /** Module comment*/ + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment*/ + export var b: number; + /** foo's comment*/ + function foo() { + return b; + } + /** m2 comments*/ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment;*/ + export class c { + }; + /** i*/ + export var i = new c(); + } + /** exported function*/ + export function fooExport() { + return foo(); + } + } + m1.fooExport(); + var myvar = new m1.m2.c(); + + /** Module comment */ + export module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment */ + export var b: number; + /** foo's comment + */ + function foo() { + return b; + } + /** m2 comments + */ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment; */ + export class c { + }; + /** i */ + export var i = new c(); + } + /** exported function */ + export function fooExport() { + return foo(); + } + } + m4.fooExport(); + var myvar2 = new m4.m2.c(); + \ No newline at end of file diff --git a/tests/baselines/reference/commentsFormatting.errors.txt b/tests/baselines/reference/commentsFormatting.errors.txt new file mode 100644 index 00000000000..e22e71c3166 --- /dev/null +++ b/tests/baselines/reference/commentsFormatting.errors.txt @@ -0,0 +1,91 @@ +commentsFormatting.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsFormatting.ts (1 errors) ==== + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** this is first line - aligned to class declaration + * this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c { + } + + /** this is first line - 4 spaces right aligned to class but in js file should be aligned to class declaration + * this is 8 spaces left aligned + * this is 7 spaces left aligned + * this is 6 spaces left aligned + * this is 5 spaces left aligned + * this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c2 { + } + + /** this is comment with new lines in between + + this is 4 spaces left aligned but above line is empty + + this is 3 spaces left aligned but above line is empty + + this is 2 spaces left aligned but above line is empty + + this is 1 spaces left aligned but above line is empty + + this is at same level as first line but above line is empty + + this is 1 spaces right aligned but above line is empty + + this is 2 spaces right aligned but above line is empty + + this is 3 spaces right aligned but above line is empty + + this is 4 spaces right aligned but above line is empty + + + Above 2 lines are empty + + + + above 3 lines are empty*/ + export class c3 { + } + + /** this is first line - aligned to class declaration + * this is 0 space + tab + * this is 1 space + tab + * this is 2 spaces + tab + * this is 3 spaces + tab + * this is 4 spaces + tab + * this is 5 spaces + tab + * this is 6 spaces + tab + * this is 7 spaces + tab + * this is 8 spaces + tab + * this is 9 spaces + tab + * this is 10 spaces + tab + * this is 11 spaces + tab + * this is 12 spaces + tab */ + export class c4 { + } + } \ No newline at end of file diff --git a/tests/baselines/reference/commentsModules.errors.txt b/tests/baselines/reference/commentsModules.errors.txt new file mode 100644 index 00000000000..022b786100b --- /dev/null +++ b/tests/baselines/reference/commentsModules.errors.txt @@ -0,0 +1,163 @@ +commentsModules.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(41,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(41,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(48,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(48,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(48,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(55,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(55,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(55,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(56,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(64,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(64,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(64,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(66,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(73,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(73,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(74,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(81,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(81,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsModules.ts(83,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsModules.ts (21 errors) ==== + /** Module comment*/ + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** b's comment*/ + export var b: number; + /** foo's comment*/ + function foo() { + return b; + } + /** m2 comments*/ + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class comment;*/ + export class c { + }; + /** i*/ + export var i = new c(); + } + /** exported function*/ + export function fooExport() { + return foo(); + } + + // shouldn't appear + export function foo2Export(/**hm*/ a: string) { + } + + /** foo3Export + * comment + */ + export function foo3Export() { + } + + /** foo4Export + * comment + */ + function foo4Export() { + } + } // trailing comment module + m1.fooExport(); + var myvar = new m1.m2.c(); + /** module comment of m2.m3*/ + module m2.m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + } /* trailing dotted module comment*/ + new m2.m3.c(); + /** module comment of m3.m4.m5*/ + module m3.m4.m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + } // trailing dotted module 2 + new m3.m4.m5.c(); + /** module comment of m4.m5.m6*/ + module m4.m5.m6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + } /* trailing inner module */ /* multiple comments*/ + } + new m4.m5.m6.m7.c(); + /** module comment of m5.m6.m7*/ + module m5.m6.m7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** module m8 comment*/ + export module m8 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + } + } + new m5.m6.m7.m8.c(); + module m6.m7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m8 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + } + } + new m6.m7.m8.c(); + module m7.m8 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** module m9 comment*/ + export module m9 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** Exported class comment*/ + export class c { + } + + /** class d */ + class d { + } + + // class e + export class e { + } + } + } + new m7.m8.m9.c(); \ No newline at end of file diff --git a/tests/baselines/reference/commentsdoNotEmitComments.errors.txt b/tests/baselines/reference/commentsdoNotEmitComments.errors.txt new file mode 100644 index 00000000000..8015f9af8f2 --- /dev/null +++ b/tests/baselines/reference/commentsdoNotEmitComments.errors.txt @@ -0,0 +1,101 @@ +commentsdoNotEmitComments.ts(72,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsdoNotEmitComments.ts(81,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsdoNotEmitComments.ts (2 errors) ==== + /** Variable comments*/ + var myVariable = 10; + + /** function comments*/ + function foo(/** parameter comment*/p: number) { + } + + /** variable with function type comment*/ + var fooVar: () => void; + foo(50); + fooVar(); + + /**class comment*/ + class c { + /** constructor comment*/ + constructor() { + } + + /** property comment */ + public b = 10; + + /** function comment */ + public myFoo() { + return this.b; + } + + /** getter comment*/ + public get prop1() { + return this.b; + } + + /** setter comment*/ + public set prop1(val: number) { + this.b = val; + } + + /** overload signature1*/ + public foo1(a: number): string; + /** Overload signature 2*/ + public foo1(b: string): string; + /** overload implementation signature*/ + public foo1(aOrb) { + return aOrb.toString(); + } + } + + /**instance comment*/ + var i = new c(); + + /** interface comments*/ + interface i1 { + /** caller comments*/ + (a: number): number; + + /** new comments*/ + new (b: string); + + /**indexer property*/ + [a: number]: string; + + /** function property;*/ + myFoo(/*param prop*/a: number): string; + + /** prop*/ + prop: string; + } + + /**interface instance comments*/ + var i1_i: i1; + + /** this is module comment*/ + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class b */ + export class b { + constructor(public x: number) { + + } + } + + /// module m2 + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + } + + /// this is x + declare var x; + + + /** const enum member value comment (generated by TS) */ + const enum color { red, green, blue } + var shade: color = color.green; + \ No newline at end of file diff --git a/tests/baselines/reference/commentsdoNotEmitComments.types b/tests/baselines/reference/commentsdoNotEmitComments.types index 2a976739e0d..c062b0c1b91 100644 --- a/tests/baselines/reference/commentsdoNotEmitComments.types +++ b/tests/baselines/reference/commentsdoNotEmitComments.types @@ -118,10 +118,13 @@ class c { >foo1 : { (a: number): string; (b: string): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >aOrb : any +> : ^^^ return aOrb.toString(); >aOrb.toString() : any +> : ^^^ >aOrb.toString : any +> : ^^^ >aOrb : any > : ^^^ >toString : any @@ -198,6 +201,7 @@ module m1 { /// this is x declare var x; >x : any +> : ^^^ /** const enum member value comment (generated by TS) */ diff --git a/tests/baselines/reference/commentsemitComments.errors.txt b/tests/baselines/reference/commentsemitComments.errors.txt new file mode 100644 index 00000000000..a74235e33f6 --- /dev/null +++ b/tests/baselines/reference/commentsemitComments.errors.txt @@ -0,0 +1,96 @@ +commentsemitComments.ts(72,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +commentsemitComments.ts(81,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== commentsemitComments.ts (2 errors) ==== + /** Variable comments*/ + var myVariable = 10; + + /** function comments*/ + function foo(/** parameter comment*/p: number) { + } + + /** variable with function type comment*/ + var fooVar: () => void; + foo(50); + fooVar(); + + /**class comment*/ + class c { + /** constructor comment*/ + constructor() { + } + + /** property comment */ + public b = 10; + + /** function comment */ + public myFoo() { + return this.b; + } + + /** getter comment*/ + public get prop1() { + return this.b; + } + + /** setter comment*/ + public set prop1(val: number) { + this.b = val; + } + + /** overload signature1*/ + public foo1(a: number): string; + /** Overload signature 2*/ + public foo1(b: string): string; + /** overload implementation signature*/ + public foo1(aOrb) { + return aOrb.toString(); + } + } + + /**instance comment*/ + var i = new c(); + + /** interface comments*/ + interface i1 { + /** caller comments*/ + (a: number): number; + + /** new comments*/ + new (b: string); + + /**indexer property*/ + [a: number]: string; + + /** function property;*/ + myFoo(/*param prop*/a: number): string; + + /** prop*/ + prop: string; + } + + /**interface instance comments*/ + var i1_i: i1; + + /** this is module comment*/ + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + /** class b */ + export class b { + constructor(public x: number) { + + } + } + + /// module m2 + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + } + + /// this is x + declare var x; + \ No newline at end of file diff --git a/tests/baselines/reference/commentsemitComments.types b/tests/baselines/reference/commentsemitComments.types index e9736dd5447..7137249b4bf 100644 --- a/tests/baselines/reference/commentsemitComments.types +++ b/tests/baselines/reference/commentsemitComments.types @@ -118,10 +118,13 @@ class c { >foo1 : { (a: number): string; (b: string): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >aOrb : any +> : ^^^ return aOrb.toString(); >aOrb.toString() : any +> : ^^^ >aOrb.toString : any +> : ^^^ >aOrb : any > : ^^^ >toString : any @@ -198,4 +201,5 @@ module m1 { /// this is x declare var x; >x : any +> : ^^^ diff --git a/tests/baselines/reference/complexRecursiveCollections.errors.txt b/tests/baselines/reference/complexRecursiveCollections.errors.txt index 3f51359243a..fc50790b03b 100644 --- a/tests/baselines/reference/complexRecursiveCollections.errors.txt +++ b/tests/baselines/reference/complexRecursiveCollections.errors.txt @@ -1,11 +1,27 @@ +immutable.ts(4,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(19,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(64,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(110,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(129,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(161,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(182,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(213,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(262,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(265,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(283,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(299,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(333,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +immutable.ts(338,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. immutable.ts(341,22): error TS2430: Interface 'Keyed' incorrectly extends interface 'Collection'. The types returned by 'toSeq()' are incompatible between these types. Type 'Keyed' is not assignable to type 'this'. 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. +immutable.ts(357,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. immutable.ts(359,22): error TS2430: Interface 'Indexed' incorrectly extends interface 'Collection'. The types returned by 'toSeq()' are incompatible between these types. Type 'Indexed' is not assignable to type 'this'. 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. +immutable.ts(389,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends interface 'Collection'. The types returned by 'toSeq()' are incompatible between these types. Type 'Set' is not assignable to type 'this'. @@ -33,11 +49,13 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter flatMap(mapper: (value: T, key: void, iter: this) => Ara, context?: any): N2; toSeq(): N2; } -==== immutable.ts (3 errors) ==== +==== immutable.ts (19 errors) ==== // Test that complex recursive collections can pass the `extends` assignability check without // running out of memory. This bug was exposed in Typescript 2.4 when more generic signatures // started being checked. declare module Immutable { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function fromJS(jsValue: any, reviver?: (key: string | number, sequence: Collection.Keyed | Collection.Indexed, path?: Array) => any): any; export function is(first: any, second: any): boolean; export function hash(value: any): number; @@ -53,6 +71,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter hashCode(): number; } export module List { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isList(maybeList: any): maybeList is List; function of(...values: Array): List; } @@ -98,6 +118,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: T, index: number, iter: this) => any, context?: any): this; } export module Map { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isMap(maybeMap: any): maybeMap is Map; function of(...keyValues: Array): Map; } @@ -144,6 +166,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: V, key: K, iter: this) => any, context?: any): this; } export module OrderedMap { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap; } export function OrderedMap(collection: Iterable<[K, V]>): OrderedMap; @@ -163,6 +187,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: V, key: K, iter: this) => any, context?: any): this; } export module Set { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isSet(maybeSet: any): maybeSet is Set; function of(...values: Array): Set; function fromKeys(iter: Collection): Set; @@ -195,6 +221,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: T, key: never, iter: this) => any, context?: any): this; } export module OrderedSet { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isOrderedSet(maybeOrderedSet: any): boolean; function of(...values: Array): OrderedSet; function fromKeys(iter: Collection): OrderedSet; @@ -216,6 +244,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter zipWith(zipper: (...any: Array) => Z, ...collections: Array>): OrderedSet; } export module Stack { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isStack(maybeStack: any): maybeStack is Stack; function of(...values: Array): Stack; } @@ -247,6 +277,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter export function Range(start?: number, end?: number, step?: number): Seq.Indexed; export function Repeat(value: T, times?: number): Seq.Indexed; export module Record { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function isRecord(maybeRecord: any): maybeRecord is Record.Instance; export function getDescriptiveName(record: Instance): string; export interface Class { @@ -296,9 +328,13 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter } export function Record(defaultValues: T, name?: string): Record.Class; export module Seq { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed; function of(...values: Array): Seq.Indexed; export module Keyed {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function Keyed(collection: Iterable<[K, V]>): Seq.Keyed; export function Keyed(obj: {[key: string]: V}): Seq.Keyed; export function Keyed(): Seq.Keyed; @@ -317,6 +353,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: V, key: K, iter: this) => any, context?: any): this; } module Indexed { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function of(...values: Array): Seq.Indexed; } export function Indexed(): Seq.Indexed; @@ -333,6 +371,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: T, index: number, iter: this) => any, context?: any): this; } export module Set { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function of(...values: Array): Seq.Set; } export function Set(): Seq.Set; @@ -367,11 +407,15 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter filter(predicate: (value: V, key: K, iter: this) => any, context?: any): this; } export module Collection { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function isKeyed(maybeKeyed: any): maybeKeyed is Collection.Keyed; function isIndexed(maybeIndexed: any): maybeIndexed is Collection.Indexed; function isAssociative(maybeAssociative: any): maybeAssociative is Collection.Keyed | Collection.Indexed; function isOrdered(maybeOrdered: any): boolean; export module Keyed {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function Keyed(collection: Iterable<[K, V]>): Collection.Keyed; export function Keyed(obj: {[key: string]: V}): Collection.Keyed; export interface Keyed extends Collection { @@ -396,6 +440,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter [Symbol.iterator](): IterableIterator<[K, V]>; } export module Indexed {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function Indexed(collection: Iterable): Collection.Indexed; export interface Indexed extends Collection { ~~~~~~~ @@ -433,6 +479,8 @@ immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends inter [Symbol.iterator](): IterableIterator; } export module Set {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function Set(collection: Iterable): Collection.Set; export interface Set extends Collection { ~~~ diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt index 0131f5117a6..1a9ceb00f95 100644 --- a/tests/baselines/reference/complicatedPrivacy.errors.txt +++ b/tests/baselines/reference/complicatedPrivacy.errors.txt @@ -1,11 +1,24 @@ +complicatedPrivacy.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters. complicatedPrivacy.ts(35,6): error TS2693: 'number' only refers to a type, but is being used as a value here. +complicatedPrivacy.ts(44,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(70,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(71,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported member 'i6'. +complicatedPrivacy.ts(79,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(82,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(84,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +complicatedPrivacy.ts(95,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== complicatedPrivacy.ts (3 errors) ==== +==== complicatedPrivacy.ts (12 errors) ==== module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function f1(c1: C1) { @@ -52,6 +65,8 @@ complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported me }) { } module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function f2(f1: C1) { } @@ -78,7 +93,11 @@ complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported me } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c_pr implements mglo5.i5, mglo5.i6 { ~~ @@ -89,11 +108,17 @@ complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported me } module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C { } module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function f1() { return new C(); } @@ -105,6 +130,8 @@ complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported me } module mglo5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface i5 { f1(): string; } diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt index 336d069206d..f3f9591e2ed 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt @@ -8,6 +8,7 @@ compoundAssignmentLHSIsValue.ts(21,5): error TS2364: The left-hand side of an as compoundAssignmentLHSIsValue.ts(22,5): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. compoundAssignmentLHSIsValue.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. compoundAssignmentLHSIsValue.ts(26,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +compoundAssignmentLHSIsValue.ts(29,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. compoundAssignmentLHSIsValue.ts(30,1): error TS2631: Cannot assign to 'M' because it is a namespace. compoundAssignmentLHSIsValue.ts(31,1): error TS2631: Cannot assign to 'M' because it is a namespace. compoundAssignmentLHSIsValue.ts(33,1): error TS2629: Cannot assign to 'C' because it is a class. @@ -76,7 +77,7 @@ compoundAssignmentLHSIsValue.ts(121,1): error TS2362: The left-hand side of an a compoundAssignmentLHSIsValue.ts(122,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -==== compoundAssignmentLHSIsValue.ts (76 errors) ==== +==== compoundAssignmentLHSIsValue.ts (77 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value: any; @@ -126,6 +127,8 @@ compoundAssignmentLHSIsValue.ts(122,1): error TS2364: The left-hand side of an a // identifiers: module, class, enum, function module M { export var a; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M *= value; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt index cbb314d00cb..20e719e7591 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt @@ -3,6 +3,7 @@ compoundExponentiationAssignmentLHSIsValue.ts(10,9): error TS2362: The left-hand compoundExponentiationAssignmentLHSIsValue.ts(13,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. compoundExponentiationAssignmentLHSIsValue.ts(18,5): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. compoundExponentiationAssignmentLHSIsValue.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. +compoundExponentiationAssignmentLHSIsValue.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. compoundExponentiationAssignmentLHSIsValue.ts(25,1): error TS2631: Cannot assign to 'M' because it is a namespace. compoundExponentiationAssignmentLHSIsValue.ts(27,1): error TS2629: Cannot assign to 'C' because it is a class. compoundExponentiationAssignmentLHSIsValue.ts(30,1): error TS2628: Cannot assign to 'E' because it is an enum. @@ -39,7 +40,7 @@ compoundExponentiationAssignmentLHSIsValue.ts(84,1): error TS2362: The left-hand compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. -==== compoundExponentiationAssignmentLHSIsValue.ts (39 errors) ==== +==== compoundExponentiationAssignmentLHSIsValue.ts (40 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value: any; @@ -74,6 +75,8 @@ compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand // identifiers: module, class, enum, function module M { export var a; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M **= value; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/constDeclarations-ambient-errors.errors.txt b/tests/baselines/reference/constDeclarations-ambient-errors.errors.txt index c9aa3973717..1a64f82586f 100644 --- a/tests/baselines/reference/constDeclarations-ambient-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-ambient-errors.errors.txt @@ -3,10 +3,11 @@ constDeclarations-ambient-errors.ts(3,28): error TS1039: Initializers are not al constDeclarations-ambient-errors.ts(4,20): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference. constDeclarations-ambient-errors.ts(4,39): error TS1039: Initializers are not allowed in ambient contexts. constDeclarations-ambient-errors.ts(4,53): error TS1039: Initializers are not allowed in ambient contexts. +constDeclarations-ambient-errors.ts(6,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constDeclarations-ambient-errors.ts(8,24): error TS1039: Initializers are not allowed in ambient contexts. -==== constDeclarations-ambient-errors.ts (6 errors) ==== +==== constDeclarations-ambient-errors.ts (7 errors) ==== // error: no intialization expected in ambient declarations declare const c1: boolean = true; ~~~~ @@ -23,6 +24,8 @@ constDeclarations-ambient-errors.ts(8,24): error TS1039: Initializers are not al !!! error TS1039: Initializers are not allowed in ambient contexts. declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. const c6 = 0; const c7: number = 7; ~ diff --git a/tests/baselines/reference/constDeclarations-scopes.errors.txt b/tests/baselines/reference/constDeclarations-scopes.errors.txt index 9e20946833e..e26ab430f50 100644 --- a/tests/baselines/reference/constDeclarations-scopes.errors.txt +++ b/tests/baselines/reference/constDeclarations-scopes.errors.txt @@ -1,7 +1,8 @@ constDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +constDeclarations-scopes.ts(102,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== constDeclarations-scopes.ts (1 errors) ==== +==== constDeclarations-scopes.ts (2 errors) ==== // global const c = "string"; @@ -106,6 +107,8 @@ constDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not sup // modules module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. const c = 0; n = c; diff --git a/tests/baselines/reference/constDeclarations-validContexts.errors.txt b/tests/baselines/reference/constDeclarations-validContexts.errors.txt index 35f0f8b7771..97fd770a31d 100644 --- a/tests/baselines/reference/constDeclarations-validContexts.errors.txt +++ b/tests/baselines/reference/constDeclarations-validContexts.errors.txt @@ -1,7 +1,8 @@ constDeclarations-validContexts.ts(18,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +constDeclarations-validContexts.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== constDeclarations-validContexts.ts (1 errors) ==== +==== constDeclarations-validContexts.ts (2 errors) ==== // Control flow statements with blocks if (true) { const c1 = 0; @@ -89,6 +90,8 @@ constDeclarations-validContexts.ts(18,1): error TS2410: The 'with' statement is // modules module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. const c22 = 0; { diff --git a/tests/baselines/reference/constEnums.errors.txt b/tests/baselines/reference/constEnums.errors.txt new file mode 100644 index 00000000000..b916ba10059 --- /dev/null +++ b/tests/baselines/reference/constEnums.errors.txt @@ -0,0 +1,220 @@ +constEnums.ts(50,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(51,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(52,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(61,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(62,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(63,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(72,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(73,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(74,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(83,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(84,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(85,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constEnums.ts(92,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== constEnums.ts (13 errors) ==== + const enum Enum1 { + A0 = 100, + } + + const enum Enum1 { + // correct cases + A, + B, + C = 10, + D = A | B, + E = A | 1, + F = 1 | A, + G = (1 & 1), + H = ~(A | B), + I = A >>> 1, + J = 1 & A, + K = ~(1 | 5), + L = ~D, + M = E << B, + N = E << 1, + O = E >> B, + P = E >> 1, + PQ = E ** 2, + Q = -D, + R = C & 5, + S = 5 & C, + T = C | D, + U = C | 1, + V = 10 | D, + W = Enum1.V, + + // correct cases: reference to the enum member from different enum declaration + W1 = A0, + W2 = Enum1.A0, + W3 = Enum1["A0"], + W4 = Enum1["W"], + W5 = Enum1[`V`], + } + + const enum Comments { + "//", + "/*", + "*/", + "///", + "#", + "", + } + + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum E { + V1 = 1, + V2 = A.B.C.E.V1 | 100 + } + } + } + } + + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum E { + V3 = A.B.C.E["V2"] & 200, + V4 = A.B.C.E[`V1`] << 1, + } + } + } + } + + module A1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum E { + V1 = 10, + V2 = 110, + } + } + } + } + + module A2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum E { + V1 = 10, + V2 = 110, + } + } + // module C will be classified as value + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x = 1 + } + } + } + + import I = A.B.C.E; + import I1 = A1.B; + import I2 = A2.B; + + function foo0(e: I): void { + if (e === I.V1) { + } + else if (e === I.V2) { + } + } + + function foo1(e: I1.C.E): void { + if (e === I1.C.E.V1) { + } + else if (e === I1.C.E.V2) { + } + } + + function foo2(e: I2.C.E): void { + if (e === I2.C.E.V1) { + } + else if (e === I2.C.E.V2) { + } + } + + + function foo(x: Enum1) { + switch (x) { + case Enum1.A: + case Enum1.B: + case Enum1.C: + case Enum1.D: + case Enum1.E: + case Enum1.F: + case Enum1.G: + case Enum1.H: + case Enum1.I: + case Enum1.J: + case Enum1.K: + case Enum1.L: + case Enum1.M: + case Enum1.N: + case Enum1.O: + case Enum1.P: + case Enum1.PQ: + case Enum1.Q: + case Enum1.R: + case Enum1.S: + case Enum1["T"]: + case Enum1[`U`]: + case Enum1.V: + case Enum1.W: + case Enum1.W1: + case Enum1.W2: + case Enum1.W3: + case Enum1.W4: + break; + } + } + + function bar(e: A.B.C.E): number { + switch (e) { + case A.B.C.E.V1: return 1; + case A.B.C.E.V2: return 1; + case A.B.C.E.V3: return 1; + } + } + + function baz(c: Comments) { + switch (c) { + case Comments["//"]: + case Comments["/*"]: + case Comments["*/"]: + case Comments["///"]: + case Comments["#"]: + case Comments[""]: + break; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt index 37b823ae231..486388ccf37 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt @@ -1,3 +1,5 @@ +constructSignatureAssignabilityInInheritance.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constructSignatureAssignabilityInInheritance.ts(35,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constructSignatureAssignabilityInInheritance.ts(61,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. The types returned by 'new a(...)' are incompatible between these types. Type 'string' is not assignable to type 'number'. @@ -7,10 +9,12 @@ constructSignatureAssignabilityInInheritance.ts(67,15): error TS2430: Interface 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== constructSignatureAssignabilityInInheritance.ts (2 errors) ==== +==== constructSignatureAssignabilityInInheritance.ts (4 errors) ==== // Checking basic subtype relations with construct signatures module ConstructSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's new (x: number): void; // BUG 842221 @@ -43,6 +47,8 @@ constructSignatureAssignabilityInInheritance.ts(67,15): error TS2430: Interface } module MemberWithConstructSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's a: new (x: number) => void; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 01f459ad6a7..d4c01e4d312 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -1,3 +1,5 @@ +constructSignatureAssignabilityInInheritance3.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +constructSignatureAssignabilityInInheritance3.ts(10,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constructSignatureAssignabilityInInheritance3.ts(41,19): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. @@ -26,6 +28,7 @@ constructSignatureAssignabilityInInheritance3.ts(70,19): error TS2430: Interface Type '{ a: string; b: number; }' is not assignable to type '{ a: Base; b: Base; }'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'Base'. +constructSignatureAssignabilityInInheritance3.ts(80,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constructSignatureAssignabilityInInheritance3.ts(86,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'. The types returned by 'new a2(...)' are incompatible between these types. Type 'string[]' is not assignable to type 'T[]'. @@ -37,17 +40,21 @@ constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface Type 'T' is not assignable to type 'string'. -==== constructSignatureAssignabilityInInheritance3.ts (6 errors) ==== +==== constructSignatureAssignabilityInInheritance3.ts (9 errors) ==== // checking subtype relations for function types as it relates to contextual signature instantiation // error cases module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } module WithNonGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // base type with non-generic call signatures interface A { a2: new (x: number) => string[]; @@ -150,6 +157,8 @@ constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface } module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // base type has generic call signature interface B { a2: new (x: T) => T[]; diff --git a/tests/baselines/reference/constructorArgWithGenericCallSignature.errors.txt b/tests/baselines/reference/constructorArgWithGenericCallSignature.errors.txt new file mode 100644 index 00000000000..23b87601313 --- /dev/null +++ b/tests/baselines/reference/constructorArgWithGenericCallSignature.errors.txt @@ -0,0 +1,20 @@ +constructorArgWithGenericCallSignature.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== constructorArgWithGenericCallSignature.ts (1 errors) ==== + module Test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface MyFunc { + (value1: T): T; + } + export class MyClass { + constructor(func: MyFunc) { } + } + + export function F(func: MyFunc) { } + } + var func: Test.MyFunc; + Test.F(func); // OK + var test = new Test.MyClass(func); // Should be OK + \ No newline at end of file diff --git a/tests/baselines/reference/constructorOverloads4.errors.txt b/tests/baselines/reference/constructorOverloads4.errors.txt index 92562825b89..709f11aa2ba 100644 --- a/tests/baselines/reference/constructorOverloads4.errors.txt +++ b/tests/baselines/reference/constructorOverloads4.errors.txt @@ -1,9 +1,12 @@ +constructorOverloads4.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constructorOverloads4.ts(10,1): error TS2349: This expression is not callable. Type 'Function' has no call signatures. -==== constructorOverloads4.ts (1 errors) ==== +==== constructorOverloads4.ts (2 errors) ==== declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Function { constructor(...args: string[]); } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index fcdb9edc337..b14fc0112e4 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,6 +1,7 @@ constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'. constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected. +constructorWithIncompleteTypeAnnotation.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected. constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. constructorWithIncompleteTypeAnnotation.ts(24,28): error TS1005: ':' expected. @@ -90,7 +91,7 @@ constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected. constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. -==== constructorWithIncompleteTypeAnnotation.ts (90 errors) ==== +==== constructorWithIncompleteTypeAnnotation.ts (91 errors) ==== declare module "fs" { export class File { constructor(filename: string); @@ -111,6 +112,8 @@ constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or module TypeScriptAllInOne { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Program { static Main(...args: string[]) { try { diff --git a/tests/baselines/reference/contextualTyping.errors.txt b/tests/baselines/reference/contextualTyping.errors.txt index adb7c9330d9..8fadf62820d 100644 --- a/tests/baselines/reference/contextualTyping.errors.txt +++ b/tests/baselines/reference/contextualTyping.errors.txt @@ -1,8 +1,10 @@ +contextualTyping.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +contextualTyping.ts(66,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. contextualTyping.ts(189,18): error TS2384: Overload signatures must all be ambient or non-ambient. contextualTyping.ts(223,5): error TS2741: Property 'x' is missing in type '{}' but required in type 'B'. -==== contextualTyping.ts (2 errors) ==== +==== contextualTyping.ts (4 errors) ==== // DEFAULT INTERFACES interface IFoo { n: number; @@ -24,6 +26,8 @@ contextualTyping.ts(223,5): error TS2741: Property 'x' is missing in type '{}' b // CONTEXT: Module property declaration module C2T5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var foo: (i: number, s: string) => number = function(i) { return i; } @@ -69,6 +73,8 @@ contextualTyping.ts(223,5): error TS2741: Property 'x' is missing in type '{}' b // CONTEXT: Module property assignment module C5T5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var foo: (i: number, s: string) => string; foo = function(i, s) { return s; diff --git a/tests/baselines/reference/convertKeywordsYes.errors.txt b/tests/baselines/reference/convertKeywordsYes.errors.txt index c88882db813..7cbf2fa81d2 100644 --- a/tests/baselines/reference/convertKeywordsYes.errors.txt +++ b/tests/baselines/reference/convertKeywordsYes.errors.txt @@ -1,4 +1,5 @@ convertKeywordsYes.ts(175,12): error TS18006: Classes may not have a field named 'constructor'. +convertKeywordsYes.ts(290,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode. convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode. convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. @@ -10,7 +11,7 @@ convertKeywordsYes.ts(301,11): error TS1213: Identifier expected. 'static' is a convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. -==== convertKeywordsYes.ts (10 errors) ==== +==== convertKeywordsYes.ts (11 errors) ==== // reserved ES5 future in strict mode var constructor = 0; @@ -303,6 +304,8 @@ convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a r } module bigModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class constructor { } class implements { } ~~~~~~~~~~ diff --git a/tests/baselines/reference/covariance1.errors.txt b/tests/baselines/reference/covariance1.errors.txt new file mode 100644 index 00000000000..34c7cb0050e --- /dev/null +++ b/tests/baselines/reference/covariance1.errors.txt @@ -0,0 +1,23 @@ +covariance1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== covariance1.ts (1 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + interface X { m1:number; } + export class XX implements X { constructor(public m1:number) { } } + + interface Y { x:X; } + + export function f(y:Y) { } + + var a:X; + f({x:a}); // ok + + var b:XX; + f({x:b}); // ok covariant subtype + } + + \ No newline at end of file diff --git a/tests/baselines/reference/declFileGenericType.errors.txt b/tests/baselines/reference/declFileGenericType.errors.txt new file mode 100644 index 00000000000..56045c99624 --- /dev/null +++ b/tests/baselines/reference/declFileGenericType.errors.txt @@ -0,0 +1,45 @@ +declFileGenericType.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileGenericType.ts (1 errors) ==== + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class A{ } + export class B { } + + export function F(x: T): A { return null; } + export function F2(x: T): C.A { return null; } + export function F3(x: T): C.A[] { return null; } + export function F4>(x: T): Array> { return null; } + + export function F5(): T { return null; } + + export function F6>(x: T): T { return null; } + + export class D{ + + constructor(public val: T) { } + + } + } + + export var a: C.A; + + export var b = C.F; + export var c = C.F2; + export var d = C.F3; + export var e = C.F4; + + export var x = (new C.D>(new C.A())).val; + + export function f>() { } + + export var g = C.F5>(); + + export class h extends C.A{ } + + export interface i extends C.A { } + + export var j = C.F6; + \ No newline at end of file diff --git a/tests/baselines/reference/declFileGenericType2.errors.txt b/tests/baselines/reference/declFileGenericType2.errors.txt new file mode 100644 index 00000000000..e88ade857c6 --- /dev/null +++ b/tests/baselines/reference/declFileGenericType2.errors.txt @@ -0,0 +1,101 @@ +declFileGenericType2.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(1,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(5,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(5,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(9,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(13,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(13,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(13,27): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(18,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(18,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(23,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(23,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(23,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(32,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(32,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(32,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileGenericType2.ts(32,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileGenericType2.ts (19 errors) ==== + declare module templa.mvc { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface IModel { + } + } + declare module templa.mvc { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface IController { + } + } + declare module templa.mvc { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class AbstractController implements mvc.IController { + } + } + declare module templa.mvc.composite { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface ICompositeControllerModel extends mvc.IModel { + getControllers(): mvc.IController[]; + } + } + module templa.dom.mvc { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface IElementController extends templa.mvc.IController { + } + } + // Module + module templa.dom.mvc { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class AbstractElementController extends templa.mvc.AbstractController implements IElementController { + constructor() { + super(); + } + } + } + // Module + module templa.dom.mvc.composite { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class AbstractCompositeElementController extends templa.dom.mvc.AbstractElementController { + public _controllers: templa.mvc.IController[]; + constructor() { + super(); + this._controllers = []; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/declFileInternalAliases.errors.txt b/tests/baselines/reference/declFileInternalAliases.errors.txt new file mode 100644 index 00000000000..41a0ff5c782 --- /dev/null +++ b/tests/baselines/reference/declFileInternalAliases.errors.txt @@ -0,0 +1,24 @@ +declFileInternalAliases.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileInternalAliases.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileInternalAliases.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileInternalAliases.ts (3 errors) ==== + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import x = m.c; + export var d = new x(); // emit the type as m.c + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import x = m.c; + export var d = new x(); // emit the type as x + } \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationTupleType.errors.txt b/tests/baselines/reference/declFileTypeAnnotationTupleType.errors.txt new file mode 100644 index 00000000000..86c337b3c26 --- /dev/null +++ b/tests/baselines/reference/declFileTypeAnnotationTupleType.errors.txt @@ -0,0 +1,23 @@ +declFileTypeAnnotationTupleType.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileTypeAnnotationTupleType.ts (1 errors) ==== + class c { + } + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + export class g { + } + } + class g { + } + + // Just the name + var k: [c, m.c] = [new c(), new m.c()]; + var l = k; + + var x: [g, m.g, () => c] = [new g(), new m.g(), () => new c()]; + var y = x; \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt new file mode 100644 index 00000000000..d5bef749fa7 --- /dev/null +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt @@ -0,0 +1,108 @@ +declFileTypeAnnotationVisibilityErrorAccessors.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileTypeAnnotationVisibilityErrorAccessors.ts(8,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileTypeAnnotationVisibilityErrorAccessors.ts (2 errors) ==== + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class private1 { + } + + export class public1 { + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class public2 { + } + } + + export class c { + // getter with annotation + get foo1(): private1 { + return; + } + + // getter without annotation + get foo2() { + return new private1(); + } + + // setter with annotation + set foo3(param: private1) { + } + + // Both - getter without annotation, setter with annotation + get foo4() { + return new private1(); + } + set foo4(param: private1) { + } + + // Both - with annotation + get foo5(): private1 { + return; + } + set foo5(param: private1) { + } + + // getter with annotation + get foo11(): public1 { + return; + } + + // getter without annotation + get foo12() { + return new public1(); + } + + // setter with annotation + set foo13(param: public1) { + } + + // Both - getter without annotation, setter with annotation + get foo14() { + return new public1(); + } + set foo14(param: public1) { + } + + // Both - with annotation + get foo15(): public1 { + return; + } + set foo15(param: public1) { + } + + // getter with annotation + get foo111(): m2.public2 { + return; + } + + // getter without annotation + get foo112() { + return new m2.public2(); + } + + // setter with annotation + set foo113(param: m2.public2) { + } + + // Both - getter without annotation, setter with annotation + get foo114() { + return new m2.public2(); + } + set foo114(param: m2.public2) { + } + + // Both - with annotation + get foo115(): m2.public2 { + return; + } + set foo115(param: m2.public2) { + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt new file mode 100644 index 00000000000..017638903ba --- /dev/null +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt @@ -0,0 +1,53 @@ +declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(29,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts (2 errors) ==== + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class private1 { + } + + export class public1 { + } + + // Directly using names from this module + function foo1(param: private1) { + } + function foo2(param = new private1()) { + } + + export function foo3(param : private1) { + } + export function foo4(param = new private1()) { + } + + function foo11(param: public1) { + } + function foo12(param = new public1()) { + } + + export function foo13(param: public1) { + } + export function foo14(param = new public1()) { + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class public2 { + } + } + + function foo111(param: m2.public2) { + } + function foo112(param = new m2.public2()) { + } + + export function foo113(param: m2.public2) { + } + export function foo114(param = new m2.public2()) { + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt new file mode 100644 index 00000000000..ecb55980919 --- /dev/null +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt @@ -0,0 +1,65 @@ +declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(37,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts (2 errors) ==== + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class private1 { + } + + export class public1 { + } + + // Directly using names from this module + function foo1(): private1 { + return; + } + function foo2() { + return new private1(); + } + + export function foo3(): private1 { + return; + } + export function foo4() { + return new private1(); + } + + function foo11(): public1 { + return; + } + function foo12() { + return new public1(); + } + + export function foo13(): public1 { + return; + } + export function foo14() { + return new public1(); + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class public2 { + } + } + + function foo111(): m2.public2 { + return; + } + function foo112() { + return new m2.public2(); + } + + export function foo113(): m2.public2 { + return; + } + export function foo114() { + return new m2.public2(); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeofInAnonymousType.errors.txt b/tests/baselines/reference/declFileTypeofInAnonymousType.errors.txt new file mode 100644 index 00000000000..a3789cdabbb --- /dev/null +++ b/tests/baselines/reference/declFileTypeofInAnonymousType.errors.txt @@ -0,0 +1,27 @@ +declFileTypeofInAnonymousType.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileTypeofInAnonymousType.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + export enum e { + weekday, + weekend, + holiday + } + } + var a: { c: m1.c; }; + var b = { + c: m1.c, + m1: m1 + }; + var c = { m1: m1 }; + var d = { + m: { mod: m1 }, + mc: { cl: m1.c }, + me: { en: m1.e }, + mh: m1.e.holiday + }; \ No newline at end of file diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt new file mode 100644 index 00000000000..f14b49948ec --- /dev/null +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.errors.txt @@ -0,0 +1,52 @@ +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(1,18): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(1,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(6,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(6,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(13,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(13,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts(13,17): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileWithClassNameConflictingWithClassReferredByExtendsClause.ts (10 errors) ==== + declare module A.B.Base { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class W { + id: number; + } + } + module X.Y.base { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class W extends A.B.Base.W { + name: string; + } + } + + module X.Y.base.Z { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class W extends X.Y.base.W { + value: boolean; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/declFileWithErrorsInInputDeclarationFile.errors.txt b/tests/baselines/reference/declFileWithErrorsInInputDeclarationFile.errors.txt index 9d677e4bf7a..8a5e8d7400f 100644 --- a/tests/baselines/reference/declFileWithErrorsInInputDeclarationFile.errors.txt +++ b/tests/baselines/reference/declFileWithErrorsInInputDeclarationFile.errors.txt @@ -1,6 +1,8 @@ +declFile.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declFile.d.ts(2,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. declFile.d.ts(3,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. declFile.d.ts(5,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +declFile.d.ts(5,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -8,8 +10,10 @@ declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an alre /// var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file -==== declFile.d.ts (4 errors) ==== +==== declFile.d.ts (6 errors) ==== declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare var x; ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -20,6 +24,8 @@ declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an alre declare module N { } ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class C { } ~~~~~~~ diff --git a/tests/baselines/reference/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt b/tests/baselines/reference/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt index 9d677e4bf7a..8a5e8d7400f 100644 --- a/tests/baselines/reference/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt +++ b/tests/baselines/reference/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt @@ -1,6 +1,8 @@ +declFile.d.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declFile.d.ts(2,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. declFile.d.ts(3,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. declFile.d.ts(5,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +declFile.d.ts(5,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -8,8 +10,10 @@ declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an alre /// var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file -==== declFile.d.ts (4 errors) ==== +==== declFile.d.ts (6 errors) ==== declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare var x; ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -20,6 +24,8 @@ declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an alre declare module N { } ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class C { } ~~~~~~~ diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.errors.txt b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.errors.txt new file mode 100644 index 00000000000..4db46329d48 --- /dev/null +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.errors.txt @@ -0,0 +1,44 @@ +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(1,18): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(1,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(6,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(13,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithExtendsClauseThatHasItsContainerNameConflict.ts(13,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileWithExtendsClauseThatHasItsContainerNameConflict.ts (8 errors) ==== + declare module A.B.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class B { + } + } + + module A.B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class EventManager { + id: number; + + } + } + + module A.B.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class ContextMenu extends EventManager { + name: string; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.errors.txt b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.errors.txt new file mode 100644 index 00000000000..4d2b9f95a1e --- /dev/null +++ b/tests/baselines/reference/declFileWithInternalModuleNameConflictsInExtendsClause3.errors.txt @@ -0,0 +1,52 @@ +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(1,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(1,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(5,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(5,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(5,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(10,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(10,14): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declFileWithInternalModuleNameConflictsInExtendsClause3.ts(11,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declFileWithInternalModuleNameConflictsInExtendsClause3.ts (12 errors) ==== + module X.A.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Z { + } + } + module X.A.B.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class W implements X.A.C.Z { // This needs to be referred as X.A.C.Z as A has conflict + } + } + + module X.A.B.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/declInput4.errors.txt b/tests/baselines/reference/declInput4.errors.txt new file mode 100644 index 00000000000..970c226612d --- /dev/null +++ b/tests/baselines/reference/declInput4.errors.txt @@ -0,0 +1,21 @@ +declInput4.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declInput4.ts (1 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class C { } + export class E {} + export interface I1 {} + interface I2 {} + export class D { + public m1: number; + public m2: string; + public m23: E; + public m24: I1; + public m232(): E { return null;} + public m242(): I1 { return null; } + public m26(i:I1) {} + } + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.errors.txt b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.errors.txt new file mode 100644 index 00000000000..553c03654c9 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.errors.txt @@ -0,0 +1,19 @@ +declarationEmitDestructuringObjectLiteralPattern2.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declarationEmitDestructuringObjectLiteralPattern2.ts (1 errors) ==== + var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } }; + + function f15() { + var a4 = "hello"; + var b4 = 1; + var c4 = true; + return { a4, b4, c4 }; + } + var { a4, b4, c4 } = f15(); + + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var { a4, b4, c4 } = f15(); + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitNameConflicts.errors.txt b/tests/baselines/reference/declarationEmitNameConflicts.errors.txt new file mode 100644 index 00000000000..dc6edf2c215 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNameConflicts.errors.txt @@ -0,0 +1,80 @@ +declarationEmit_nameConflicts_0.ts(2,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(5,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(16,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(16,17): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(31,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(31,17): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(34,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_0.ts(40,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmit_nameConflicts_1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declarationEmit_nameConflicts_0.ts (9 errors) ==== + import im = require('./declarationEmit_nameConflicts_1'); + export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function f() { } + export class C { } + export module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function g() { }; + export interface I { } + } + + export import a = M.f; + export import b = M.C; + export import c = N; + export import d = im; + } + + export module M.P { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function f() { } + export class C { } + export module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function g() { }; + export interface I { } + } + export import im = M.P.f; + export var a = M.a; // emitted incorrectly as typeof f + export var b = M.b; // ok + export var c = M.c; // ok + export var g = M.c.g; // ok + export var d = M.d; // emitted incorrectly as typeof im + } + + export module M.Q { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function f() { } + export class C { } + export module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function g() { }; + export interface I { } + } + export interface b extends M.b { } // ok + export interface I extends M.c.I { } // ok + export module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I extends M.c.I { } // ok + } + } +==== declarationEmit_nameConflicts_1.ts (1 errors) ==== + module f { export class c { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export = f; + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitNameConflicts2.errors.txt b/tests/baselines/reference/declarationEmitNameConflicts2.errors.txt new file mode 100644 index 00000000000..ab128d80ef1 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNameConflicts2.errors.txt @@ -0,0 +1,42 @@ +declarationEmitNameConflicts2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(1,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(1,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(4,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(10,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflicts2.ts(10,17): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declarationEmitNameConflicts2.ts (8 errors) ==== + module X.Y.base { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function f() { } + export class C { } + export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var v; + } + export enum E { } + } + + module X.Y.base.Z { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var f = X.Y.base.f; // Should be base.f + export var C = X.Y.base.C; // Should be base.C + export var M = X.Y.base.M; // Should be base.M + export var E = X.Y.base.E; // Should be base.E + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitNameConflicts2.types b/tests/baselines/reference/declarationEmitNameConflicts2.types index b6df9551cfa..e23df33927f 100644 --- a/tests/baselines/reference/declarationEmitNameConflicts2.types +++ b/tests/baselines/reference/declarationEmitNameConflicts2.types @@ -23,6 +23,7 @@ module X.Y.base { export var v; >v : any +> : ^^^ } export enum E { } >E : E diff --git a/tests/baselines/reference/declarationEmitNameConflictsWithAlias.errors.txt b/tests/baselines/reference/declarationEmitNameConflictsWithAlias.errors.txt new file mode 100644 index 00000000000..c517d7b1f3d --- /dev/null +++ b/tests/baselines/reference/declarationEmitNameConflictsWithAlias.errors.txt @@ -0,0 +1,18 @@ +declarationEmitNameConflictsWithAlias.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflictsWithAlias.ts(3,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +declarationEmitNameConflictsWithAlias.ts(4,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declarationEmitNameConflictsWithAlias.ts (3 errors) ==== + export module C { export interface I { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import v = C; + export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module C { export interface I { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var w: v.I; // Gets emitted as C.I, which is the wrong interface + } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitNameConflictsWithAlias.types b/tests/baselines/reference/declarationEmitNameConflictsWithAlias.types index 9b67cf259f9..4a770cd54c3 100644 --- a/tests/baselines/reference/declarationEmitNameConflictsWithAlias.types +++ b/tests/baselines/reference/declarationEmitNameConflictsWithAlias.types @@ -5,7 +5,8 @@ export module C { export interface I { } } export import v = C; >v : any > : ^^^ ->C : error +>C : any +> : ^^^ export module M { >M : typeof M diff --git a/tests/baselines/reference/declarationMapsWithoutDeclaration.errors.txt b/tests/baselines/reference/declarationMapsWithoutDeclaration.errors.txt index ba3e9d6c337..7ba5b55fa46 100644 --- a/tests/baselines/reference/declarationMapsWithoutDeclaration.errors.txt +++ b/tests/baselines/reference/declarationMapsWithoutDeclaration.errors.txt @@ -1,9 +1,12 @@ error TS5069: Option 'declarationMap' cannot be specified without specifying option 'declaration' or option 'composite'. +declarationMapsWithoutDeclaration.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. !!! error TS5069: Option 'declarationMap' cannot be specified without specifying option 'declaration' or option 'composite'. -==== declarationMapsWithoutDeclaration.ts (0 errors) ==== +==== declarationMapsWithoutDeclaration.ts (1 errors) ==== module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface connectModule { (res, req, next): void; } diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 935c5f230bb..d9126eff7b9 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -16,11 +16,12 @@ declarationsAndAssignments.ts(73,14): error TS2339: Property 'b' does not exist declarationsAndAssignments.ts(74,11): error TS2339: Property 'a' does not exist on type 'undefined[]'. declarationsAndAssignments.ts(74,14): error TS2339: Property 'b' does not exist on type 'undefined[]'. declarationsAndAssignments.ts(106,17): error TS2741: Property 'x' is missing in type '{ y: false; }' but required in type '{ x: any; y?: boolean; }'. +declarationsAndAssignments.ts(108,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declarationsAndAssignments.ts(138,6): error TS2322: Type 'string' is not assignable to type 'number'. declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'. -==== declarationsAndAssignments.ts (20 errors) ==== +==== declarationsAndAssignments.ts (21 errors) ==== function f0() { var [] = [1, "hello"]; var [x] = [1, "hello"]; @@ -166,6 +167,8 @@ declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assigna !!! error TS2741: Property 'x' is missing in type '{ y: false; }' but required in type '{ x: any; y?: boolean; }'. module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var [a, b] = [1, 2]; } diff --git a/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.errors.txt b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.errors.txt new file mode 100644 index 00000000000..faebfc57d49 --- /dev/null +++ b/tests/baselines/reference/declareExternalModuleWithExportAssignedFundule.errors.txt @@ -0,0 +1,30 @@ +declareExternalModuleWithExportAssignedFundule.ts(7,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== declareExternalModuleWithExportAssignedFundule.ts (1 errors) ==== + declare module "express" { + + export = express; + + function express(): express.ExpressServer; + + module express { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export interface ExpressServer { + + enable(name: string): ExpressServer; + + post(path: RegExp, handler: (req: Function) => void ): void; + + } + + export class ExpressServerRequest { + + } + + } + + } + \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index a30ddc5d7ee..904f0cb736d 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -1,3 +1,4 @@ +decrementOperatorWithAnyOtherTypeInvalidOperations.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. decrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. decrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2629: Cannot assign to 'A' because it is a class. decrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2631: Cannot assign to 'M' because it is a namespace. @@ -52,7 +53,7 @@ decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,10): error TS1005: ';' decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,12): error TS1109: Expression expected. -==== decrementOperatorWithAnyOtherTypeInvalidOperations.ts (52 errors) ==== +==== decrementOperatorWithAnyOtherTypeInvalidOperations.ts (53 errors) ==== // -- operator on any type var ANY1: any; var ANY2: any[] = ["", ""]; @@ -71,6 +72,8 @@ decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,12): error TS1109: Expr } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt index 6f2e25175c0..9186799713e 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.errors.txt @@ -1,3 +1,4 @@ +decrementOperatorWithUnsupportedBooleanType.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. decrementOperatorWithUnsupportedBooleanType.ts(17,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. decrementOperatorWithUnsupportedBooleanType.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. decrementOperatorWithUnsupportedBooleanType.ts(22,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. @@ -29,7 +30,7 @@ decrementOperatorWithUnsupportedBooleanType.ts(54,1): error TS2356: An arithmeti decrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -==== decrementOperatorWithUnsupportedBooleanType.ts (29 errors) ==== +==== decrementOperatorWithUnsupportedBooleanType.ts (30 errors) ==== // -- operator on boolean type var BOOLEAN: boolean; @@ -40,6 +41,8 @@ decrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmet static foo() { return true; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: boolean; } diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt index acfb968b408..3e58da01cf4 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.errors.txt @@ -1,3 +1,4 @@ +decrementOperatorWithUnsupportedStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. decrementOperatorWithUnsupportedStringType.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. decrementOperatorWithUnsupportedStringType.ts(19,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. decrementOperatorWithUnsupportedStringType.ts(21,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. @@ -39,7 +40,7 @@ decrementOperatorWithUnsupportedStringType.ts(65,1): error TS2356: An arithmetic decrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -==== decrementOperatorWithUnsupportedStringType.ts (39 errors) ==== +==== decrementOperatorWithUnsupportedStringType.ts (40 errors) ==== // -- operator on string type var STRING: string; var STRING1: string[] = ["", ""]; @@ -51,6 +52,8 @@ decrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmeti static foo() { return ""; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: string; } diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 1a4f2b723b2..4a1ca65648a 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,4 @@ +deleteOperatorWithAnyOtherType.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. deleteOperatorWithAnyOtherType.ts(25,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithAnyOtherType.ts(26,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithAnyOtherType.ts(27,31): error TS2703: The operand of a 'delete' operator must be a property reference. @@ -25,7 +26,7 @@ deleteOperatorWithAnyOtherType.ts(55,8): error TS2703: The operand of a 'delete' deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: The operand of a 'delete' operator must be a property reference. -==== deleteOperatorWithAnyOtherType.ts (25 errors) ==== +==== deleteOperatorWithAnyOtherType.ts (26 errors) ==== // delete operator on any type var ANY: any; @@ -45,6 +46,8 @@ deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: The operand of a 'delete' } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt index 97094ff5839..aeb0d215fac 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -1,3 +1,4 @@ +deleteOperatorWithNumberType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. deleteOperatorWithNumberType.ts(18,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithNumberType.ts(19,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithNumberType.ts(22,31): error TS2703: The operand of a 'delete' operator must be a property reference. @@ -17,7 +18,7 @@ deleteOperatorWithNumberType.ts(41,8): error TS2703: The operand of a 'delete' o deleteOperatorWithNumberType.ts(42,8): error TS2703: The operand of a 'delete' operator must be a property reference. -==== deleteOperatorWithNumberType.ts (17 errors) ==== +==== deleteOperatorWithNumberType.ts (18 errors) ==== // delete operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -29,6 +30,8 @@ deleteOperatorWithNumberType.ts(42,8): error TS2703: The operand of a 'delete' o static foo() { return 1; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: number; } diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt index a872e8a070b..6c713fc6ac6 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -1,3 +1,4 @@ +deleteOperatorWithStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. deleteOperatorWithStringType.ts(18,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithStringType.ts(19,31): error TS2703: The operand of a 'delete' operator must be a property reference. deleteOperatorWithStringType.ts(22,31): error TS2703: The operand of a 'delete' operator must be a property reference. @@ -18,7 +19,7 @@ deleteOperatorWithStringType.ts(42,8): error TS2703: The operand of a 'delete' o deleteOperatorWithStringType.ts(43,8): error TS2703: The operand of a 'delete' operator must be a property reference. -==== deleteOperatorWithStringType.ts (18 errors) ==== +==== deleteOperatorWithStringType.ts (19 errors) ==== // delete operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -30,6 +31,8 @@ deleteOperatorWithStringType.ts(43,8): error TS2703: The operand of a 'delete' o static foo() { return ""; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: string; } diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt index 05981baf43c..f3335d1530b 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -12,13 +12,14 @@ disallowLineTerminatorBeforeArrow.ts(23,8): error TS1200: Line terminator not pe disallowLineTerminatorBeforeArrow.ts(26,8): error TS1200: Line terminator not permitted before arrow. disallowLineTerminatorBeforeArrow.ts(52,5): error TS1200: Line terminator not permitted before arrow. disallowLineTerminatorBeforeArrow.ts(54,5): error TS1200: Line terminator not permitted before arrow. +disallowLineTerminatorBeforeArrow.ts(56,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. disallowLineTerminatorBeforeArrow.ts(59,13): error TS1200: Line terminator not permitted before arrow. disallowLineTerminatorBeforeArrow.ts(63,13): error TS1200: Line terminator not permitted before arrow. disallowLineTerminatorBeforeArrow.ts(68,13): error TS1200: Line terminator not permitted before arrow. disallowLineTerminatorBeforeArrow.ts(72,9): error TS1200: Line terminator not permitted before arrow. -==== disallowLineTerminatorBeforeArrow.ts (18 errors) ==== +==== disallowLineTerminatorBeforeArrow.ts (19 errors) ==== var f1 = () => { } ~~ @@ -103,6 +104,8 @@ disallowLineTerminatorBeforeArrow.ts(72,9): error TS1200: Line terminator not pe !!! error TS1200: Line terminator not permitted before arrow. module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class City { constructor(x: number, thing = () => 100) { diff --git a/tests/baselines/reference/dottedModuleName2.errors.txt b/tests/baselines/reference/dottedModuleName2.errors.txt new file mode 100644 index 00000000000..6af6730d31e --- /dev/null +++ b/tests/baselines/reference/dottedModuleName2.errors.txt @@ -0,0 +1,70 @@ +dottedModuleName2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(1,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(9,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(22,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(22,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(22,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +dottedModuleName2.ts(32,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== dottedModuleName2.ts (8 errors) ==== + module A.B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export var x = 1; + + } + + + + module AA { export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export var x = 1; + + } } + + + + var tmpOK = AA.B.x; + + var tmpError = A.B.x; + + + module A.B.C + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + { + + export var x = 1; + + } + + + + module M + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + { + + import X1 = A; + + import X2 = A.B; + + import X3 = A.B.C; + + } + \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt index fe8ff968d79..5e527ba74b7 100644 --- a/tests/baselines/reference/downlevelLetConst16.errors.txt +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -1,3 +1,7 @@ +downlevelLetConst16.ts(101,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +downlevelLetConst16.ts(110,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +downlevelLetConst16.ts(122,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +downlevelLetConst16.ts(132,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. downlevelLetConst16.ts(151,15): error TS2493: Tuple type '[]' of length '0' has no element at index '0'. downlevelLetConst16.ts(164,17): error TS2493: Tuple type '[]' of length '0' has no element at index '0'. downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type. @@ -6,7 +10,7 @@ downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array t downlevelLetConst16.ts(223,17): error TS2339: Property 'a' does not exist on type 'undefined'. -==== downlevelLetConst16.ts (6 errors) ==== +==== downlevelLetConst16.ts (10 errors) ==== 'use strict' declare function use(a: any); @@ -108,6 +112,8 @@ downlevelLetConst16.ts(223,17): error TS2339: Property 'a' does not exist on typ } module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. let x = 1; use(x); let [y] = [1]; @@ -117,6 +123,8 @@ downlevelLetConst16.ts(223,17): error TS2339: Property 'a' does not exist on typ } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. { let x = 1; use(x); @@ -129,6 +137,8 @@ downlevelLetConst16.ts(223,17): error TS2339: Property 'a' does not exist on typ } module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. const x = 1; use(x); const [y] = [1]; @@ -139,6 +149,8 @@ downlevelLetConst16.ts(223,17): error TS2339: Property 'a' does not exist on typ } module M4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. { const x = 1; use(x); diff --git a/tests/baselines/reference/duplicateAnonymousInners1.errors.txt b/tests/baselines/reference/duplicateAnonymousInners1.errors.txt new file mode 100644 index 00000000000..b80afd780e9 --- /dev/null +++ b/tests/baselines/reference/duplicateAnonymousInners1.errors.txt @@ -0,0 +1,34 @@ +duplicateAnonymousInners1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateAnonymousInners1.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== duplicateAnonymousInners1.ts (2 errors) ==== + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + class Helper { + + } + + class Inner {} + // Inner should show up in intellisense + + export var Outer=0; + } + + + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + // Should not be an error + class Helper { + + } + + // Inner should not show up in intellisense + // Outer should show up in intellisense + + } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt index d08a3313c20..a585c2f5fa6 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt @@ -1,40 +1,62 @@ +duplicateSymbolsExportMatching.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(23,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(24,15): error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local. duplicateSymbolsExportMatching.ts(25,22): error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local. duplicateSymbolsExportMatching.ts(26,22): error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local. duplicateSymbolsExportMatching.ts(27,15): error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local. +duplicateSymbolsExportMatching.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(32,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(32,12): error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local. +duplicateSymbolsExportMatching.ts(35,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(35,19): error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local. +duplicateSymbolsExportMatching.ts(41,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(42,9): error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local. duplicateSymbolsExportMatching.ts(43,16): error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local. duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local. duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local. +duplicateSymbolsExportMatching.ts(48,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +duplicateSymbolsExportMatching.ts(49,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. duplicateSymbolsExportMatching.ts(49,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. +duplicateSymbolsExportMatching.ts(55,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. +duplicateSymbolsExportMatching.ts(57,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. +duplicateSymbolsExportMatching.ts(58,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateSymbolsExportMatching.ts(58,19): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. duplicateSymbolsExportMatching.ts(64,11): error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local. duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local. -==== duplicateSymbolsExportMatching.ts (18 errors) ==== +==== duplicateSymbolsExportMatching.ts (32 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface E { } interface I { } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface E { } // ok interface I { } // ok } // Doesn't match export visibility, but it's in a different parent, so it's ok module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface E { } // ok export interface I { } // ok } module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface I { } interface I { } // ok export interface E { } @@ -42,6 +64,8 @@ duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations } module N2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface I { } ~ !!! error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local. @@ -58,12 +82,18 @@ duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations // Should report error only once for instantiated module module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module inst { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~ !!! error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local. var t; } export module inst { // one error + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~ !!! error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local. var t; @@ -72,6 +102,8 @@ duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations // Variables of the same / different type module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var v: string; ~ !!! error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local. @@ -87,7 +119,11 @@ duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module F { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~ !!! error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. ~ @@ -100,13 +136,19 @@ duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C { } ~ !!! error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. module C { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~ !!! error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. export module C { // Two visibility errors (one for the clodule symbol, and one for the merged container symbol) + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~ !!! error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. var t; diff --git a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt index 0752acccdfd..7f59c7ecfab 100644 --- a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt +++ b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt @@ -1,10 +1,11 @@ duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +duplicateVariablesWithAny.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. -==== duplicateVariablesWithAny.ts (4 errors) ==== +==== duplicateVariablesWithAny.ts (5 errors) ==== // They should have to be the same even when one of the types is 'any' var x: any; var x = 2; //error @@ -19,6 +20,8 @@ duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declaratio !!! related TS6203 duplicateVariablesWithAny.ts:5:5: 'y' was also declared here. module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x: any; var x = 2; //error ~ diff --git a/tests/baselines/reference/enumAssignability.errors.txt b/tests/baselines/reference/enumAssignability.errors.txt index 36a4c7eb63e..c8b865a496b 100644 --- a/tests/baselines/reference/enumAssignability.errors.txt +++ b/tests/baselines/reference/enumAssignability.errors.txt @@ -2,6 +2,7 @@ enumAssignability.ts(9,1): error TS2322: Type 'F' is not assignable to type 'E'. enumAssignability.ts(10,1): error TS2322: Type 'E' is not assignable to type 'F'. enumAssignability.ts(11,1): error TS2322: Type '1' is not assignable to type 'E'. enumAssignability.ts(12,1): error TS2322: Type '1' is not assignable to type 'F'. +enumAssignability.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumAssignability.ts(29,9): error TS2322: Type 'E' is not assignable to type 'string'. enumAssignability.ts(30,9): error TS2322: Type 'E' is not assignable to type 'boolean'. enumAssignability.ts(31,9): error TS2322: Type 'E' is not assignable to type 'Date'. @@ -27,7 +28,7 @@ enumAssignability.ts(52,13): error TS2322: Type 'E' is not assignable to type 'B 'E' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'E'. -==== enumAssignability.ts (22 errors) ==== +==== enumAssignability.ts (23 errors) ==== // enums assignable to number, any, Object, errors unless otherwise noted enum E { A } @@ -52,6 +53,8 @@ enumAssignability.ts(52,13): error TS2322: Type 'E' is not assignable to type 'B x = f; // ok module Others { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a: any = e; // ok class C { diff --git a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt index 3bfdd2aae93..653ab39685d 100644 --- a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt @@ -1,8 +1,10 @@ +enumAssignabilityInInheritance.ts(84,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumAssignabilityInInheritance.ts(93,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. -==== enumAssignabilityInInheritance.ts (2 errors) ==== +==== enumAssignabilityInInheritance.ts (4 errors) ==== // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors @@ -87,6 +89,8 @@ enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable decl function f() { } module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } declare function foo14(x: typeof f): typeof f; @@ -96,6 +100,8 @@ enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable decl class CC { baz: string } module CC { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } declare function foo15(x: CC): CC; diff --git a/tests/baselines/reference/enumAssignmentCompat3.errors.txt b/tests/baselines/reference/enumAssignmentCompat3.errors.txt index 9c10fd6b13d..27bfca8a2b9 100644 --- a/tests/baselines/reference/enumAssignmentCompat3.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat3.errors.txt @@ -1,3 +1,4 @@ +enumAssignmentCompat3.ts(52,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumAssignmentCompat3.ts(68,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'. Property 'd' is missing in type 'First.E'. enumAssignmentCompat3.ts(70,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'. @@ -20,7 +21,7 @@ enumAssignmentCompat3.ts(87,1): error TS2322: Type 'First.E' is not assignable t Each declaration of 'E.c' differs in its value, where '3' was expected but '2' was given. -==== enumAssignmentCompat3.ts (12 errors) ==== +==== enumAssignmentCompat3.ts (13 errors) ==== namespace First { export enum E { a, b, c, @@ -73,6 +74,8 @@ enumAssignmentCompat3.ts(87,1): error TS2322: Type 'First.E' is not assignable t a, b, c } export module E { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export let d = 5; } } diff --git a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt index de8ee8ae447..fa86eaf5f33 100644 --- a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt +++ b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt @@ -10,13 +10,15 @@ enumIsNotASubtypeOfAnythingButNumber.ts(66,5): error TS2411: Property 'foo' of t enumIsNotASubtypeOfAnythingButNumber.ts(72,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type '(x: any) => number'. enumIsNotASubtypeOfAnythingButNumber.ts(78,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type '(x: T) => T'. enumIsNotASubtypeOfAnythingButNumber.ts(85,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type 'E2'. +enumIsNotASubtypeOfAnythingButNumber.ts(90,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumIsNotASubtypeOfAnythingButNumber.ts(95,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type 'typeof f'. +enumIsNotASubtypeOfAnythingButNumber.ts(100,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumIsNotASubtypeOfAnythingButNumber.ts(105,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type 'typeof c'. enumIsNotASubtypeOfAnythingButNumber.ts(111,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type 'T'. enumIsNotASubtypeOfAnythingButNumber.ts(117,5): error TS2411: Property 'foo' of type 'E' is not assignable to 'string' index type 'U'. -==== enumIsNotASubtypeOfAnythingButNumber.ts (16 errors) ==== +==== enumIsNotASubtypeOfAnythingButNumber.ts (18 errors) ==== // enums are only subtypes of number, any and no other types enum E { A } @@ -131,6 +133,8 @@ enumIsNotASubtypeOfAnythingButNumber.ts(117,5): error TS2411: Property 'foo' of function f() { } module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } interface I15 { @@ -143,6 +147,8 @@ enumIsNotASubtypeOfAnythingButNumber.ts(117,5): error TS2411: Property 'foo' of class c { baz: string } module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } interface I16 { diff --git a/tests/baselines/reference/enumMerging.errors.txt b/tests/baselines/reference/enumMerging.errors.txt new file mode 100644 index 00000000000..87c1de1f100 --- /dev/null +++ b/tests/baselines/reference/enumMerging.errors.txt @@ -0,0 +1,96 @@ +enumMerging.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(49,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(52,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(56,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(56,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(59,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMerging.ts(60,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== enumMerging.ts (9 errors) ==== + // Enum with only constant members across 2 declarations with the same root module + // Enum with initializer in all declarations with constant members with the same root module + module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + enum EImpl1 { + A, B, C + } + + enum EImpl1 { + D = 1, E, F + } + + export enum EConst1 { + A = 3, B = 2, C = 1 + } + + export enum EConst1 { + D = 7, E = 9, F = 8 + } + + var x = [EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F]; + } + + // Enum with only computed members across 2 declarations with the same root module + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum EComp2 { + A = 'foo'.length, B = 'foo'.length, C = 'foo'.length + } + + export enum EComp2 { + D = 'foo'.length, E = 'foo'.length, F = 'foo'.length + } + + var x = [EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F]; + } + + // Enum with initializer in only one of two declarations with constant members with the same root module + module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + enum EInit { + A, + B + } + + enum EInit { + C = 1, D, E + } + } + + // Enums with same name but different root module + module M4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum Color { Red, Green, Blue } + } + module M5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum Color { Red, Green, Blue } + } + + module M6.A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum Color { Red, Green, Blue } + } + module M6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum Color { Yellow = 1 } + } + var t = A.Color.Yellow; + t = A.Color.Red; + } + \ No newline at end of file diff --git a/tests/baselines/reference/enumMergingErrors.errors.txt b/tests/baselines/reference/enumMergingErrors.errors.txt index e0d3ba2e823..6350adc73b1 100644 --- a/tests/baselines/reference/enumMergingErrors.errors.txt +++ b/tests/baselines/reference/enumMergingErrors.errors.txt @@ -1,20 +1,35 @@ +enumMergingErrors.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(12,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(22,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumMergingErrors.ts(26,22): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. +enumMergingErrors.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(34,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +enumMergingErrors.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. enumMergingErrors.ts(38,22): error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. -==== enumMergingErrors.ts (2 errors) ==== +==== enumMergingErrors.ts (11 errors) ==== // Enum with constant, computed, constant members split across 3 declarations with the same root module module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { A = 0 } export enum E2 { C } export enum E3 { A = 0 } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { B = 'foo'.length } export enum E2 { B = 'foo'.length } export enum E3 { C } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { C } export enum E2 { A = 0 } export enum E3 { B = 'foo'.length } @@ -22,12 +37,18 @@ enumMergingErrors.ts(38,22): error TS2432: In an enum with multiple declarations // Enum with no initializer in either declaration with constant members with the same root module module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { A = 0 } } module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { B } } module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { C } ~ !!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. @@ -36,12 +57,18 @@ enumMergingErrors.ts(38,22): error TS2432: In an enum with multiple declarations // Enum with initializer in only one of three declarations with constant members with the same root module module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { A } } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { B = 0 } } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum E1 { C } ~ !!! error TS2432: In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element. diff --git a/tests/baselines/reference/es6ClassTest.errors.txt b/tests/baselines/reference/es6ClassTest.errors.txt index 22547bed6d2..70b800eefbd 100644 --- a/tests/baselines/reference/es6ClassTest.errors.txt +++ b/tests/baselines/reference/es6ClassTest.errors.txt @@ -1,7 +1,8 @@ es6ClassTest.ts(25,44): error TS1015: Parameter cannot have question mark and initializer. +es6ClassTest.ts(34,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== es6ClassTest.ts (1 errors) ==== +==== es6ClassTest.ts (2 errors) ==== class Bar { public goo: number; public prop1(x) { @@ -38,6 +39,8 @@ es6ClassTest.ts(25,44): error TS1015: Parameter cannot have question mark and in var f = new Foo(); declare module AmbientMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Provide { foo:number; zoo:string; diff --git a/tests/baselines/reference/es6ExportAll.errors.txt b/tests/baselines/reference/es6ExportAll.errors.txt new file mode 100644 index 00000000000..cdbb592695a --- /dev/null +++ b/tests/baselines/reference/es6ExportAll.errors.txt @@ -0,0 +1,22 @@ +server.ts(5,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +server.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== server.ts (2 errors) ==== + export class c { + } + export interface i { + } + export module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 10; + } + export var x = 10; + export module uninstantiated { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + +==== client.ts (0 errors) ==== + export * from "server"; \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportAllInEs5.errors.txt b/tests/baselines/reference/es6ExportAllInEs5.errors.txt new file mode 100644 index 00000000000..027a1b2f797 --- /dev/null +++ b/tests/baselines/reference/es6ExportAllInEs5.errors.txt @@ -0,0 +1,22 @@ +server.ts(5,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +server.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== server.ts (2 errors) ==== + export class c { + } + export interface i { + } + export module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 10; + } + export var x = 10; + export module uninstantiated { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + +==== client.ts (0 errors) ==== + export * from "./server"; \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportClause.errors.txt b/tests/baselines/reference/es6ExportClause.errors.txt new file mode 100644 index 00000000000..f0ef1eb31a0 --- /dev/null +++ b/tests/baselines/reference/es6ExportClause.errors.txt @@ -0,0 +1,24 @@ +server.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +server.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== server.ts (2 errors) ==== + class c { + } + interface i { + } + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 10; + } + var x = 10; + module uninstantiated { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + export { c }; + export { c as c2 }; + export { i, m as instantiatedModule }; + export { uninstantiated }; + export { x }; \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportClauseInEs5.errors.txt b/tests/baselines/reference/es6ExportClauseInEs5.errors.txt new file mode 100644 index 00000000000..f0ef1eb31a0 --- /dev/null +++ b/tests/baselines/reference/es6ExportClauseInEs5.errors.txt @@ -0,0 +1,24 @@ +server.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +server.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== server.ts (2 errors) ==== + class c { + } + interface i { + } + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 10; + } + var x = 10; + module uninstantiated { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + export { c }; + export { c as c2 }; + export { i, m as instantiatedModule }; + export { uninstantiated }; + export { x }; \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportEqualsInterop.errors.txt b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt index 5d34ca0b7f1..c198ac2c993 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.errors.txt +++ b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt @@ -29,6 +29,11 @@ main.ts(103,15): error TS2498: Module '"function"' uses 'export =' and cannot be main.ts(104,15): error TS2498: Module '"function-module"' uses 'export =' and cannot be used with 'export *'. main.ts(105,15): error TS2498: Module '"class"' uses 'export =' and cannot be used with 'export *'. main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and cannot be used with 'export *'. +modules.d.ts(30,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +modules.d.ts(42,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +modules.d.ts(50,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +modules.d.ts(70,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +modules.d.ts(90,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ==== main.ts (31 errors) ==== @@ -201,7 +206,7 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno ~~~~~~~~~~~~~~ !!! error TS2498: Module '"class-module"' uses 'export =' and cannot be used with 'export *'. -==== modules.d.ts (0 errors) ==== +==== modules.d.ts (5 errors) ==== declare module "interface" { interface Foo { x: number; @@ -232,6 +237,8 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno declare module "module" { module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a: number; export var b: number; } @@ -244,6 +251,8 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno y: number; } module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a: number; export var b: number; } @@ -252,6 +261,8 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno declare module "variable-module" { module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Bar { x: number; y: number; @@ -272,6 +283,8 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno declare module "function-module" { function foo(); module foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a: number; export var b: number; } @@ -292,6 +305,8 @@ main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and canno y: number; } module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var a: number; export var b: number; } diff --git a/tests/baselines/reference/es6ImportEqualsDeclaration2.errors.txt b/tests/baselines/reference/es6ImportEqualsDeclaration2.errors.txt new file mode 100644 index 00000000000..4fde22a7454 --- /dev/null +++ b/tests/baselines/reference/es6ImportEqualsDeclaration2.errors.txt @@ -0,0 +1,23 @@ +server.d.ts(8,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== server.d.ts (1 errors) ==== + declare module "other" { + export class C { } + } + + declare module "server" { + import events = require("other"); // Ambient declaration, no error expected. + + module S { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var a: number; + } + + export = S; // Ambient declaration, no error expected. + } + +==== client.ts (0 errors) ==== + import {a} from "server"; + \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.errors.txt b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.errors.txt new file mode 100644 index 00000000000..51e8f225a2b --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportInIndirectExportAssignment.errors.txt @@ -0,0 +1,15 @@ +es6ImportNamedImportInIndirectExportAssignment_0.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ImportNamedImportInIndirectExportAssignment_0.ts (1 errors) ==== + export module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + +==== es6ImportNamedImportInIndirectExportAssignment_1.ts (0 errors) ==== + import { a } from "./es6ImportNamedImportInIndirectExportAssignment_0"; + import x = a; + export = x; \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleClassDeclaration.errors.txt b/tests/baselines/reference/es6ModuleClassDeclaration.errors.txt new file mode 100644 index 00000000000..f433a3b425a --- /dev/null +++ b/tests/baselines/reference/es6ModuleClassDeclaration.errors.txt @@ -0,0 +1,121 @@ +es6ModuleClassDeclaration.ts(36,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleClassDeclaration.ts(74,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ModuleClassDeclaration.ts (2 errors) ==== + export class c { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + class c2 { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + new c(); + new c2(); + + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c3 { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + class c4 { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + new c(); + new c2(); + new c3(); + new c4(); + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c3 { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + class c4 { + constructor() { + } + private x = 10; + public y = 30; + static k = 20; + private static l = 30; + private method1() { + } + public method2() { + } + static method3() { + } + private static method4() { + } + } + new c(); + new c2(); + new c3(); + new c4(); + new m1.c3(); + } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleFunctionDeclaration.errors.txt b/tests/baselines/reference/es6ModuleFunctionDeclaration.errors.txt new file mode 100644 index 00000000000..9ce62399717 --- /dev/null +++ b/tests/baselines/reference/es6ModuleFunctionDeclaration.errors.txt @@ -0,0 +1,37 @@ +es6ModuleFunctionDeclaration.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleFunctionDeclaration.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ModuleFunctionDeclaration.ts (2 errors) ==== + export function foo() { + } + function foo2() { + } + foo(); + foo2(); + + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo3() { + } + function foo4() { + } + foo(); + foo2(); + foo3(); + foo4(); + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo3() { + } + function foo4() { + } + foo(); + foo2(); + foo3(); + foo4(); + m1.foo3(); + } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleInternalImport.errors.txt b/tests/baselines/reference/es6ModuleInternalImport.errors.txt new file mode 100644 index 00000000000..ff2cec08e76 --- /dev/null +++ b/tests/baselines/reference/es6ModuleInternalImport.errors.txt @@ -0,0 +1,31 @@ +es6ModuleInternalImport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleInternalImport.ts(7,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleInternalImport.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ModuleInternalImport.ts (3 errors) ==== + export module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var a = 10; + } + export import a1 = m.a; + import a2 = m.a; + var x = a1 + a2; + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import a3 = m.a; + import a4 = m.a; + var x = a1 + a2; + var x2 = a3 + a4; + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import a3 = m.a; + import a4 = m.a; + var x = a1 + a2; + var x2 = a3 + a4; + var x4 = m1.a3 + m2.a3; + } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleLet.errors.txt b/tests/baselines/reference/es6ModuleLet.errors.txt new file mode 100644 index 00000000000..d50770867db --- /dev/null +++ b/tests/baselines/reference/es6ModuleLet.errors.txt @@ -0,0 +1,25 @@ +es6ModuleLet.ts(5,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleLet.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ModuleLet.ts (2 errors) ==== + export let a = "hello"; + export let x: string = a, y = x; + let b = y; + let c: string = b, d = c; + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export let k = a; + export let l: string = b, m = k; + let n = m1.k; + let o: string = n, p = k; + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export let k = a; + export let l: string = b, m = k; + let n = m1.k; + let o: string = n, p = k; + } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleVariableStatement.errors.txt b/tests/baselines/reference/es6ModuleVariableStatement.errors.txt new file mode 100644 index 00000000000..1604943d762 --- /dev/null +++ b/tests/baselines/reference/es6ModuleVariableStatement.errors.txt @@ -0,0 +1,25 @@ +es6ModuleVariableStatement.ts(5,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +es6ModuleVariableStatement.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== es6ModuleVariableStatement.ts (2 errors) ==== + export var a = "hello"; + export var x: string = a, y = x; + var b = y; + var c: string = b, d = c; + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var k = a; + export var l: string = b, m = k; + var n = m1.k; + var o: string = n, p = k; + } + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var k = a; + export var l: string = b, m = k; + var n = m1.k; + var o: string = n, p = k; + } \ No newline at end of file diff --git a/tests/baselines/reference/escapedIdentifiers.errors.txt b/tests/baselines/reference/escapedIdentifiers.errors.txt new file mode 100644 index 00000000000..b6f41d9c3c0 --- /dev/null +++ b/tests/baselines/reference/escapedIdentifiers.errors.txt @@ -0,0 +1,128 @@ +escapedIdentifiers.ts(22,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +escapedIdentifiers.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== escapedIdentifiers.ts (2 errors) ==== + /* + 0 .. \u0030 + 9 .. \u0039 + + A .. \u0041 + Z .. \u005a + + a .. \u0061 + z .. \u00za + */ + + // var decl + var \u0061 = 1; + a ++; + \u0061 ++; + + var b = 1; + b ++; + \u0062 ++; + + // modules + module moduleType1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var baz1: number; + } + module moduleType\u0032 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var baz2: number; + } + + moduleType1.baz1 = 3; + moduleType\u0031.baz1 = 3; + moduleType2.baz2 = 3; + moduleType\u0032.baz2 = 3; + + // classes + + class classType1 { + public foo1: number; + } + class classType\u0032 { + public foo2: number; + } + + var classType1Object1 = new classType1(); + classType1Object1.foo1 = 2; + var classType1Object2 = new classType\u0031(); + classType1Object2.foo1 = 2; + var classType2Object1 = new classType2(); + classType2Object1.foo2 = 2; + var classType2Object2 = new classType\u0032(); + classType2Object2.foo2 = 2; + + // interfaces + interface interfaceType1 { + bar1: number; + } + interface interfaceType\u0032 { + bar2: number; + } + + var interfaceType1Object1 = { bar1: 0 }; + interfaceType1Object1.bar1 = 2; + var interfaceType1Object2 = { bar1: 0 }; + interfaceType1Object2.bar1 = 2; + var interfaceType2Object1 = { bar2: 0 }; + interfaceType2Object1.bar2 = 2; + var interfaceType2Object2 = { bar2: 0 }; + interfaceType2Object2.bar2 = 2; + + + // arguments + class testClass { + public func(arg1: number, arg\u0032: string, arg\u0033: boolean, arg4: number) { + arg\u0031 = 1; + arg2 = 'string'; + arg\u0033 = true; + arg4 = 2; + } + } + + // constructors + class constructorTestClass { + constructor (public arg1: number,public arg\u0032: string,public arg\u0033: boolean,public arg4: number) { + } + } + var constructorTestObject = new constructorTestClass(1, 'string', true, 2); + constructorTestObject.arg\u0031 = 1; + constructorTestObject.arg2 = 'string'; + constructorTestObject.arg\u0033 = true; + constructorTestObject.arg4 = 2; + + // Lables + + l\u0061bel1: + while (false) + { + while(false) + continue label1; // it will go to next iteration of outer loop + } + + label2: + while (false) + { + while(false) + continue l\u0061bel2; // it will go to next iteration of outer loop + } + + label3: + while (false) + { + while(false) + continue label3; // it will go to next iteration of outer loop + } + + l\u0061bel4: + while (false) + { + while(false) + continue l\u0061bel4; // it will go to next iteration of outer loop + } \ No newline at end of file diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index c5e9a1bf5f4..b38ae217a1b 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -1,3 +1,5 @@ +everyTypeWithAnnotationAndInvalidInitializer.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +everyTypeWithAnnotationAndInvalidInitializer.ts(26,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'. everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'. everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'. @@ -24,7 +26,7 @@ everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: n Type 'boolean' is not assignable to type 'string'. -==== everyTypeWithAnnotationAndInvalidInitializer.ts (15 errors) ==== +==== everyTypeWithAnnotationAndInvalidInitializer.ts (17 errors) ==== interface I { id: number; } @@ -43,6 +45,8 @@ everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: n function F2(x: number): boolean { return x < 42; } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class A { name: string; } @@ -51,6 +55,8 @@ everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: n } module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class A { id: number; } diff --git a/tests/baselines/reference/exportAlreadySeen.errors.txt b/tests/baselines/reference/exportAlreadySeen.errors.txt index a34f14a8f7f..ca5b05e06a7 100644 --- a/tests/baselines/reference/exportAlreadySeen.errors.txt +++ b/tests/baselines/reference/exportAlreadySeen.errors.txt @@ -1,17 +1,23 @@ +exportAlreadySeen.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportAlreadySeen.ts(2,12): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(3,12): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(5,12): error TS1030: 'export' modifier already seen. +exportAlreadySeen.ts(5,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportAlreadySeen.ts(6,16): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(7,16): error TS1030: 'export' modifier already seen. +exportAlreadySeen.ts(11,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportAlreadySeen.ts(12,12): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(13,12): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(15,12): error TS1030: 'export' modifier already seen. +exportAlreadySeen.ts(15,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportAlreadySeen.ts(16,16): error TS1030: 'export' modifier already seen. exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen. -==== exportAlreadySeen.ts (10 errors) ==== +==== exportAlreadySeen.ts (14 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export export var x = 1; ~~~~~~ !!! error TS1030: 'export' modifier already seen. @@ -22,6 +28,8 @@ exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen. export export module N { ~~~~~~ !!! error TS1030: 'export' modifier already seen. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export export class C { } ~~~~~~ !!! error TS1030: 'export' modifier already seen. @@ -32,6 +40,8 @@ exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen. } declare module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export export var x; ~~~~~~ !!! error TS1030: 'export' modifier already seen. @@ -42,6 +52,8 @@ exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen. export export module N { ~~~~~~ !!! error TS1030: 'export' modifier already seen. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export export class C { } ~~~~~~ !!! error TS1030: 'export' modifier already seen. diff --git a/tests/baselines/reference/exportAssignClassAndModule.errors.txt b/tests/baselines/reference/exportAssignClassAndModule.errors.txt new file mode 100644 index 00000000000..d759106672d --- /dev/null +++ b/tests/baselines/reference/exportAssignClassAndModule.errors.txt @@ -0,0 +1,22 @@ +exportAssignClassAndModule_0.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== exportAssignClassAndModule_1.ts (0 errors) ==== + /// + import Foo = require('./exportAssignClassAndModule_0'); + + var z: Foo.Bar; + var zz: Foo; + zz.x; +==== exportAssignClassAndModule_0.ts (1 errors) ==== + class Foo { + x: Foo.Bar; + } + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Bar { + } + } + export = Foo; + \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentCircularModules.errors.txt b/tests/baselines/reference/exportAssignmentCircularModules.errors.txt new file mode 100644 index 00000000000..c68845e97c1 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentCircularModules.errors.txt @@ -0,0 +1,32 @@ +foo_0.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +foo_1.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +foo_2.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== foo_2.ts (1 errors) ==== + import foo0 = require("./foo_0"); + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = foo0.x; + } + export = Foo; + +==== foo_0.ts (1 errors) ==== + import foo1 = require('./foo_1'); + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = foo1.x; + } + export = Foo; + +==== foo_1.ts (1 errors) ==== + import foo2 = require("./foo_2"); + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = foo2.x; + } + export = Foo; + \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentCircularModules.types b/tests/baselines/reference/exportAssignmentCircularModules.types index 7756674cf27..2c147fd2d8f 100644 --- a/tests/baselines/reference/exportAssignmentCircularModules.types +++ b/tests/baselines/reference/exportAssignmentCircularModules.types @@ -11,7 +11,9 @@ module Foo { export var x = foo0.x; >x : any +> : ^^^ >foo0.x : any +> : ^^^ >foo0 : typeof foo0 > : ^^^^^^^^^^^ >x : any @@ -32,7 +34,9 @@ module Foo { export var x = foo1.x; >x : any +> : ^^^ >foo1.x : any +> : ^^^ >foo1 : typeof foo1 > : ^^^^^^^^^^^ >x : any @@ -53,7 +57,9 @@ module Foo { export var x = foo2.x; >x : any +> : ^^^ >foo2.x : any +> : ^^^ >foo2 : typeof foo2 > : ^^^^^^^^^^^ >x : any diff --git a/tests/baselines/reference/exportAssignmentInternalModule.errors.txt b/tests/baselines/reference/exportAssignmentInternalModule.errors.txt new file mode 100644 index 00000000000..e822e42645c --- /dev/null +++ b/tests/baselines/reference/exportAssignmentInternalModule.errors.txt @@ -0,0 +1,16 @@ +exportAssignmentInternalModule_A.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== exportAssignmentInternalModule_B.ts (0 errors) ==== + import modM = require("exportAssignmentInternalModule_A"); + + var n: number = modM.x; +==== exportAssignmentInternalModule_A.ts (1 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x; + } + + export = M; + \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentInternalModule.types b/tests/baselines/reference/exportAssignmentInternalModule.types index 8485df8d8a4..1a1854d7b03 100644 --- a/tests/baselines/reference/exportAssignmentInternalModule.types +++ b/tests/baselines/reference/exportAssignmentInternalModule.types @@ -9,6 +9,7 @@ var n: number = modM.x; >n : number > : ^^^^^^ >modM.x : any +> : ^^^ >modM : typeof modM > : ^^^^^^^^^^^ >x : any @@ -21,6 +22,7 @@ module M { export var x; >x : any +> : ^^^ } export = M; diff --git a/tests/baselines/reference/exportAssignmentTopLevelEnumdule.errors.txt b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.errors.txt new file mode 100644 index 00000000000..00d147b283a --- /dev/null +++ b/tests/baselines/reference/exportAssignmentTopLevelEnumdule.errors.txt @@ -0,0 +1,21 @@ +foo_0.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== foo_1.ts (0 errors) ==== + import foo = require("./foo_0"); + var color: foo; + if(color === foo.green){ + color = foo.answer; + } + +==== foo_0.ts (1 errors) ==== + enum foo { + red, green, blue + } + module foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var answer = 42; + } + export = foo; + \ No newline at end of file diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.errors.txt b/tests/baselines/reference/exportDeclarationInInternalModule.errors.txt index 5c998d1c9e0..42de6f1bc4e 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.errors.txt +++ b/tests/baselines/reference/exportDeclarationInInternalModule.errors.txt @@ -1,17 +1,23 @@ +exportDeclarationInInternalModule.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportDeclarationInInternalModule.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportDeclarationInInternalModule.ts(13,19): error TS1141: String literal expected. -==== exportDeclarationInInternalModule.ts (1 errors) ==== +==== exportDeclarationInInternalModule.ts (3 errors) ==== class Bbb { } class Aaa extends Bbb { } module Aaa { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class SomeType { } } module Bbb { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class SomeType { } export * from Aaa; // this line causes the nullref diff --git a/tests/baselines/reference/exportImportAlias.errors.txt b/tests/baselines/reference/exportImportAlias.errors.txt new file mode 100644 index 00000000000..03c11fd92c3 --- /dev/null +++ b/tests/baselines/reference/exportImportAlias.errors.txt @@ -0,0 +1,98 @@ +exportImportAlias.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(9,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(30,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(46,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(51,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAlias.ts(60,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== exportImportAlias.ts (9 errors) ==== + // expect no errors here + + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export var x = 'hello world' + export class Point { + constructor(public x: number, public y: number) { } + } + export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Id { + name: string; + } + } + } + + module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import a = A; + } + + var a: string = C.a.x; + var b: { x: number; y: number; } = new C.a.Point(0, 0); + var c: { name: string }; + var c: C.a.B.Id; + + module X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function Y() { + return 42; + } + + export module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Point { + constructor(public x: number, public y: number) { } + } + } + } + + module Z { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + // 'y' should be a fundule here + export import y = X.Y; + } + + var m: number = Z.y(); + var n: { x: number; y: number; } = new Z.y.Point(0, 0); + + module K { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class L { + constructor(public name: string) { } + } + + export module L { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var y = 12; + export interface Point { + x: number; + y: number; + } + } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import D = K.L; + } + + var o: { name: string }; + var o = new M.D('Hello'); + + var p: { x: number; y: number; } + var p: M.D.Point; \ No newline at end of file diff --git a/tests/baselines/reference/exportImportAndClodule.errors.txt b/tests/baselines/reference/exportImportAndClodule.errors.txt new file mode 100644 index 00000000000..65affb9694e --- /dev/null +++ b/tests/baselines/reference/exportImportAndClodule.errors.txt @@ -0,0 +1,31 @@ +exportImportAndClodule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAndClodule.ts(5,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportAndClodule.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== exportImportAndClodule.ts (3 errors) ==== + module K { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class L { + constructor(public name: string) { } + } + export module L { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var y = 12; + export interface Point { + x: number; + y: number; + } + } + } + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import D = K.L; + } + var o: { name: string }; + var o = new M.D('Hello'); + var p: { x: number; y: number; } + var p: M.D.Point; \ No newline at end of file diff --git a/tests/baselines/reference/exportImportCanSubstituteConstEnumForValue.errors.txt b/tests/baselines/reference/exportImportCanSubstituteConstEnumForValue.errors.txt new file mode 100644 index 00000000000..6b811b8afcb --- /dev/null +++ b/tests/baselines/reference/exportImportCanSubstituteConstEnumForValue.errors.txt @@ -0,0 +1,76 @@ +exportImportCanSubstituteConstEnumForValue.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportCanSubstituteConstEnumForValue.ts(1,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportCanSubstituteConstEnumForValue.ts(1,30): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportCanSubstituteConstEnumForValue.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportImportCanSubstituteConstEnumForValue.ts(31,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== exportImportCanSubstituteConstEnumForValue.ts (5 errors) ==== + module MsPortalFx.ViewModels.Dialogs { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export const enum DialogResult { + Abort, + Cancel, + Ignore, + No, + Ok, + Retry, + Yes, + } + + export interface DialogResultCallback { + (result: MsPortalFx.ViewModels.Dialogs.DialogResult): void; + } + + export function someExportedFunction() { + } + + export const enum MessageBoxButtons { + AbortRetryIgnore, + OK, + OKCancel, + RetryCancel, + YesNo, + YesNoCancel, + } + } + + + module MsPortalFx.ViewModels { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + /** + * For some reason javascript code is emitted for this re-exported const enum. + */ + export import ReExportedEnum = Dialogs.DialogResult; + + /** + * Not exported to show difference. No javascript is emmitted (as expected) + */ + import DialogButtons = Dialogs.MessageBoxButtons; + + /** + * Re-exporting a function type to show difference. No javascript is emmitted (as expected) + */ + export import Callback = Dialogs.DialogResultCallback; + + export class SomeUsagesOfTheseConsts { + constructor() { + // these do get replaced by the const value + const value1 = ReExportedEnum.Cancel; + console.log(value1); + const value2 = DialogButtons.OKCancel; + console.log(value2); + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt index 3838a6a4dc5..713a948708d 100644 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt +++ b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration2.errors.txt @@ -1,8 +1,11 @@ +exportSpecifierReferencingOuterDeclaration2_A.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportSpecifierReferencingOuterDeclaration2_B.ts(1,10): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. -==== exportSpecifierReferencingOuterDeclaration2_A.ts (0 errors) ==== +==== exportSpecifierReferencingOuterDeclaration2_A.ts (1 errors) ==== declare module X { export interface bar { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ==== exportSpecifierReferencingOuterDeclaration2_B.ts (1 errors) ==== export { X }; diff --git a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration4.errors.txt b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration4.errors.txt index 15a7fa2ae93..fe2bc4691ac 100644 --- a/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration4.errors.txt +++ b/tests/baselines/reference/exportSpecifierReferencingOuterDeclaration4.errors.txt @@ -1,11 +1,17 @@ +exportSpecifierReferencingOuterDeclaration2_A.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +exportSpecifierReferencingOuterDeclaration2_B.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. exportSpecifierReferencingOuterDeclaration2_B.ts(4,34): error TS2694: Namespace 'X' has no exported member 'bar'. -==== exportSpecifierReferencingOuterDeclaration2_A.ts (0 errors) ==== +==== exportSpecifierReferencingOuterDeclaration2_A.ts (1 errors) ==== declare module X { export interface bar { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== exportSpecifierReferencingOuterDeclaration2_B.ts (1 errors) ==== +==== exportSpecifierReferencingOuterDeclaration2_B.ts (2 errors) ==== declare module X { export interface foo { } } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export { X }; export declare function foo(): X.foo; export declare function bar(): X.bar; // error diff --git a/tests/baselines/reference/extension.errors.txt b/tests/baselines/reference/extension.errors.txt index 9b1d5d7f597..5b08e95ebec 100644 --- a/tests/baselines/reference/extension.errors.txt +++ b/tests/baselines/reference/extension.errors.txt @@ -1,4 +1,6 @@ +extension.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. extension.ts(10,18): error TS2300: Duplicate identifier 'C'. +extension.ts(15,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. extension.ts(16,5): error TS1128: Declaration or statement expected. extension.ts(16,12): error TS1434: Unexpected keyword or identifier. extension.ts(16,12): error TS2304: Cannot find name 'extension'. @@ -6,7 +8,7 @@ extension.ts(16,28): error TS2300: Duplicate identifier 'C'. extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'. -==== extension.ts (6 errors) ==== +==== extension.ts (8 errors) ==== interface I { x; } @@ -16,6 +18,8 @@ extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'. } declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class C { ~ !!! error TS2300: Duplicate identifier 'C'. @@ -24,6 +28,8 @@ extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'. } declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export extension class C { ~~~~~~ !!! error TS1128: Declaration or statement expected. diff --git a/tests/baselines/reference/externalModuleResolution.errors.txt b/tests/baselines/reference/externalModuleResolution.errors.txt new file mode 100644 index 00000000000..eff21c2f338 --- /dev/null +++ b/tests/baselines/reference/externalModuleResolution.errors.txt @@ -0,0 +1,20 @@ +foo.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== consumer.ts (0 errors) ==== + import x = require('./foo'); + x.Y // .ts should be picked +==== foo.d.ts (0 errors) ==== + declare module M1 { + export var X:number; + } + export = M1 + +==== foo.ts (1 errors) ==== + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var Y = 1; + } + export = M2 + \ No newline at end of file diff --git a/tests/baselines/reference/externalModuleResolution2.errors.txt b/tests/baselines/reference/externalModuleResolution2.errors.txt new file mode 100644 index 00000000000..6cf124089be --- /dev/null +++ b/tests/baselines/reference/externalModuleResolution2.errors.txt @@ -0,0 +1,21 @@ +foo.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== consumer.ts (0 errors) ==== + import x = require('./foo'); + x.X // .ts should be picked +==== foo.ts (1 errors) ==== + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var X = 1; + } + export = M2 + +==== foo.d.ts (0 errors) ==== + declare module M1 { + export var Y:number; + } + export = M1 + + \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatements.errors.txt b/tests/baselines/reference/for-inStatements.errors.txt index 530e47fd2f8..12be39a2a6f 100644 --- a/tests/baselines/reference/for-inStatements.errors.txt +++ b/tests/baselines/reference/for-inStatements.errors.txt @@ -3,10 +3,11 @@ for-inStatements.ts(22,15): error TS2873: This kind of expression is always fals for-inStatements.ts(23,15): error TS2872: This kind of expression is always truthy. for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. +for-inStatements.ts(67,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. for-inStatements.ts(79,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type 'Color.Blue'. -==== for-inStatements.ts (6 errors) ==== +==== for-inStatements.ts (7 errors) ==== var aString: string; for (aString in {}) { } @@ -86,6 +87,8 @@ for-inStatements.ts(79,15): error TS2407: The right-hand side of a 'for...in' st module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class X { name:string } diff --git a/tests/baselines/reference/forStatements.errors.txt b/tests/baselines/reference/forStatements.errors.txt new file mode 100644 index 00000000000..0bc02332086 --- /dev/null +++ b/tests/baselines/reference/forStatements.errors.txt @@ -0,0 +1,52 @@ +forStatements.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== forStatements.ts (1 errors) ==== + interface I { + id: number; + } + + class C implements I { + id: number; + } + + class D{ + source: T; + recurse: D; + wrapped: D> + } + + function F(x: string): number { return 42; } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class A { + name: string; + } + + export function F2(x: number): string { return x.toString(); } + } + + for(var aNumber: number = 9.9;;){} + for(var aString: string = 'this is a string';;){} + for(var aDate: Date = new Date(12);;){} + for(var anObject: Object = new Object();;){} + + for(var anAny: any = null;;){} + for(var aSecondAny: any = undefined;;){} + for(var aVoid: void = undefined;;){} + + for(var anInterface: I = new C();;){} + for(var aClass: C = new C();;){} + for(var aGenericClass: D = new D();;){} + for(var anObjectLiteral: I = { id: 12 };;){} + for(var anOtherObjectLiteral: { id: number } = new C();;){} + + for(var aFunction: typeof F = F;;){} + for(var anOtherFunction: (x: string) => number = F;;){} + for(var aLambda: typeof F = (x) => 2;;){} + + for(var aModule: typeof M = M;;){} + for(var aClassInModule: M.A = new M.A();;){} + for(var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';;){} \ No newline at end of file diff --git a/tests/baselines/reference/forStatements.types b/tests/baselines/reference/forStatements.types index 2d9fdfc3b34..f011966c273 100644 --- a/tests/baselines/reference/forStatements.types +++ b/tests/baselines/reference/forStatements.types @@ -101,9 +101,11 @@ for(var anObject: Object = new Object();;){} for(var anAny: any = null;;){} >anAny : any +> : ^^^ for(var aSecondAny: any = undefined;;){} >aSecondAny : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ diff --git a/tests/baselines/reference/funClodule.errors.txt b/tests/baselines/reference/funClodule.errors.txt index 7bdb4d0311a..151e2c7bbea 100644 --- a/tests/baselines/reference/funClodule.errors.txt +++ b/tests/baselines/reference/funClodule.errors.txt @@ -1,10 +1,15 @@ +funClodule.ts(2,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +funClodule.ts(9,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. funClodule.ts(15,10): error TS2814: Function with bodies can only merge with classes that are ambient. +funClodule.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. funClodule.ts(19,7): error TS2813: Class declaration cannot implement overload list for 'foo3'. -==== funClodule.ts (2 errors) ==== +==== funClodule.ts (5 errors) ==== declare function foo(); declare module foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function x(): any; } declare class foo { } // Should error @@ -12,6 +17,8 @@ funClodule.ts(19,7): error TS2813: Class declaration cannot implement overload l declare class foo2 { } declare module foo2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function x(): any; } declare function foo2(); // Should error @@ -22,6 +29,8 @@ funClodule.ts(19,7): error TS2813: Class declaration cannot implement overload l !!! error TS2814: Function with bodies can only merge with classes that are ambient. !!! related TS6506 funClodule.ts:19:7: Consider adding a 'declare' modifier to this class. module foo3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function x(): any { } } class foo3 { } // Should error diff --git a/tests/baselines/reference/funcdecl.errors.txt b/tests/baselines/reference/funcdecl.errors.txt new file mode 100644 index 00000000000..80819ca6535 --- /dev/null +++ b/tests/baselines/reference/funcdecl.errors.txt @@ -0,0 +1,77 @@ +funcdecl.ts(51,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== funcdecl.ts (1 errors) ==== + function simpleFunc() { + return "this is my simple func"; + } + var simpleFuncVar = simpleFunc; + + function anotherFuncNoReturn() { + } + var anotherFuncNoReturnVar = anotherFuncNoReturn; + + function withReturn() : string{ + return "Hello"; + } + var withReturnVar = withReturn; + + function withParams(a : string) : string{ + return a; + } + var withparamsVar = withParams; + + function withMultiParams(a : number, b, c: Object) { + return a; + } + var withMultiParamsVar = withMultiParams; + + function withOptionalParams(a?: string) { + } + var withOptionalParamsVar = withOptionalParams; + + function withInitializedParams(a: string, b0, b = 30, c = "string value") { + } + var withInitializedParamsVar = withInitializedParams; + + function withOptionalInitializedParams(a: string, c: string = "hello string") { + } + var withOptionalInitializedParamsVar = withOptionalInitializedParams; + + function withRestParams(a: string, ... myRestParameter : number[]) { + return myRestParameter; + } + var withRestParamsVar = withRestParams; + + function overload1(n: number) : string; + function overload1(s: string) : string; + function overload1(ns: any) { + return ns.toString(); + } + var withOverloadSignature = overload1; + + function f(n: () => void) { } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo(n: () => void ) { + } + + } + + m2.foo(() => { + + var b = 30; + return b; + }); + + + declare function fooAmbient(n: number): string; + + declare function overloadAmbient(n: number): string; + declare function overloadAmbient(s: string): string; + + var f2 = () => { + return "string"; + } \ No newline at end of file diff --git a/tests/baselines/reference/funcdecl.types b/tests/baselines/reference/funcdecl.types index 8e72055ce90..6a019504ffc 100644 --- a/tests/baselines/reference/funcdecl.types +++ b/tests/baselines/reference/funcdecl.types @@ -61,6 +61,7 @@ function withMultiParams(a : number, b, c: Object) { >a : number > : ^^^^^^ >b : any +> : ^^^ >c : Object > : ^^^^^^ @@ -92,6 +93,7 @@ function withInitializedParams(a: string, b0, b = 30, c = "string value") { >a : string > : ^^^^^^ >b0 : any +> : ^^^ >b : number > : ^^^^^^ >30 : 30 @@ -157,10 +159,13 @@ function overload1(ns: any) { >overload1 : { (n: number): string; (s: string): string; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >ns : any +> : ^^^ return ns.toString(); >ns.toString() : any +> : ^^^ >ns.toString : any +> : ^^^ >ns : any > : ^^^ >toString : any diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index 74e8f5bdc79..6ed8062c4e8 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -1,6 +1,7 @@ functionOverloadErrors.ts(2,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public, private or protected. functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public, private or protected. +functionOverloadErrors.ts(74,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or non-exported. functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or non-exported. functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient. @@ -11,7 +12,7 @@ functionOverloadErrors.ts(103,10): error TS2394: This overload signature is not functionOverloadErrors.ts(116,19): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -==== functionOverloadErrors.ts (11 errors) ==== +==== functionOverloadErrors.ts (12 errors) ==== //Function overload signature with initializer function fn1(x = 3); ~~~~~ @@ -92,6 +93,8 @@ functionOverloadErrors.ts(116,19): error TS2371: A parameter initializer is only //Function overloads with differing export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function fn1(); ~~~ !!! error TS2383: Overload signatures must all be exported or non-exported. diff --git a/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.errors.txt b/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.errors.txt new file mode 100644 index 00000000000..d9f46cf273e --- /dev/null +++ b/tests/baselines/reference/funduleExportedClassIsUsedBeforeDeclaration.errors.txt @@ -0,0 +1,15 @@ +funduleExportedClassIsUsedBeforeDeclaration.ts(5,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== funduleExportedClassIsUsedBeforeDeclaration.ts (1 errors) ==== + interface A { // interface before module declaration + (): B.C; // uses defined below class in module + } + declare function B(): B.C; // function merged with module + declare module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C { // class defined in module + } + } + new B.C(); \ No newline at end of file diff --git a/tests/baselines/reference/generatedContextualTyping.errors.txt b/tests/baselines/reference/generatedContextualTyping.errors.txt index a33af3a8946..a6836eb2816 100644 --- a/tests/baselines/reference/generatedContextualTyping.errors.txt +++ b/tests/baselines/reference/generatedContextualTyping.errors.txt @@ -1,3 +1,27 @@ +generatedContextualTyping.ts(186,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(187,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(188,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(189,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(190,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(191,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(192,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(193,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(194,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(195,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(196,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(197,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(198,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(199,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(200,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(201,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(202,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(203,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(204,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(205,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(206,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(207,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(208,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +generatedContextualTyping.ts(209,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. generatedContextualTyping.ts(219,12): error TS2873: This kind of expression is always falsy. generatedContextualTyping.ts(220,12): error TS2873: This kind of expression is always falsy. generatedContextualTyping.ts(221,12): error TS2873: This kind of expression is always falsy. @@ -32,7 +56,7 @@ generatedContextualTyping.ts(281,36): error TS2872: This kind of expression is a generatedContextualTyping.ts(282,28): error TS2872: This kind of expression is always truthy. -==== generatedContextualTyping.ts (32 errors) ==== +==== generatedContextualTyping.ts (56 errors) ==== class Base { private p; } class Derived1 extends Base { private m; } class Derived2 extends Base { private n; } @@ -219,29 +243,77 @@ generatedContextualTyping.ts(282,28): error TS2872: This kind of expression is a var x179: () => (s: Base[]) => any = function() { return n => { var n: Base[]; return null; }; }; var x180: () => Genric = function() { return { func: n => { return [d1, d2]; } }; }; module x181 { var t: () => Base[] = () => [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x182 { var t: () => Base[] = function() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x183 { var t: () => Base[] = function named() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x184 { var t: { (): Base[]; } = () => [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x185 { var t: { (): Base[]; } = function() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x186 { var t: { (): Base[]; } = function named() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x187 { var t: Base[] = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x188 { var t: Array = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x189 { var t: { [n: number]: Base; } = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x190 { var t: {n: Base[]; } = { n: [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x191 { var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x192 { var t: Genric = { func: n => { return [d1, d2]; } }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x193 { export var t: () => Base[] = () => [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x194 { export var t: () => Base[] = function() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x195 { export var t: () => Base[] = function named() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x196 { export var t: { (): Base[]; } = () => [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x197 { export var t: { (): Base[]; } = function() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x198 { export var t: { (): Base[]; } = function named() { return [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x199 { export var t: Base[] = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x200 { export var t: Array = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x201 { export var t: { [n: number]: Base; } = [d1, d2]; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x202 { export var t: {n: Base[]; } = { n: [d1, d2] }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x203 { export var t: (s: Base[]) => any = n => { var n: Base[]; return null; }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module x204 { export var t: Genric = { func: n => { return [d1, d2]; } }; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x206 = <() => Base[]>function() { return [d1, d2] }; var x207 = <() => Base[]>function named() { return [d1, d2] }; var x209 = <{ (): Base[]; }>function() { return [d1, d2] }; diff --git a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt index 653b071b3b4..3e5144c7bb3 100644 --- a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt +++ b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt @@ -1,6 +1,10 @@ +genericCallToOverloadedMethodWithOverloadedArguments.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallToOverloadedMethodWithOverloadedArguments.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallToOverloadedMethodWithOverloadedArguments.ts(23,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. +genericCallToOverloadedMethodWithOverloadedArguments.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallToOverloadedMethodWithOverloadedArguments.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallToOverloadedMethodWithOverloadedArguments.ts(52,38): error TS2769: No overload matches this call. Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. @@ -10,6 +14,7 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(52,38): error TS2769: No Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. +genericCallToOverloadedMethodWithOverloadedArguments.ts(57,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallToOverloadedMethodWithOverloadedArguments.ts(68,38): error TS2769: No overload matches this call. Overload 1 of 3, '(cb: (x: number) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. @@ -23,6 +28,7 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(68,38): error TS2769: No Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. +genericCallToOverloadedMethodWithOverloadedArguments.ts(73,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No overload matches this call. Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. @@ -34,8 +40,10 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No Type 'number' is not assignable to type 'boolean'. -==== genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ==== +==== genericCallToOverloadedMethodWithOverloadedArguments.ts (10 errors) ==== module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; } @@ -49,6 +57,8 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No ////////////////////////////////////// module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; } @@ -67,6 +77,8 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No ////////////////////////////////////// module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; then(cb: (x: T) => Promise, error?: (error: any) => Promise): Promise; @@ -81,6 +93,8 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No ////////////////////////////////////// module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; then(cb: (x: T) => Promise, error?: (error: any) => Promise): Promise; @@ -106,6 +120,8 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No ////////////////////////////////////// module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; then(cb: (x: T) => Promise, error?: (error: any) => Promise): Promise; @@ -136,6 +152,8 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No ////////////////////////////////////// module m6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Promise { then(cb: (x: T) => Promise): Promise; then(cb: (x: T) => Promise, error?: (error: any) => Promise): Promise; diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 6a958e04b9c..f8035ccbd1a 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -1,3 +1,4 @@ +genericCallWithGenericSignatureArguments2.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallWithGenericSignatureArguments2.ts(10,51): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. @@ -10,6 +11,7 @@ genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of t Type 'Date' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'Date'. genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. +genericCallWithGenericSignatureArguments2.ts(40,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. @@ -22,11 +24,13 @@ genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find n genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'. -==== genericCallWithGenericSignatureArguments2.ts (10 errors) ==== +==== genericCallWithGenericSignatureArguments2.ts (12 errors) ==== // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. module onlyT { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function foo(a: (x: T) => T, b: (x: T) => T) { var r: (x: T) => T; return r; @@ -81,6 +85,8 @@ genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find n } module TU { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function foo(a: (x: T) => T, b: (x: U) => U) { var r: (x: T) => T; return r; diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt new file mode 100644 index 00000000000..6b1058efa9e --- /dev/null +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt @@ -0,0 +1,57 @@ +genericCallWithOverloadedConstructorTypedArguments.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallWithOverloadedConstructorTypedArguments.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericCallWithOverloadedConstructorTypedArguments.ts (2 errors) ==== + // Function typed arguments with multiple signatures must be passed an implementation that matches all of them + // Inferences are made quadratic-pairwise to and from these overload sets + + module NonGenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a: { + new(x: boolean): boolean; + new(x: string): string; + } + + function foo4(cb: typeof a) { + return new cb(null); + } + + var r = foo4(a); + var b: { new (x: T): T }; + var r2 = foo4(b); + } + + module GenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo5(cb: { new(x: T): string; new(x: number): T }) { + return cb; + } + + var a: { + new (x: boolean): string; + new (x: number): boolean; + } + var r5 = foo5(a); // new{} => string; new(x:number) => {} + var b: { new(x: T): string; new(x: number): T; } + var r7 = foo5(b); // new any => string; new(x:number) => any + + function foo6(cb: { new(x: T): string; new(x: T, y?: T): string }) { + return cb; + } + + var r8 = foo6(a); // error + var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string + + function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { + return cb; + } + + var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string + var c: { new (x: T): string; (x: number): T; } + var c2: { new (x: T): string; new(x: number): T; } + var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string + var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string + } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt index 37ba19c5696..88a81c3a464 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt @@ -1,12 +1,16 @@ +genericCallWithOverloadedConstructorTypedArguments2.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallWithOverloadedConstructorTypedArguments2.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: unknown): string; new (x: unknown, y?: unknown): string; }'. Target signature provides too few arguments. Expected 2 or more, but got 1. -==== genericCallWithOverloadedConstructorTypedArguments2.ts (1 errors) ==== +==== genericCallWithOverloadedConstructorTypedArguments2.ts (3 errors) ==== // Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a: { new(x: boolean): boolean; new(x: string): string; @@ -21,6 +25,8 @@ genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Arg } module GenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function foo5(cb: { new(x: T): string; new(x: number): T }) { return cb; } diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.errors.txt new file mode 100644 index 00000000000..5df4b57f0c0 --- /dev/null +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.errors.txt @@ -0,0 +1,53 @@ +genericCallWithOverloadedFunctionTypedArguments.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallWithOverloadedFunctionTypedArguments.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericCallWithOverloadedFunctionTypedArguments.ts (2 errors) ==== + // Function typed arguments with multiple signatures must be passed an implementation that matches all of them + // Inferences are made quadratic-pairwise to and from these overload sets + + module NonGenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a: { + (x: boolean): boolean; + (x: string): string; + } + + function foo4(cb: typeof a) { + return cb; + } + + var r = foo4(a); + var r2 = foo4((x: T) => x); + var r4 = foo4(x => x); + } + + module GenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo5(cb: { (x: T): string; (x: number): T }) { + return cb; + } + + var r5 = foo5(x => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed]. T is any + var a: { (x: T): string; (x: number): T; } + var r7 = foo5(a); // any => string (+1 overload) + + function foo6(cb: { (x: T): string; (x: T, y?: T): string }) { + return cb; + } + + var r8 = foo6(x => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed]. T is any + var r9 = foo6((x: T) => ''); // any => string (+1 overload) + var r11 = foo6((x: T, y?: T) => ''); // any => string (+1 overload) + + function foo7(x:T, cb: { (x: T): string; (x: T, y?: T): string }) { + return cb; + } + + var r12 = foo7(1, (x) => x); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] + var r13 = foo7(1, (x: T) => ''); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] + var a: { (x: T): string; (x: number): T; } + var r14 = foo7(1, a); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] + } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types index 896f081b5c8..cc98a618bda 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types @@ -68,7 +68,9 @@ module NonGenericParameter { >x => x : (x: any) => any > : ^ ^^^^^^^^^^^^^ >x : any +> : ^^^ >x : any +> : ^^^ } module GenericParameter { @@ -100,7 +102,9 @@ module GenericParameter { >x => x : (x: any) => any > : ^ ^^^^^^^^^^^^^ >x : any +> : ^^^ >x : any +> : ^^^ var a: { (x: T): string; (x: number): T; } >a : { (x: T): string; (x: number): T; } @@ -147,7 +151,9 @@ module GenericParameter { >x => x : (x: any) => any > : ^ ^^^^^^^^^^^^^ >x : any +> : ^^^ >x : any +> : ^^^ var r9 = foo6((x: T) => ''); // any => string (+1 overload) >r9 : { (x: unknown): string; (x: unknown, y?: unknown): string; } @@ -210,7 +216,9 @@ module GenericParameter { >(x) => x : (x: any) => any > : ^ ^^^^^^^^^^^^^ >x : any +> : ^^^ >x : any +> : ^^^ var r13 = foo7(1, (x: T) => ''); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] >r13 : { (x: unknown): string; (x: unknown, y?: unknown): string; } diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt index 505bc85e1fc..d2bde0f2fe9 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt @@ -1,12 +1,16 @@ +genericCallWithOverloadedFunctionTypedArguments2.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericCallWithOverloadedFunctionTypedArguments2.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: unknown): string; (x: unknown, y?: unknown): string; }'. Target signature provides too few arguments. Expected 2 or more, but got 1. -==== genericCallWithOverloadedFunctionTypedArguments2.ts (1 errors) ==== +==== genericCallWithOverloadedFunctionTypedArguments2.ts (3 errors) ==== // Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a: { (x: boolean): boolean; (x: string): string; @@ -20,6 +24,8 @@ genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argume } module GenericParameter { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function foo5(cb: { (x: T): string; (x: number): T }) { return cb; } diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.errors.txt b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.errors.txt new file mode 100644 index 00000000000..4837bfdefa5 --- /dev/null +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.errors.txt @@ -0,0 +1,102 @@ +genericClassPropertyInheritanceSpecialization.ts(36,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(40,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(40,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(40,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(53,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(53,17): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(53,28): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassPropertyInheritanceSpecialization.ts(53,37): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericClassPropertyInheritanceSpecialization.ts (8 errors) ==== + interface KnockoutObservableBase { + peek(): T; + (): T; + (value: T): void; + } + + interface KnockoutObservable extends KnockoutObservableBase { + equalityComparer(a: T, b: T): boolean; + valueHasMutated(): void; + valueWillMutate(): void; + } + + interface KnockoutObservableArray extends KnockoutObservable { + indexOf(searchElement: T, fromIndex?: number): number; + slice(start: number, end?: number): T[]; + splice(start: number, deleteCount?: number, ...items: T[]): T[]; + pop(): T; + push(...items: T[]): void; + shift(): T; + unshift(...items: T[]): number; + reverse(): T[]; + sort(compareFunction?: (a: T, b: T) => number): void; + replace(oldItem: T, newItem: T): void; + remove(item: T): T[]; + removeAll(items?: T[]): T[]; + destroy(item: T): void; + destroyAll(items?: T[]): void; + } + + interface KnockoutObservableArrayStatic { + fn: KnockoutObservableArray; + + (value?: T[]): KnockoutObservableArray; + } + + declare module ko { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var observableArray: KnockoutObservableArrayStatic; + } + + module Portal.Controls.Validators { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Validator { + private _subscription; + public message: KnockoutObservable; + public validationState: KnockoutObservable; + public validate: KnockoutObservable; + constructor(message?: string) { } + public destroy(): void { } + public _validate(value: TValue): number {return 0 } + } + } + + module PortalFx.ViewModels.Controls.Validators { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class Validator extends Portal.Controls.Validators.Validator { + + constructor(message?: string) { + super(message); + } + } + + } + + interface Contract { + + validators: KnockoutObservableArray>; + } + + + class ViewModel implements Contract { + + public validators: KnockoutObservableArray> = ko.observableArray>(); + } + + \ No newline at end of file diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types index 8df471267cb..42a1d3f9580 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.types @@ -157,6 +157,7 @@ module Portal.Controls.Validators { private _subscription; >_subscription : any +> : ^^^ public message: KnockoutObservable; >message : KnockoutObservable diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index a9961dcb2d9..cd307c0bdb9 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,3 +1,5 @@ +genericClassWithFunctionTypedMemberArguments.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassWithFunctionTypedMemberArguments.ts(27,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. @@ -14,11 +16,13 @@ genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument o Type 'string' is not assignable to type '1'. -==== genericClassWithFunctionTypedMemberArguments.ts (4 errors) ==== +==== genericClassWithFunctionTypedMemberArguments.ts (6 errors) ==== // Generic functions used as arguments for function typed parameters are not used to make inferences from // Using function arguments, no errors expected module ImmediatelyFix { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C { foo(x: (a: T) => T) { return x(null); @@ -42,6 +46,8 @@ genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument o } module WithCandidates { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C { foo2(x: T, cb: (a: T) => U) { return cb(x); diff --git a/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.errors.txt b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.errors.txt new file mode 100644 index 00000000000..93b04779b63 --- /dev/null +++ b/tests/baselines/reference/genericClassWithObjectTypeArgsAndConstraints.errors.txt @@ -0,0 +1,69 @@ +genericClassWithObjectTypeArgsAndConstraints.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericClassWithObjectTypeArgsAndConstraints.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericClassWithObjectTypeArgsAndConstraints.ts (2 errors) ==== + // Generic call with constraints infering type parameter from object member properties + // No errors expected + + class C { + x: string; + } + + class D { + x: string; + y: string; + } + + class X { + x: T; + } + + module Class { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class G { + foo(t: X, t2: X) { + var x: T; + return x; + } + } + + var c1 = new X(); + var d1 = new X(); + var g: G<{ x: string; y: string }>; + var r = g.foo(c1, d1); + var r2 = g.foo(c1, c1); + + class G2 { + foo2(t: X, t2: X) { + var x: T; + return x; + } + } + var g2: G2; + var r = g2.foo2(c1, d1); + var r2 = g2.foo2(c1, c1); + } + + module Interface { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface G { + foo(t: X, t2: X): T; + } + + var c1 = new X(); + var d1 = new X(); + var g: G<{ x: string; y: string }>; + var r = g.foo(c1, d1); + var r2 = g.foo(c1, c1); + + interface G2 { + foo2(t: X, t2: X): T; + } + + var g2: G2; + var r = g2.foo2(c1, d1); + var r2 = g2.foo2(c1, c1); + } \ No newline at end of file diff --git a/tests/baselines/reference/genericClassWithStaticFactory.errors.txt b/tests/baselines/reference/genericClassWithStaticFactory.errors.txt new file mode 100644 index 00000000000..8ad8fceb283 --- /dev/null +++ b/tests/baselines/reference/genericClassWithStaticFactory.errors.txt @@ -0,0 +1,147 @@ +genericClassWithStaticFactory.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericClassWithStaticFactory.ts (1 errors) ==== + module Editor { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export class List { + public next: List; + public prev: List; + private listFactory: ListFactory; + + constructor(public isHead: boolean, public data: T) { + this.listFactory = new ListFactory(); + + } + + public add(data: T): List { + var entry = this.listFactory.MakeEntry(data); + + this.prev.next = entry; + entry.next = this; + entry.prev = this.prev; + this.prev = entry; + return entry; + } + + public count(): number { + var entry: List; + var i: number; + + entry = this.next; + for (i = 0; !(entry.isHead); i++) { + entry = entry.next; + } + + return (i); + } + + public isEmpty(): boolean { + return (this.next == this); + } + + public first(): T { + if (this.isEmpty()) + { + return this.next.data; + } + else { + return null; + } + } + + public pushEntry(entry: List): void { + entry.isHead = false; + entry.next = this.next; + entry.prev = this; + this.next = entry; + entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does + } + + public push(data: T): void { + var entry = this.listFactory.MakeEntry(data); + entry.data = data; + entry.isHead = false; + entry.next = this.next; + entry.prev = this; + this.next = entry; + entry.next.prev = entry; // entry.next.prev does not show intellisense, but entry.prev.prev does + } + + public popEntry(head: List): List { + if (this.next.isHead) { + return null; + } + else { + return this.listFactory.RemoveEntry(this.next); + } + } + + public insertEntry(entry: List): List { + entry.isHead = false; + this.prev.next = entry; + entry.next = this; + entry.prev = this.prev; + this.prev = entry; + return entry; + } + + public insertAfter(data: T): List { + var entry: List = this.listFactory.MakeEntry(data); + entry.next = this.next; + entry.prev = this; + this.next = entry; + entry.next.prev = entry;// entry.next.prev does not show intellisense, but entry.prev.prev does + return entry; + } + + public insertEntryBefore(entry: List): List { + this.prev.next = entry; + + entry.next = this; + entry.prev = this.prev; + this.prev = entry; + return entry; + } + + public insertBefore(data: T): List { + var entry = this.listFactory.MakeEntry(data); + return this.insertEntryBefore(entry); + } + } + + export class ListFactory { + + public MakeHead(): List { + var entry: List = new List(true, null); + entry.prev = entry; + entry.next = entry; + return entry; + } + + public MakeEntry(data: T): List { + var entry: List = new List(false, data); + entry.prev = entry; + entry.next = entry; + return entry; + } + + public RemoveEntry(entry: List): List { + if (entry == null) { + return null; + } + else if (entry.isHead) { + // Can't remove the head of a list! + return null; + } + else { + entry.next.prev = entry.prev; + entry.prev.next = entry.next; + + return entry; + } + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/genericClassesRedeclaration.errors.txt b/tests/baselines/reference/genericClassesRedeclaration.errors.txt index 4e51674e9c5..85423706358 100644 --- a/tests/baselines/reference/genericClassesRedeclaration.errors.txt +++ b/tests/baselines/reference/genericClassesRedeclaration.errors.txt @@ -1,13 +1,17 @@ +genericClassesRedeclaration.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericClassesRedeclaration.ts(3,9): error TS2374: Duplicate index signature for type 'string'. genericClassesRedeclaration.ts(16,11): error TS2300: Duplicate identifier 'StringHashTable'. genericClassesRedeclaration.ts(29,11): error TS2300: Duplicate identifier 'IdentifierNameHashTable'. +genericClassesRedeclaration.ts(40,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericClassesRedeclaration.ts(42,9): error TS2374: Duplicate index signature for type 'string'. genericClassesRedeclaration.ts(55,11): error TS2300: Duplicate identifier 'StringHashTable'. genericClassesRedeclaration.ts(68,11): error TS2300: Duplicate identifier 'IdentifierNameHashTable'. -==== genericClassesRedeclaration.ts (6 errors) ==== +==== genericClassesRedeclaration.ts (8 errors) ==== declare module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface IIndexable { [s: string]: T; ~~~~~~~~~~~~~~~ @@ -53,6 +57,8 @@ genericClassesRedeclaration.ts(68,11): error TS2300: Duplicate identifier 'Ident } declare module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface IIndexable { [s: string]: T; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericOfACloduleType1.errors.txt b/tests/baselines/reference/genericOfACloduleType1.errors.txt new file mode 100644 index 00000000000..1940ab3ee36 --- /dev/null +++ b/tests/baselines/reference/genericOfACloduleType1.errors.txt @@ -0,0 +1,21 @@ +genericOfACloduleType1.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericOfACloduleType1.ts(4,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericOfACloduleType1.ts (2 errors) ==== + class G{ bar(x: T) { return x; } } + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C { foo() { } } + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class X { + } + } + + var g1 = new G(); + g1.bar(null).foo(); + } + var g2 = new G() // was: error Type reference cannot refer to container 'M.C'. \ No newline at end of file diff --git a/tests/baselines/reference/genericOfACloduleType2.errors.txt b/tests/baselines/reference/genericOfACloduleType2.errors.txt new file mode 100644 index 00000000000..fbaac179275 --- /dev/null +++ b/tests/baselines/reference/genericOfACloduleType2.errors.txt @@ -0,0 +1,27 @@ +genericOfACloduleType2.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericOfACloduleType2.ts(4,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +genericOfACloduleType2.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== genericOfACloduleType2.ts (3 errors) ==== + class G{ bar(x: T) { return x; } } + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C { foo() { } } + export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class X { + } + } + + var g1 = new G(); + g1.bar(null).foo(); // no error + } + + module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var g2 = new G() + } \ No newline at end of file diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt index 0a3d27451fd..7f56668fdf3 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.errors.txt @@ -1,4 +1,6 @@ +genericRecursiveImplicitConstructorErrors3.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericRecursiveImplicitConstructorErrors3.ts(3,66): error TS2314: Generic type 'MemberName' requires 3 type argument(s). +genericRecursiveImplicitConstructorErrors3.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. genericRecursiveImplicitConstructorErrors3.ts(10,22): error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). genericRecursiveImplicitConstructorErrors3.ts(12,48): error TS2314: Generic type 'PullSymbol' requires 3 type argument(s). genericRecursiveImplicitConstructorErrors3.ts(13,31): error TS2314: Generic type 'PullTypeSymbol' requires 3 type argument(s). @@ -7,8 +9,10 @@ genericRecursiveImplicitConstructorErrors3.ts(18,53): error TS2314: Generic type genericRecursiveImplicitConstructorErrors3.ts(19,22): error TS2339: Property 'isArray' does not exist on type 'PullTypeSymbol'. -==== genericRecursiveImplicitConstructorErrors3.ts (7 errors) ==== +==== genericRecursiveImplicitConstructorErrors3.ts (9 errors) ==== module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class MemberName { static create(arg1: any, arg2?: any, arg3?: any): MemberName { ~~~~~~~~~~ @@ -18,6 +22,8 @@ genericRecursiveImplicitConstructorErrors3.ts(19,22): error TS2339: Property 'is } module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class PullSymbol { public type: PullTypeSymbol = null; ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 47c79a67ce9..bdb856bb28a 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -19,6 +19,7 @@ giant.ts(36,20): error TS1005: '{' expected. giant.ts(62,5): error TS1021: An index signature must have a type annotation. giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. +giant.ts(78,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'. giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'. giant.ts(88,24): error TS1005: '{' expected. @@ -40,7 +41,11 @@ giant.ts(100,24): error TS1005: '{' expected. giant.ts(126,9): error TS1021: An index signature must have a type annotation. giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(142,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(147,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(152,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(154,39): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(156,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. giant.ts(167,24): error TS1005: '{' expected. @@ -62,7 +67,11 @@ giant.ts(179,24): error TS1005: '{' expected. giant.ts(205,9): error TS1021: An index signature must have a type annotation. giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(221,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(226,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(231,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(233,39): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(235,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(238,35): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(240,24): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(243,21): error TS1183: An implementation cannot be declared in ambient contexts. @@ -86,9 +95,12 @@ giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. giant.ts(257,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. +giant.ts(260,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(262,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts. +giant.ts(265,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(267,30): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(270,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'. giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'. giant.ts(282,20): error TS1005: '{' expected. @@ -110,6 +122,7 @@ giant.ts(294,20): error TS1005: '{' expected. giant.ts(320,5): error TS1021: An index signature must have a type annotation. giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. +giant.ts(336,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'. giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'. giant.ts(346,24): error TS1005: '{' expected. @@ -131,7 +144,11 @@ giant.ts(358,24): error TS1005: '{' expected. giant.ts(384,9): error TS1021: An index signature must have a type annotation. giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(400,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(405,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(410,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(412,39): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(414,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. giant.ts(425,24): error TS1005: '{' expected. @@ -153,7 +170,11 @@ giant.ts(437,24): error TS1005: '{' expected. giant.ts(463,9): error TS1021: An index signature must have a type annotation. giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(479,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(484,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +giant.ts(489,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(491,39): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(493,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(496,35): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(498,24): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(501,21): error TS1183: An implementation cannot be declared in ambient contexts. @@ -177,9 +198,12 @@ giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. giant.ts(515,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. +giant.ts(518,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(520,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts. +giant.ts(523,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(525,30): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(528,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(532,31): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(534,20): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(537,17): error TS1183: An implementation cannot be declared in ambient contexts. @@ -203,6 +227,7 @@ giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. giant.ts(551,18): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. +giant.ts(554,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(556,18): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts. giant.ts(558,24): error TS1183: An implementation cannot be declared in ambient contexts. @@ -211,14 +236,18 @@ giant.ts(563,21): error TS1183: An implementation cannot be declared in ambient giant.ts(588,9): error TS1021: An index signature must have a type annotation. giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(604,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(606,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts. +giant.ts(609,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(611,30): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(614,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(615,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. giant.ts(616,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. giant.ts(616,39): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(617,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. +giant.ts(618,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(621,26): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(623,24): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(626,21): error TS1183: An implementation cannot be declared in ambient contexts. @@ -226,12 +255,15 @@ giant.ts(628,21): error TS1183: An implementation cannot be declared in ambient giant.ts(654,9): error TS1021: An index signature must have a type annotation. giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. +giant.ts(670,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(672,22): error TS1183: An implementation cannot be declared in ambient contexts. giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts. +giant.ts(674,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient contexts. +giant.ts(679,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== giant.ts (231 errors) ==== +==== giant.ts (263 errors) ==== /* Prefixes p -> public @@ -352,6 +384,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { @@ -458,22 +492,30 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { }; interface I { }; module M { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; export class eC { }; export interface eI { }; export module eM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export declare var eaV; export declare function eaF() { }; ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } export var eV; export function eF() { }; @@ -581,22 +623,30 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } export module eM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { }; interface I { }; module M { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; export class eC { }; export interface eI { }; export module eM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export declare var eaV; export declare function eaF() { }; ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } export declare var eaV; export declare function eaF() { }; @@ -668,6 +718,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; ~ @@ -677,6 +729,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient class C { } interface I { } module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; ~ @@ -684,6 +738,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient export class eC { } export interface eI { } export module eM { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } } export var eV; @@ -792,6 +848,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } export module eM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { @@ -898,22 +956,30 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { }; interface I { }; module M { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; export class eC { }; export interface eI { }; export module eM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export declare var eaV; export declare function eaF() { }; ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } export var eV; export function eF() { }; @@ -1021,22 +1087,30 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } export module eM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; class C { }; interface I { }; module M { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; export class eC { }; export interface eI { }; export module eM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export declare var eaV; export declare function eaF() { }; ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } export declare var eaV; export declare function eaF() { }; @@ -1108,6 +1182,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; ~ @@ -1117,6 +1193,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient class C { } interface I { } module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; ~ @@ -1124,6 +1202,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient export class eC { } export interface eI { } export module eM { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } } export declare var eaV; @@ -1196,6 +1276,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2300: Duplicate identifier 'tgF'. } export declare module eaM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; ~ @@ -1262,6 +1344,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; ~ @@ -1271,6 +1355,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient class C { } interface I { } module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; ~ @@ -1278,6 +1364,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient export class eC { } export interface eI { } export module eM { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export declare var eaV ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -1292,6 +1380,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient export declare module eaM { } ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } export var eV; export function eF() { }; @@ -1358,6 +1448,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS2386: Overload signatures must all be optional or required. } export module eM { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var V; function F() { }; ~ @@ -1366,6 +1458,8 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient !!! error TS1036: Statements are not allowed in ambient contexts. class C { } module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var eV; export function eF() { }; ~ @@ -1373,5 +1467,7 @@ giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient export class eC { } export interface eI { } export module eM { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } } \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.errors.txt b/tests/baselines/reference/heterogeneousArrayLiterals.errors.txt new file mode 100644 index 00000000000..4f4365ee91a --- /dev/null +++ b/tests/baselines/reference/heterogeneousArrayLiterals.errors.txt @@ -0,0 +1,140 @@ +heterogeneousArrayLiterals.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +heterogeneousArrayLiterals.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== heterogeneousArrayLiterals.ts (2 errors) ==== + // type of an array is the best common type of its elements (plus its contextual type if it exists) + + var a = [1, '']; // {}[] + var b = [1, null]; // number[] + var c = [1, '', null]; // {}[] + var d = [{}, 1]; // {}[] + var e = [{}, Object]; // {}[] + + var f = [[], [1]]; // number[][] + var g = [[1], ['']]; // {}[] + + var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] + var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[] + + var j = [() => 1, () => '']; // {}[] + var k = [() => 1, () => 1]; // { (): number }[] + var l = [() => 1, () => null]; // { (): any }[] + var m = [() => 1, () => '', () => null]; // { (): any }[] + var n = [[() => 1], [() => '']]; // {}[] + + class Base { foo: string; } + class Derived extends Base { bar: string; } + class Derived2 extends Base { baz: string; } + var base: Base; + var derived: Derived; + var derived2: Derived2; + + module Derived { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] + var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[] + + var j = [() => base, () => derived]; // { {}: Base } + var k = [() => base, () => 1]; // {}[]~ + var l = [() => base, () => null]; // { (): any }[] + var m = [() => base, () => derived, () => null]; // { (): any }[] + var n = [[() => base], [() => derived]]; // { (): Base }[] + var o = [derived, derived2]; // {}[] + var p = [derived, derived2, base]; // Base[] + var q = [[() => derived2], [() => derived]]; // {}[] + } + + module WithContextualType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // no errors + var a: Base[] = [derived, derived2]; + var b: Derived[] = [null]; + var c: Derived[] = []; + var d: { (): Base }[] = [() => derived, () => derived2]; + } + + function foo(t: T, u: U) { + var a = [t, t]; // T[] + var b = [t, null]; // T[] + var c = [t, u]; // {}[] + var d = [t, 1]; // {}[] + var e = [() => t, () => u]; // {}[] + var f = [() => t, () => u, () => null]; // { (): any }[] + } + + function foo2(t: T, u: U) { + var a = [t, t]; // T[] + var b = [t, null]; // T[] + var c = [t, u]; // {}[] + var d = [t, 1]; // {}[] + var e = [() => t, () => u]; // {}[] + var f = [() => t, () => u, () => null]; // { (): any }[] + + var g = [t, base]; // Base[] + var h = [t, derived]; // Derived[] + var i = [u, base]; // Base[] + var j = [u, derived]; // Derived[] + } + + function foo3(t: T, u: U) { + var a = [t, t]; // T[] + var b = [t, null]; // T[] + var c = [t, u]; // {}[] + var d = [t, 1]; // {}[] + var e = [() => t, () => u]; // {}[] + var f = [() => t, () => u, () => null]; // { (): any }[] + + var g = [t, base]; // Base[] + var h = [t, derived]; // Derived[] + var i = [u, base]; // Base[] + var j = [u, derived]; // Derived[] + } + + function foo4(t: T, u: U) { + var a = [t, t]; // T[] + var b = [t, null]; // T[] + var c = [t, u]; // BUG 821629 + var d = [t, 1]; // {}[] + var e = [() => t, () => u]; // {}[] + var f = [() => t, () => u, () => null]; // { (): any }[] + + var g = [t, base]; // Base[] + var h = [t, derived]; // Derived[] + var i = [u, base]; // Base[] + var j = [u, derived]; // Derived[] + + var k: Base[] = [t, u]; + } + + //function foo3(t: T, u: U) { + // var a = [t, t]; // T[] + // var b = [t, null]; // T[] + // var c = [t, u]; // {}[] + // var d = [t, 1]; // {}[] + // var e = [() => t, () => u]; // {}[] + // var f = [() => t, () => u, () => null]; // { (): any }[] + + // var g = [t, base]; // Base[] + // var h = [t, derived]; // Derived[] + // var i = [u, base]; // Base[] + // var j = [u, derived]; // Derived[] + //} + + //function foo4(t: T, u: U) { + // var a = [t, t]; // T[] + // var b = [t, null]; // T[] + // var c = [t, u]; // BUG 821629 + // var d = [t, 1]; // {}[] + // var e = [() => t, () => u]; // {}[] + // var f = [() => t, () => u, () => null]; // { (): any }[] + + // var g = [t, base]; // Base[] + // var h = [t, derived]; // Derived[] + // var i = [u, base]; // Base[] + // var j = [u, derived]; // Derived[] + + // var k: Base[] = [t, u]; + //} \ No newline at end of file diff --git a/tests/baselines/reference/ifDoWhileStatements.errors.txt b/tests/baselines/reference/ifDoWhileStatements.errors.txt index c103478b4e6..d0b98fdd575 100644 --- a/tests/baselines/reference/ifDoWhileStatements.errors.txt +++ b/tests/baselines/reference/ifDoWhileStatements.errors.txt @@ -1,3 +1,5 @@ +ifDoWhileStatements.ts(23,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ifDoWhileStatements.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ifDoWhileStatements.ts(44,5): error TS2873: This kind of expression is always falsy. ifDoWhileStatements.ts(45,8): error TS2873: This kind of expression is always falsy. ifDoWhileStatements.ts(46,13): error TS2873: This kind of expression is always falsy. @@ -30,7 +32,7 @@ ifDoWhileStatements.ts(85,8): error TS2872: This kind of expression is always tr ifDoWhileStatements.ts(86,13): error TS2872: This kind of expression is always truthy. -==== ifDoWhileStatements.ts (30 errors) ==== +==== ifDoWhileStatements.ts (32 errors) ==== interface I { id: number; } @@ -54,6 +56,8 @@ ifDoWhileStatements.ts(86,13): error TS2872: This kind of expression is always t function F2(x: number): boolean { return x < 42; } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class A { name: string; } @@ -62,6 +66,8 @@ ifDoWhileStatements.ts(86,13): error TS2872: This kind of expression is always t } module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class A { id: number; } diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt index 4645f6966b4..3cb8f9cbbc1 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt @@ -6,6 +6,7 @@ implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2415: Class Types have separate declarations of a private property 'x'. implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2420: Class 'Bar3' incorrectly implements interface 'I'. Types have separate declarations of a private property 'x'. +implementingAnInterfaceExtendingClassWithPrivates2.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2415: Class 'Bar2' incorrectly extends base class 'Foo'. Property 'x' is private in type 'Foo' but not in type 'Bar2'. implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2420: Class 'Bar2' incorrectly implements interface 'I'. @@ -14,6 +15,7 @@ implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2415: Clas Types have separate declarations of a private property 'x'. implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2420: Class 'Bar3' incorrectly implements interface 'I'. Property 'z' is missing in type 'Bar3' but required in type 'I'. +implementingAnInterfaceExtendingClassWithPrivates2.ts(54,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. implementingAnInterfaceExtendingClassWithPrivates2.ts(67,11): error TS2420: Class 'Bar' incorrectly implements interface 'I'. Property 'y' is missing in type 'Bar' but required in type 'I'. implementingAnInterfaceExtendingClassWithPrivates2.ts(73,16): error TS2341: Property 'x' is private and only accessible within class 'Foo'. @@ -28,7 +30,7 @@ implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2420: Clas Property 'y' is missing in type 'Bar3' but required in type 'I'. -==== implementingAnInterfaceExtendingClassWithPrivates2.ts (15 errors) ==== +==== implementingAnInterfaceExtendingClassWithPrivates2.ts (17 errors) ==== class Foo { private x: string; } @@ -65,6 +67,8 @@ implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2420: Clas // another level of indirection module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Foo { private x: string; } @@ -109,6 +113,8 @@ implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2420: Clas // two levels of privates module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Foo { private x: string; } diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 25bf7f3416a..12f726ddeaf 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,10 +1,13 @@ +implicitAnyInAmbientDeclaration.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. implicitAnyInAmbientDeclaration.ts(3,16): error TS7008: Member 'publicMember' implicitly has an 'any' type. implicitAnyInAmbientDeclaration.ts(6,16): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. -==== implicitAnyInAmbientDeclaration.ts (3 errors) ==== +==== implicitAnyInAmbientDeclaration.ts (4 errors) ==== module Test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare class C { public publicMember; // this should be an error ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/importDecl.errors.txt b/tests/baselines/reference/importDecl.errors.txt new file mode 100644 index 00000000000..cdc341e1abd --- /dev/null +++ b/tests/baselines/reference/importDecl.errors.txt @@ -0,0 +1,88 @@ +importDecl_1.ts(11,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +importDecl_1.ts(32,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== importDecl_1.ts (2 errors) ==== + /// + /// + /// + /// + /// + import m4 = require("./importDecl_require"); // Emit used + export var x4 = m4.x; + export var d4 = m4.d; + export var f4 = m4.foo(); + + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x2 = m4.x; + export var d2 = m4.d; + export var f2 = m4.foo(); + + var x3 = m4.x; + var d3 = m4.d; + var f3 = m4.foo(); + } + + //Emit global only usage + import glo_m4 = require("./importDecl_require1"); + export var useGlo_m4_d4 = glo_m4.d; + export var useGlo_m4_f4 = glo_m4.foo(); + + //Emit even when used just in function type + import fncOnly_m4 = require("./importDecl_require2"); + export var useFncOnly_m4_f4 = fncOnly_m4.foo(); + + // only used privately no need to emit + import private_m4 = require("./importDecl_require3"); + export module usePrivate_m4_m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x3 = private_m4.x; + var d3 = private_m4.d; + var f3 = private_m4.foo(); + } + + // Do not emit unused import + import m5 = require("./importDecl_require4"); + export var d = m5.foo2(); + + // Do not emit multiple used import statements + import multiImport_m4 = require("./importDecl_require"); // Emit used + export var useMultiImport_m4_x4 = multiImport_m4.x; + export var useMultiImport_m4_d4 = multiImport_m4.d; + export var useMultiImport_m4_f4 = multiImport_m4.foo(); + +==== importDecl_require.ts (0 errors) ==== + export class d { + foo: string; + } + export var x: d; + export function foo(): d { return null; } + +==== importDecl_require1.ts (0 errors) ==== + export class d { + bar: string; + } + var x: d; + export function foo(): d { return null; } + +==== importDecl_require2.ts (0 errors) ==== + export class d { + baz: string; + } + export var x: d; + export function foo(): d { return null; } + +==== importDecl_require3.ts (0 errors) ==== + export class d { + bing: string; + } + export var x: d; + export function foo(): d { return null; } + +==== importDecl_require4.ts (0 errors) ==== + import m4 = require("./importDecl_require"); + export function foo2(): m4.d { return null; } + \ No newline at end of file diff --git a/tests/baselines/reference/importOnAliasedIdentifiers.errors.txt b/tests/baselines/reference/importOnAliasedIdentifiers.errors.txt new file mode 100644 index 00000000000..1463a2be564 --- /dev/null +++ b/tests/baselines/reference/importOnAliasedIdentifiers.errors.txt @@ -0,0 +1,19 @@ +importOnAliasedIdentifiers.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +importOnAliasedIdentifiers.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== importOnAliasedIdentifiers.ts (2 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface X { s: string } + export var X: X; + } + module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface A { n: number } + import Y = A; // Alias only for module A + import Z = A.X; // Alias for both type and member A.X + var v: Z = Z; + } \ No newline at end of file diff --git a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt index a32d53424e4..506573bdea5 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt +++ b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt @@ -1,20 +1,29 @@ +importedModuleAddToGlobal.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +importedModuleAddToGlobal.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +importedModuleAddToGlobal.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. importedModuleAddToGlobal.ts(15,23): error TS2833: Cannot find namespace 'b'. Did you mean 'B'? -==== importedModuleAddToGlobal.ts (1 errors) ==== +==== importedModuleAddToGlobal.ts (4 errors) ==== // Binding for an import statement in a typeref position is being added to the global scope // Shouldn't compile b.B is not defined in C module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import b = B; import c = C; } module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import a = A; export class B { } } module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import a = A; function hello(): b.B { return null; } ~ diff --git a/tests/baselines/reference/incompatibleExports1.errors.txt b/tests/baselines/reference/incompatibleExports1.errors.txt index f890ae46cc2..8a6991a7dec 100644 --- a/tests/baselines/reference/incompatibleExports1.errors.txt +++ b/tests/baselines/reference/incompatibleExports1.errors.txt @@ -1,8 +1,10 @@ incompatibleExports1.ts(4,5): error TS2309: An export assignment cannot be used in a module with other exported elements. +incompatibleExports1.ts(8,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +incompatibleExports1.ts(12,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. incompatibleExports1.ts(16,5): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== incompatibleExports1.ts (2 errors) ==== +==== incompatibleExports1.ts (4 errors) ==== declare module "foo" { export interface x { a: string } interface y { a: Date } @@ -13,10 +15,14 @@ incompatibleExports1.ts(16,5): error TS2309: An export assignment cannot be used declare module "baz" { export module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var b: number; } module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var c: string; } diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index 59926633784..49bdf661ba1 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -1,3 +1,4 @@ +incrementOperatorWithAnyOtherTypeInvalidOperations.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. incrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2629: Cannot assign to 'A' because it is a class. incrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2631: Cannot assign to 'M' because it is a namespace. @@ -47,7 +48,7 @@ incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,10): error TS1005: ';' incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,12): error TS1109: Expression expected. -==== incrementOperatorWithAnyOtherTypeInvalidOperations.ts (47 errors) ==== +==== incrementOperatorWithAnyOtherTypeInvalidOperations.ts (48 errors) ==== // ++ operator on any type var ANY1: any; var ANY2: any[] = [1, 2]; @@ -66,6 +67,8 @@ incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,12): error TS1109: Expr } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt index 0b96118b62c..286fa9bc722 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.errors.txt @@ -1,3 +1,4 @@ +incrementOperatorWithNumberTypeInvalidOperations.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. incrementOperatorWithNumberTypeInvalidOperations.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithNumberTypeInvalidOperations.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithNumberTypeInvalidOperations.ts(22,25): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. @@ -20,7 +21,7 @@ incrementOperatorWithNumberTypeInvalidOperations.ts(45,1): error TS2356: An arit incrementOperatorWithNumberTypeInvalidOperations.ts(46,1): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -==== incrementOperatorWithNumberTypeInvalidOperations.ts (20 errors) ==== +==== incrementOperatorWithNumberTypeInvalidOperations.ts (21 errors) ==== // ++ operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -32,6 +33,8 @@ incrementOperatorWithNumberTypeInvalidOperations.ts(46,1): error TS2357: The ope static foo() { return 1; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: number; } diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt index d4dd02cbb07..0b665eaa22f 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.errors.txt @@ -1,3 +1,4 @@ +incrementOperatorWithUnsupportedBooleanType.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. incrementOperatorWithUnsupportedBooleanType.ts(17,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithUnsupportedBooleanType.ts(19,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithUnsupportedBooleanType.ts(22,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. @@ -29,7 +30,7 @@ incrementOperatorWithUnsupportedBooleanType.ts(54,1): error TS2356: An arithmeti incrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -==== incrementOperatorWithUnsupportedBooleanType.ts (29 errors) ==== +==== incrementOperatorWithUnsupportedBooleanType.ts (30 errors) ==== // ++ operator on boolean type var BOOLEAN: boolean; @@ -40,6 +41,8 @@ incrementOperatorWithUnsupportedBooleanType.ts(54,11): error TS2356: An arithmet static foo() { return true; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: boolean; } diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt index 315c8a46200..89c490b259b 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.errors.txt @@ -1,3 +1,4 @@ +incrementOperatorWithUnsupportedStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. incrementOperatorWithUnsupportedStringType.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithUnsupportedStringType.ts(19,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. incrementOperatorWithUnsupportedStringType.ts(21,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. @@ -39,7 +40,7 @@ incrementOperatorWithUnsupportedStringType.ts(65,1): error TS2356: An arithmetic incrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. -==== incrementOperatorWithUnsupportedStringType.ts (39 errors) ==== +==== incrementOperatorWithUnsupportedStringType.ts (40 errors) ==== // ++ operator on string type var STRING: string; var STRING1: string[] = ["", ""]; @@ -51,6 +52,8 @@ incrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmeti static foo() { return ""; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: string; } diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.errors.txt b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.errors.txt new file mode 100644 index 00000000000..68cd06e3c71 --- /dev/null +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.errors.txt @@ -0,0 +1,23 @@ +inheritanceOfGenericConstructorMethod2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +inheritanceOfGenericConstructorMethod2.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== inheritanceOfGenericConstructorMethod2.ts (2 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1 { } + export class C2 { } + } + module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class D1 extends M.C1 { } + export class D2 extends M.C2 { } + } + + var c = new M.C2(); // no error + var n = new N.D1(); // no error + var n2 = new N.D2(); // error + var n3 = new N.D2(); // no error, D2 + \ No newline at end of file diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt index a5bd20735e4..05cf4f3ef2d 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.errors.txt @@ -1,9 +1,10 @@ inheritedModuleMembersForClodule.ts(7,7): error TS2417: Class static side 'typeof D' incorrectly extends base class static side 'typeof C'. The types returned by 'foo()' are incompatible between these types. Type 'number' is not assignable to type 'string'. +inheritedModuleMembersForClodule.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== inheritedModuleMembersForClodule.ts (1 errors) ==== +==== inheritedModuleMembersForClodule.ts (2 errors) ==== class C { static foo(): string { return "123"; @@ -18,6 +19,8 @@ inheritedModuleMembersForClodule.ts(7,7): error TS2417: Class static side 'typeo } module D { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function foo(): number { return 0; }; diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index e50542fa18c..87d8da479de 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -3,11 +3,12 @@ file1.d.ts(5,16): error TS1039: Initializers are not allowed in ambient contexts file1.d.ts(6,16): error TS1183: An implementation cannot be declared in ambient contexts. file1.d.ts(11,17): error TS1039: Initializers are not allowed in ambient contexts. file1.d.ts(12,17): error TS1039: Initializers are not allowed in ambient contexts. +file1.d.ts(14,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file1.d.ts(15,2): error TS1036: Statements are not allowed in ambient contexts. file1.d.ts(17,18): error TS1039: Initializers are not allowed in ambient contexts. -==== file1.d.ts (7 errors) ==== +==== file1.d.ts (8 errors) ==== // Errors: Initializers & statements in declaration file declare class Foo { @@ -32,6 +33,8 @@ file1.d.ts(17,18): error TS1039: Initializers are not allowed in ambient context !!! error TS1039: Initializers are not allowed in ambient contexts. declare module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. while(true); ~~~~~ !!! error TS1036: Statements are not allowed in ambient contexts. diff --git a/tests/baselines/reference/innerAliases.errors.txt b/tests/baselines/reference/innerAliases.errors.txt index 5f525bf3d96..11c9563f2ba 100644 --- a/tests/baselines/reference/innerAliases.errors.txt +++ b/tests/baselines/reference/innerAliases.errors.txt @@ -1,22 +1,37 @@ +innerAliases.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +innerAliases.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +innerAliases.ts(3,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +innerAliases.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +innerAliases.ts(14,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. innerAliases.ts(19,10): error TS2694: Namespace 'D' has no exported member 'inner'. innerAliases.ts(21,11): error TS2339: Property 'inner' does not exist on type 'typeof D'. -==== innerAliases.ts (2 errors) ==== +==== innerAliases.ts (7 errors) ==== module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Class1 {} } } } module D { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import inner = A.B.C; var c1 = new inner.Class1(); export module E { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Class2 {} } } diff --git a/tests/baselines/reference/innerModExport1.errors.txt b/tests/baselines/reference/innerModExport1.errors.txt index 1aa62fd7d50..e596f3f9331 100644 --- a/tests/baselines/reference/innerModExport1.errors.txt +++ b/tests/baselines/reference/innerModExport1.errors.txt @@ -1,9 +1,12 @@ +innerModExport1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. innerModExport1.ts(5,5): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. innerModExport1.ts(5,12): error TS1437: Namespace must be given a name. -==== innerModExport1.ts (2 errors) ==== +==== innerModExport1.ts (3 errors) ==== module Outer { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // inner mod 1 var non_export_var: number; diff --git a/tests/baselines/reference/instanceofOperator.errors.txt b/tests/baselines/reference/instanceofOperator.errors.txt index 76e501db77a..b4a531b2b8e 100644 --- a/tests/baselines/reference/instanceofOperator.errors.txt +++ b/tests/baselines/reference/instanceofOperator.errors.txt @@ -1,3 +1,4 @@ +instanceofOperator.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. instanceofOperator.ts(7,11): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module CommonJS. instanceofOperator.ts(12,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. instanceofOperator.ts(15,20): error TS2359: The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method. @@ -6,13 +7,15 @@ instanceofOperator.ts(19,5): error TS2358: The left-hand side of an 'instanceof' instanceofOperator.ts(21,5): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -==== instanceofOperator.ts (6 errors) ==== +==== instanceofOperator.ts (7 errors) ==== // Spec: // The instanceof operator requires the left operand to be of type Any or an object type, and the right // operand to be of type Any or a subtype of the ‘Function’ interface type. The result is always of the // Boolean primitive type. module test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Object { } ~~~~~~ !!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module CommonJS. diff --git a/tests/baselines/reference/instantiatedModule.errors.txt b/tests/baselines/reference/instantiatedModule.errors.txt new file mode 100644 index 00000000000..73b63813175 --- /dev/null +++ b/tests/baselines/reference/instantiatedModule.errors.txt @@ -0,0 +1,72 @@ +instantiatedModule.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +instantiatedModule.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +instantiatedModule.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== instantiatedModule.ts (3 errors) ==== + // adding the var makes this an instantiated module + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Point { x: number; y: number } + export var Point = 1; + } + + // primary expression + var m: typeof M; + var m = M; + + var a1: number; + var a1 = M.Point; + var a1 = m.Point; + + var p1: { x: number; y: number; } + var p1: M.Point; + + // making the point a class instead of an interface + // makes this an instantiated mmodule + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Point { + x: number; + y: number; + static Origin(): Point { + return { x: 0, y: 0 }; + } + } + } + + var m2: typeof M2; + var m2 = M2; + + // static side of the class + var a2: typeof M2.Point; + var a2 = m2.Point; + var a2 = M2.Point; + var o: M2.Point = a2.Origin(); + + var p2: { x: number; y: number } + var p2: M2.Point; + var p2 = new m2.Point(); + var p2 = new M2.Point(); + + module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum Color { Blue, Red } + } + + var m3: typeof M3; + var m3 = M3; + + var a3: typeof M3.Color; + var a3 = m3.Color; + var a3 = M3.Color; + var blue: M3.Color = a3.Blue; + + var p3: M3.Color; + var p3 = M3.Color.Red; + var p3 = m3.Color.Blue; + \ No newline at end of file diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 1b16cb3a0d4..2026007608c 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -1,3 +1,4 @@ +interfaceAssignmentCompat.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. Types of parameters 'a' and 'a' are incompatible. Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. @@ -7,8 +8,10 @@ interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignabl Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. -==== interfaceAssignmentCompat.ts (4 errors) ==== +==== interfaceAssignmentCompat.ts (5 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum Color { Green, Blue, diff --git a/tests/baselines/reference/interfaceDeclaration3.errors.txt b/tests/baselines/reference/interfaceDeclaration3.errors.txt index 2c1cad0c9cf..35bce1f6007 100644 --- a/tests/baselines/reference/interfaceDeclaration3.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration3.errors.txt @@ -1,5 +1,8 @@ +interfaceDeclaration3.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interfaceDeclaration3.ts(7,16): error TS2416: Property 'item' in type 'C1' is not assignable to the same property in base type 'I1'. Type 'number' is not assignable to type 'string'. +interfaceDeclaration3.ts(25,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +interfaceDeclaration3.ts(28,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interfaceDeclaration3.ts(32,16): error TS2416: Property 'item' in type 'C1' is not assignable to the same property in base type 'I1'. Type 'number' is not assignable to type 'string'. interfaceDeclaration3.ts(54,11): error TS2430: Interface 'I2' incorrectly extends interface 'I1'. @@ -7,10 +10,12 @@ interfaceDeclaration3.ts(54,11): error TS2430: Interface 'I2' incorrectly extend Type 'string' is not assignable to type 'number'. -==== interfaceDeclaration3.ts (3 errors) ==== +==== interfaceDeclaration3.ts (6 errors) ==== interface I1 { item:number; } module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface I1 { item:string; } interface I2 { item:number; } class C1 implements I1 { @@ -36,9 +41,13 @@ interfaceDeclaration3.ts(54,11): error TS2430: Interface 'I2' incorrectly extend } export module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I1 { item:string; } export interface I2 { item:string; } export module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I1 { item:string; } } class C1 implements I1 { diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index be02808aa9a..35b7eb88cc4 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -1,6 +1,7 @@ interfaceWithMultipleBaseTypes.ts(21,11): error TS2430: Interface 'Derived2' incorrectly extends interface 'Base2'. The types of 'x.b' are incompatible between these types. Type 'number' is not assignable to type 'string'. +interfaceWithMultipleBaseTypes.ts(27,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. Named property 'x' of types 'Base1' and 'Base2' are not identical. interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. @@ -17,7 +18,7 @@ interfaceWithMultipleBaseTypes.ts(60,15): error TS2430: Interface 'Derived5' Type 'T' is not assignable to type '{ b: T; }'. -==== interfaceWithMultipleBaseTypes.ts (6 errors) ==== +==== interfaceWithMultipleBaseTypes.ts (7 errors) ==== // an interface may have multiple bases with properties of the same name as long as the interface's implementation satisfies all base type versions interface Base1 { @@ -49,6 +50,8 @@ interfaceWithMultipleBaseTypes.ts(60,15): error TS2430: Interface 'Derived5' } module Generic { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base1 { x: { a: T; diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.errors.txt b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.errors.txt new file mode 100644 index 00000000000..c52469e3841 --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithExport.errors.txt @@ -0,0 +1,29 @@ +internalAliasClassInsideLocalModuleWithExport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithExport.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithExport.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== internalAliasClassInsideLocalModuleWithExport.ts (3 errors) ==== + export module x { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + foo(a: number) { + return a; + } + } + } + + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import c = x.c; + export var cProp = new c(); + var cReturnVal = cProp.foo(10); + } + } + + export var d = new m2.m3.c(); \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.errors.txt b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.errors.txt new file mode 100644 index 00000000000..c82f22e5e5e --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExport.errors.txt @@ -0,0 +1,27 @@ +internalAliasClassInsideLocalModuleWithoutExport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithoutExport.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithoutExport.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== internalAliasClassInsideLocalModuleWithoutExport.ts (3 errors) ==== + export module x { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + foo(a: number) { + return a; + } + } + } + + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import c = x.c; + export var cProp = new c(); + var cReturnVal = cProp.foo(10); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt index c2308deeee5..4d309cb9437 100644 --- a/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasClassInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,8 +1,13 @@ +internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(10,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(17,26): error TS2339: Property 'c' does not exist on type 'typeof m3'. -==== internalAliasClassInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== +==== internalAliasClassInsideLocalModuleWithoutExportAccessError.ts (4 errors) ==== export module x { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c { foo(a: number) { return a; @@ -11,7 +16,11 @@ internalAliasClassInsideLocalModuleWithoutExportAccessError.ts(17,26): error TS2 } export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import c = x.c; export var cProp = new c(); var cReturnVal = cProp.foo(10); diff --git a/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.errors.txt b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.errors.txt new file mode 100644 index 00000000000..308fefb53e4 --- /dev/null +++ b/tests/baselines/reference/internalAliasClassInsideTopLevelModuleWithExport.errors.txt @@ -0,0 +1,17 @@ +internalAliasClassInsideTopLevelModuleWithExport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== internalAliasClassInsideTopLevelModuleWithExport.ts (1 errors) ==== + export module x { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + foo(a: number) { + return a; + } + } + } + + export import xc = x.c; + export var cProp = new xc(); + var cReturnVal = cProp.foo(10); \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.errors.txt b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.errors.txt new file mode 100644 index 00000000000..a2eb31650ef --- /dev/null +++ b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithExport.errors.txt @@ -0,0 +1,22 @@ +internalAliasEnumInsideLocalModuleWithExport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasEnumInsideLocalModuleWithExport.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== internalAliasEnumInsideLocalModuleWithExport.ts (2 errors) ==== + export module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export enum weekend { + Friday, + Saturday, + Sunday + } + } + + export module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import b = a.weekend; + export var bVal: b = b.Sunday; + } + \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt index bfb69ade578..cdb2c1c0645 100644 --- a/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt +++ b/tests/baselines/reference/internalAliasEnumInsideLocalModuleWithoutExportAccessError.errors.txt @@ -1,8 +1,12 @@ +internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts(14,21): error TS2339: Property 'b' does not exist on type 'typeof c'. -==== internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts (1 errors) ==== +==== internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts (3 errors) ==== export module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum weekend { Friday, Saturday, @@ -11,6 +15,8 @@ internalAliasEnumInsideLocalModuleWithoutExportAccessError.ts(14,21): error TS23 } export module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import b = a.weekend; export var bVal: b = b.Sunday; } diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.errors.txt b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.errors.txt new file mode 100644 index 00000000000..d989fe09f79 --- /dev/null +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.errors.txt @@ -0,0 +1,25 @@ +internalAliasUninitializedModuleInsideLocalModuleWithExport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasUninitializedModuleInsideLocalModuleWithExport.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +internalAliasUninitializedModuleInsideLocalModuleWithExport.ts(9,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== internalAliasUninitializedModuleInsideLocalModuleWithExport.ts (3 errors) ==== + export module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module b { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface I { + foo(); + } + } + } + + export module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export import b = a.b; + export var x: b.I; + x.foo(); + } \ No newline at end of file diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types index 42a3443b698..9b4b0437c4a 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.types @@ -31,6 +31,7 @@ export module c { x.foo(); >x.foo() : any +> : ^^^ >x.foo : () => any > : ^^^^^^^^^ >x : b.I diff --git a/tests/baselines/reference/intrinsics.errors.txt b/tests/baselines/reference/intrinsics.errors.txt index 59c337081a2..ada107dff0c 100644 --- a/tests/baselines/reference/intrinsics.errors.txt +++ b/tests/baselines/reference/intrinsics.errors.txt @@ -1,13 +1,16 @@ intrinsics.ts(1,21): error TS2749: 'hasOwnProperty' refers to a value, but is being used as a type here. Did you mean 'typeof hasOwnProperty'? +intrinsics.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. intrinsics.ts(10,1): error TS2304: Cannot find name '__proto__'. -==== intrinsics.ts (2 errors) ==== +==== intrinsics.ts (3 errors) ==== var hasOwnProperty: hasOwnProperty; // Error ~~~~~~~~~~~~~~ !!! error TS2749: 'hasOwnProperty' refers to a value, but is being used as a type here. Did you mean 'typeof hasOwnProperty'? module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var __proto__; interface __proto__ {} diff --git a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt index 64c5dd84997..f9fd3775d27 100644 --- a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt +++ b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt @@ -5,12 +5,13 @@ invalidAssignmentsToVoid.ts(5,1): error TS2322: Type '{}' is not assignable to t invalidAssignmentsToVoid.ts(9,1): error TS2322: Type 'typeof C' is not assignable to type 'void'. invalidAssignmentsToVoid.ts(10,1): error TS2322: Type 'C' is not assignable to type 'void'. invalidAssignmentsToVoid.ts(14,1): error TS2322: Type 'I' is not assignable to type 'void'. +invalidAssignmentsToVoid.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidAssignmentsToVoid.ts(17,1): error TS2322: Type 'typeof M' is not assignable to type 'void'. invalidAssignmentsToVoid.ts(20,5): error TS2322: Type 'T' is not assignable to type 'void'. invalidAssignmentsToVoid.ts(22,5): error TS2322: Type '(a: T) => void' is not assignable to type 'void'. -==== invalidAssignmentsToVoid.ts (10 errors) ==== +==== invalidAssignmentsToVoid.ts (11 errors) ==== var x: void; x = 1; ~ @@ -41,6 +42,8 @@ invalidAssignmentsToVoid.ts(22,5): error TS2322: Type '(a: T) => void' is not !!! error TS2322: Type 'I' is not assignable to type 'void'. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. x = M; ~ !!! error TS2322: Type 'typeof M' is not assignable to type 'void'. diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 15f46942c2b..88c82b84bb0 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -5,13 +5,14 @@ invalidBooleanAssignments.ts(9,5): error TS2322: Type 'true' is not assignable t invalidBooleanAssignments.ts(12,5): error TS2322: Type 'boolean' is not assignable to type 'C'. invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I'. invalidBooleanAssignments.ts(17,5): error TS2322: Type 'boolean' is not assignable to type '() => string'. +invalidBooleanAssignments.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidBooleanAssignments.ts(21,1): error TS2631: Cannot assign to 'M' because it is a namespace. invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'boolean'. invalidBooleanAssignments.ts(26,1): error TS2630: Cannot assign to 'i' because it is a function. -==== invalidBooleanAssignments.ts (10 errors) ==== +==== invalidBooleanAssignments.ts (11 errors) ==== var x = true; var a: number = x; @@ -46,6 +47,8 @@ invalidBooleanAssignments.ts(26,1): error TS2630: Cannot assign to 'i' because i var h2: { toString(): string } = x; // no error module M { export var a = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M = x; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/invalidInstantiatedModule.errors.txt b/tests/baselines/reference/invalidInstantiatedModule.errors.txt index 539dbba4c83..cb4fba86779 100644 --- a/tests/baselines/reference/invalidInstantiatedModule.errors.txt +++ b/tests/baselines/reference/invalidInstantiatedModule.errors.txt @@ -1,10 +1,14 @@ +invalidInstantiatedModule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'. invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'. +invalidInstantiatedModule.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidInstantiatedModule.ts(12,8): error TS2833: Cannot find namespace 'm'. Did you mean 'M'? -==== invalidInstantiatedModule.ts (3 errors) ==== +==== invalidInstantiatedModule.ts (5 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Point { x: number; y: number } ~~~~~ !!! error TS2300: Duplicate identifier 'Point'. @@ -14,6 +18,8 @@ invalidInstantiatedModule.ts(12,8): error TS2833: Cannot find namespace 'm'. Did } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface Point { x: number; y: number } export var Point = 1; } diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 689e6cf633e..4cb63f9f325 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,30 +1,47 @@ +invalidModuleWithStatementsOfEveryKind.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidModuleWithStatementsOfEveryKind.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(36,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(43,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(44,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidModuleWithStatementsOfEveryKind.ts(49,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(54,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(62,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(69,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +invalidModuleWithStatementsOfEveryKind.ts(70,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidModuleWithStatementsOfEveryKind.ts(75,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. -==== invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== +==== invalidModuleWithStatementsOfEveryKind.ts (36 errors) ==== // All of these should be an error module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public class A { s: string } ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. @@ -37,6 +54,8 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module Y2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public class AA { s: T } ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. @@ -50,20 +69,28 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module Y3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public module Module { ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { s: string } } } module Y4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public enum Color { Blue, Red } ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module YY { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private class A { s: string } ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. @@ -76,6 +103,8 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module YY2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private class AA { s: T } ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. @@ -89,14 +118,20 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module YY3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private module Module { ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { s: string } } } module YY4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private enum Color { Blue, Red } ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. @@ -104,6 +139,8 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier module YYY { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static class A { s: string } ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. @@ -116,6 +153,8 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module YYY2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static class AA { s: T } ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. @@ -129,14 +168,20 @@ invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier } module YYY3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static module Module { ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { s: string } } } module YYY4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static enum Color { Blue, Red } ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index 938bd07b5f3..088eb0d8394 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,39 +1,55 @@ +invalidModuleWithVarStatements.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithVarStatements.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +invalidModuleWithVarStatements.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +invalidModuleWithVarStatements.ts(15,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +invalidModuleWithVarStatements.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +invalidModuleWithVarStatements.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. -==== invalidModuleWithVarStatements.ts (6 errors) ==== +==== invalidModuleWithVarStatements.ts (12 errors) ==== // All of these should be an error module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public var x: number = 0; ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. public function fn(x: string) { } ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static var x: number = 0; ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. static function fn(x: string) { } ~~~~~~ !!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private var x: number = 0; ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. @@ -41,6 +57,8 @@ invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot module YY3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. private function fn(x: string) { } ~~~~~~~ !!! error TS1044: 'private' modifier cannot appear on a module or namespace element. diff --git a/tests/baselines/reference/invalidNestedModules.errors.txt b/tests/baselines/reference/invalidNestedModules.errors.txt index 112c2a706cf..b9ffab0b0fa 100644 --- a/tests/baselines/reference/invalidNestedModules.errors.txt +++ b/tests/baselines/reference/invalidNestedModules.errors.txt @@ -1,10 +1,25 @@ +invalidNestedModules.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(1,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(1,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidNestedModules.ts(1,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +invalidNestedModules.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(9,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(16,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidNestedModules.ts(17,18): error TS2300: Duplicate identifier 'Point'. +invalidNestedModules.ts(22,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +invalidNestedModules.ts(23,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. -==== invalidNestedModules.ts (3 errors) ==== +==== invalidNestedModules.ts (12 errors) ==== module A.B.C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export class Point { @@ -14,7 +29,11 @@ invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. } module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class C { // Error name: string; } @@ -22,6 +41,10 @@ invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. } module M2.X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Point { ~~~~~ !!! error TS2300: Duplicate identifier 'Point'. @@ -30,7 +53,11 @@ invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var Point: number; // Error ~~~~~ !!! error TS2300: Duplicate identifier 'Point'. diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index fb57c501bcc..93b6412ded4 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -5,13 +5,14 @@ invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I'. invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. +invalidNumberAssignments.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidNumberAssignments.ts(18,1): error TS2631: Cannot assign to 'M' because it is a namespace. invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. invalidNumberAssignments.ts(23,1): error TS2630: Cannot assign to 'i' because it is a function. -==== invalidNumberAssignments.ts (10 errors) ==== +==== invalidNumberAssignments.ts (11 errors) ==== var x = 1; var a: boolean = x; @@ -43,6 +44,8 @@ invalidNumberAssignments.ts(23,1): error TS2630: Cannot assign to 'i' because it !!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M = x; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/invalidStringAssignments.errors.txt b/tests/baselines/reference/invalidStringAssignments.errors.txt index a7800011cdd..5974e01105d 100644 --- a/tests/baselines/reference/invalidStringAssignments.errors.txt +++ b/tests/baselines/reference/invalidStringAssignments.errors.txt @@ -5,6 +5,7 @@ invalidStringAssignments.ts(9,5): error TS2322: Type 'string' is not assignable invalidStringAssignments.ts(12,5): error TS2322: Type 'string' is not assignable to type 'I'. invalidStringAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. invalidStringAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. +invalidStringAssignments.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidStringAssignments.ts(18,1): error TS2631: Cannot assign to 'M' because it is a namespace. invalidStringAssignments.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. @@ -12,7 +13,7 @@ invalidStringAssignments.ts(23,1): error TS2630: Cannot assign to 'i' because it invalidStringAssignments.ts(26,5): error TS2322: Type 'string' is not assignable to type 'E'. -==== invalidStringAssignments.ts (11 errors) ==== +==== invalidStringAssignments.ts (12 errors) ==== var x = ''; var a: boolean = x; @@ -44,6 +45,8 @@ invalidStringAssignments.ts(26,5): error TS2322: Type 'string' is not assignable !!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M = x; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt index b095878feeb..84e33ded3d4 100644 --- a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt +++ b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt @@ -2,11 +2,12 @@ invalidUndefinedAssignments.ts(4,1): error TS2628: Cannot assign to 'E' because invalidUndefinedAssignments.ts(5,3): error TS2540: Cannot assign to 'A' because it is a read-only property. invalidUndefinedAssignments.ts(9,1): error TS2629: Cannot assign to 'C' because it is a class. invalidUndefinedAssignments.ts(14,1): error TS2693: 'I' only refers to a type, but is being used as a value here. +invalidUndefinedAssignments.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidUndefinedAssignments.ts(17,1): error TS2631: Cannot assign to 'M' because it is a namespace. invalidUndefinedAssignments.ts(21,1): error TS2630: Cannot assign to 'i' because it is a function. -==== invalidUndefinedAssignments.ts (6 errors) ==== +==== invalidUndefinedAssignments.ts (7 errors) ==== var x: typeof undefined; enum E { A } @@ -31,6 +32,8 @@ invalidUndefinedAssignments.ts(21,1): error TS2630: Cannot assign to 'i' because !!! error TS2693: 'I' only refers to a type, but is being used as a value here. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. M = x; ~ !!! error TS2631: Cannot assign to 'M' because it is a namespace. diff --git a/tests/baselines/reference/invalidUndefinedValues.errors.txt b/tests/baselines/reference/invalidUndefinedValues.errors.txt new file mode 100644 index 00000000000..40d67270b1a --- /dev/null +++ b/tests/baselines/reference/invalidUndefinedValues.errors.txt @@ -0,0 +1,37 @@ +invalidUndefinedValues.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== invalidUndefinedValues.ts (1 errors) ==== + var x: typeof undefined; + + x = 1; + x = ''; + x = true; + var a: void; + x = a; + x = null; + + class C { foo: string } + var b: C; + x = C; + x = b; + + interface I { foo: string } + var c: I; + x = c; + + module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + x = M; + + x = { f() { } } + + function f(a: T) { + x = a; + } + x = f; + + enum E { A } + x = E; + x = E.A; \ No newline at end of file diff --git a/tests/baselines/reference/invalidUndefinedValues.types b/tests/baselines/reference/invalidUndefinedValues.types index d87d4a66688..74029a94c7c 100644 --- a/tests/baselines/reference/invalidUndefinedValues.types +++ b/tests/baselines/reference/invalidUndefinedValues.types @@ -3,6 +3,7 @@ === invalidUndefinedValues.ts === var x: typeof undefined; >x : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ @@ -10,6 +11,7 @@ x = 1; >x = 1 : 1 > : ^ >x : any +> : ^^^ >1 : 1 > : ^ @@ -17,6 +19,7 @@ x = ''; >x = '' : "" > : ^^ >x : any +> : ^^^ >'' : "" > : ^^ @@ -24,6 +27,7 @@ x = true; >x = true : true > : ^^^^ >x : any +> : ^^^ >true : true > : ^^^^ @@ -35,6 +39,7 @@ x = a; >x = a : void > : ^^^^ >x : any +> : ^^^ >a : void > : ^^^^ @@ -42,6 +47,7 @@ x = null; >x = null : null > : ^^^^ >x : any +> : ^^^ class C { foo: string } >C : C @@ -57,6 +63,7 @@ x = C; >x = C : typeof C > : ^^^^^^^^ >x : any +> : ^^^ >C : typeof C > : ^^^^^^^^ @@ -64,6 +71,7 @@ x = b; >x = b : C > : ^ >x : any +> : ^^^ >b : C > : ^ @@ -79,6 +87,7 @@ x = c; >x = c : I > : ^ >x : any +> : ^^^ >c : I > : ^ @@ -94,6 +103,7 @@ x = M; >x = M : typeof M > : ^^^^^^^^ >x : any +> : ^^^ >M : typeof M > : ^^^^^^^^ @@ -101,6 +111,7 @@ x = { f() { } } >x = { f() { } } : { f(): void; } > : ^^^^^^^^^^^^^^ >x : any +> : ^^^ >{ f() { } } : { f(): void; } > : ^^^^^^^^^^^^^^ >f : () => void @@ -116,6 +127,7 @@ function f(a: T) { >x = a : T > : ^ >x : any +> : ^^^ >a : T > : ^ } @@ -123,6 +135,7 @@ x = f; >x = f : (a: T) => void > : ^ ^^ ^^ ^^^^^^^^^ >x : any +> : ^^^ >f : (a: T) => void > : ^ ^^ ^^ ^^^^^^^^^ @@ -136,6 +149,7 @@ x = E; >x = E : typeof E > : ^^^^^^^^ >x : any +> : ^^^ >E : typeof E > : ^^^^^^^^ @@ -143,6 +157,7 @@ x = E.A; >x = E.A : E > : ^ >x : any +> : ^^^ >E.A : E > : ^ >E : typeof E diff --git a/tests/baselines/reference/invalidVoidValues.errors.txt b/tests/baselines/reference/invalidVoidValues.errors.txt index 4b6127fe2ec..8de70ec94db 100644 --- a/tests/baselines/reference/invalidVoidValues.errors.txt +++ b/tests/baselines/reference/invalidVoidValues.errors.txt @@ -6,12 +6,13 @@ invalidVoidValues.ts(8,1): error TS2322: Type 'E' is not assignable to type 'voi invalidVoidValues.ts(12,1): error TS2322: Type 'C' is not assignable to type 'void'. invalidVoidValues.ts(16,1): error TS2322: Type 'I' is not assignable to type 'void'. invalidVoidValues.ts(18,1): error TS2322: Type '{ f(): void; }' is not assignable to type 'void'. +invalidVoidValues.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. invalidVoidValues.ts(21,1): error TS2322: Type 'typeof M' is not assignable to type 'void'. invalidVoidValues.ts(24,5): error TS2322: Type 'T' is not assignable to type 'void'. invalidVoidValues.ts(26,5): error TS2322: Type '(a: T) => void' is not assignable to type 'void'. -==== invalidVoidValues.ts (11 errors) ==== +==== invalidVoidValues.ts (12 errors) ==== var x: void; x = 1; ~ @@ -48,6 +49,8 @@ invalidVoidValues.ts(26,5): error TS2322: Type '(a: T) => void' is not assign !!! error TS2322: Type '{ f(): void; }' is not assignable to type 'void'. module M { export var x = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. x = M; ~ !!! error TS2322: Type 'typeof M' is not assignable to type 'void'. diff --git a/tests/baselines/reference/ipromise2.errors.txt b/tests/baselines/reference/ipromise2.errors.txt new file mode 100644 index 00000000000..f2c39d2c3e0 --- /dev/null +++ b/tests/baselines/reference/ipromise2.errors.txt @@ -0,0 +1,30 @@ +ipromise2.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ipromise2.ts(1,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ipromise2.ts (2 errors) ==== + declare module Windows.Foundation { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface IPromise { + then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + done(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; + value: T; + } + } + + var p: Windows.Foundation.IPromise; + + var p2 = p.then(function (s) { + return 34; + } ); + + + var x: number = p2.value; + + \ No newline at end of file diff --git a/tests/baselines/reference/ipromise2.types b/tests/baselines/reference/ipromise2.types index c1aa41840d6..bb3ce72986b 100644 --- a/tests/baselines/reference/ipromise2.types +++ b/tests/baselines/reference/ipromise2.types @@ -13,9 +13,11 @@ declare module Windows.Foundation { >error : (error: any) => IPromise > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -31,9 +33,11 @@ declare module Windows.Foundation { >error : (error: any) => U > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -49,9 +53,11 @@ declare module Windows.Foundation { >error : (error: any) => IPromise > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -67,9 +73,11 @@ declare module Windows.Foundation { >error : (error: any) => U > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -85,9 +93,11 @@ declare module Windows.Foundation { >error : (error: any) => any > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ value: T; >value : T diff --git a/tests/baselines/reference/ipromise4.errors.txt b/tests/baselines/reference/ipromise4.errors.txt new file mode 100644 index 00000000000..abf57a29ff8 --- /dev/null +++ b/tests/baselines/reference/ipromise4.errors.txt @@ -0,0 +1,25 @@ +ipromise4.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +ipromise4.ts(1,24): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== ipromise4.ts (2 errors) ==== + declare module Windows.Foundation { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface IPromise { + then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; + done? (success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; + } + } + + var p: Windows.Foundation.IPromise = null; + + p.then(function (x) { } ); // should not error + p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // should not error + + \ No newline at end of file diff --git a/tests/baselines/reference/ipromise4.types b/tests/baselines/reference/ipromise4.types index 46e5e4a020e..1ce5a3a4c97 100644 --- a/tests/baselines/reference/ipromise4.types +++ b/tests/baselines/reference/ipromise4.types @@ -13,9 +13,11 @@ declare module Windows.Foundation { >error : (error: any) => IPromise > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -31,9 +33,11 @@ declare module Windows.Foundation { >error : (error: any) => U > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -49,9 +53,11 @@ declare module Windows.Foundation { >error : (error: any) => IPromise > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -67,9 +73,11 @@ declare module Windows.Foundation { >error : (error: any) => U > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ >Windows : any > : ^^^ >Foundation : any @@ -85,9 +93,11 @@ declare module Windows.Foundation { >error : (error: any) => any > : ^ ^^ ^^^^^ >error : any +> : ^^^ >progress : (progress: any) => void > : ^ ^^ ^^^^^ >progress : any +> : ^^^ } } diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.errors.txt b/tests/baselines/reference/isDeclarationVisibleNodeKinds.errors.txt new file mode 100644 index 00000000000..2391563b899 --- /dev/null +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.errors.txt @@ -0,0 +1,98 @@ +isDeclarationVisibleNodeKinds.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(23,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(38,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(52,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +isDeclarationVisibleNodeKinds.ts(59,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== isDeclarationVisibleNodeKinds.ts (9 errors) ==== + // Function types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator1(schema: any): (data: T) => T { + return undefined; + } + } + + // Constructor types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator2(schema: any): new (data: T) => T { + return undefined; + } + } + + // union types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator3(schema: any): number | { new (data: T): T; } { + return undefined; + } + } + + // Array types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator4(schema: any): { new (data: T): T; }[] { + return undefined; + } + } + + + // TypeLiterals + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator5(schema: any): { new (data: T): T } { + return undefined; + } + } + + // Tuple types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator6(schema: any): [ new (data: T) => T, number] { + return undefined; + } + } + + // Paren Types + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator7(schema: any): (new (data: T)=>T )[] { + return undefined; + } + } + + // Type reference + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function createValidator8(schema: any): Array<{ (data: T) : T}> { + return undefined; + } + } + + + module schema { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class T { + get createValidator9(): (data: T) => T { + return undefined; + } + + set createValidator10(v: (data: T) => T) { + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.types b/tests/baselines/reference/isDeclarationVisibleNodeKinds.types index 7cec3b3c7d5..f3af61305a2 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.types +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.types @@ -10,6 +10,7 @@ module schema { >createValidator1 : (schema: any) => (data: T) => T > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -28,6 +29,7 @@ module schema { >createValidator2 : (schema: any) => new (data: T) => T > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -46,6 +48,7 @@ module schema { >createValidator3 : (schema: any) => number | { new (data: T): T; } > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -64,6 +67,7 @@ module schema { >createValidator4 : (schema: any) => { new (data: T): T; }[] > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -83,6 +87,7 @@ module schema { >createValidator5 : (schema: any) => { new (data: T): T; } > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -101,6 +106,7 @@ module schema { >createValidator6 : (schema: any) => [new (data: T) => T, number] > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -119,6 +125,7 @@ module schema { >createValidator7 : (schema: any) => (new (data: T) => T)[] > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ @@ -137,6 +144,7 @@ module schema { >createValidator8 : (schema: any) => Array<{ (data: T): T; }> > : ^ ^^ ^^^^^ >schema : any +> : ^^^ >data : T > : ^ diff --git a/tests/baselines/reference/jsxElementsAsIdentifierNames.errors.txt b/tests/baselines/reference/jsxElementsAsIdentifierNames.errors.txt new file mode 100644 index 00000000000..fa27091b1d9 --- /dev/null +++ b/tests/baselines/reference/jsxElementsAsIdentifierNames.errors.txt @@ -0,0 +1,21 @@ +a.tsx(2,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== a.tsx (1 errors) ==== + declare const React: any; + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface IntrinsicElements { + ["package"]: any; + } + } + + function A() { + return + } + + function B() { + return + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxElementsAsIdentifierNames.types b/tests/baselines/reference/jsxElementsAsIdentifierNames.types index 3dc93d5340a..d918363830f 100644 --- a/tests/baselines/reference/jsxElementsAsIdentifierNames.types +++ b/tests/baselines/reference/jsxElementsAsIdentifierNames.types @@ -3,11 +3,13 @@ === a.tsx === declare const React: any; >React : any +> : ^^^ declare module JSX { interface IntrinsicElements { ["package"]: any; >["package"] : any +> : ^^^ >"package" : "package" > : ^^^^^^^^^ } @@ -18,7 +20,8 @@ function A() { > : ^^^^^^^^^ return -> : error +> : any +> : ^^^ >package : any > : ^^^ } @@ -28,7 +31,8 @@ function B() { > : ^^^^^^^^^ return -> : error +> : any +> : ^^^ >package : any > : ^^^ >package : any diff --git a/tests/baselines/reference/jsxFactoryIdentifierAsParameter.errors.txt b/tests/baselines/reference/jsxFactoryIdentifierAsParameter.errors.txt new file mode 100644 index 00000000000..5d05da95c03 --- /dev/null +++ b/tests/baselines/reference/jsxFactoryIdentifierAsParameter.errors.txt @@ -0,0 +1,18 @@ +test.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== test.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface IntrinsicElements { + [s: string]: any; + } + } + + export class AppComponent { + render(createElement) { + return
; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryIdentifierAsParameter.types b/tests/baselines/reference/jsxFactoryIdentifierAsParameter.types index aae2038929e..61ece4923b2 100644 --- a/tests/baselines/reference/jsxFactoryIdentifierAsParameter.types +++ b/tests/baselines/reference/jsxFactoryIdentifierAsParameter.types @@ -17,9 +17,11 @@ export class AppComponent { >render : (createElement: any) => any > : ^ ^^^^^^^^^^^^^ >createElement : any +> : ^^^ return
; ->
: error +>
: any +> : ^^^ >div : any > : ^^^ } diff --git a/tests/baselines/reference/jsxFactoryIdentifierWithAbsentParameter.errors.txt b/tests/baselines/reference/jsxFactoryIdentifierWithAbsentParameter.errors.txt index 12f0c6873c8..5accb0db969 100644 --- a/tests/baselines/reference/jsxFactoryIdentifierWithAbsentParameter.errors.txt +++ b/tests/baselines/reference/jsxFactoryIdentifierWithAbsentParameter.errors.txt @@ -1,8 +1,11 @@ +test.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. test.tsx(9,17): error TS2552: Cannot find name 'createElement'. Did you mean 'frameElement'? -==== test.tsx (1 errors) ==== +==== test.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface IntrinsicElements { [s: string]: any; } diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameResolutionError.errors.txt b/tests/baselines/reference/jsxFactoryQualifiedNameResolutionError.errors.txt index 869be8017a4..6a8e9ea4486 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedNameResolutionError.errors.txt +++ b/tests/baselines/reference/jsxFactoryQualifiedNameResolutionError.errors.txt @@ -1,8 +1,11 @@ +test.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. test.tsx(9,17): error TS2552: Cannot find name 'MyElement'. Did you mean 'Element'? -==== test.tsx (1 errors) ==== +==== test.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface IntrinsicElements { [s: string]: any; } diff --git a/tests/baselines/reference/jsxParsingError1.errors.txt b/tests/baselines/reference/jsxParsingError1.errors.txt index 7d8811dc51e..6c97c0673a5 100644 --- a/tests/baselines/reference/jsxParsingError1.errors.txt +++ b/tests/baselines/reference/jsxParsingError1.errors.txt @@ -1,9 +1,12 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(11,30): error TS2695: Left side of comma operator is unused and has no side effects. file.tsx(11,30): error TS18007: JSX expressions may not use the comma operator. Did you mean to write an array? -==== file.tsx (2 errors) ==== +==== file.tsx (3 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { [s: string]: any; diff --git a/tests/baselines/reference/lambdaPropSelf.errors.txt b/tests/baselines/reference/lambdaPropSelf.errors.txt index 4bc36121a9b..1998af93380 100644 --- a/tests/baselines/reference/lambdaPropSelf.errors.txt +++ b/tests/baselines/reference/lambdaPropSelf.errors.txt @@ -1,7 +1,8 @@ +lambdaPropSelf.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. lambdaPropSelf.ts(21,13): error TS2331: 'this' cannot be referenced in a module or namespace body. -==== lambdaPropSelf.ts (1 errors) ==== +==== lambdaPropSelf.ts (2 errors) ==== declare var ko: any; class Person { @@ -22,6 +23,8 @@ lambdaPropSelf.ts(21,13): error TS2331: 'this' cannot be referenced in a module } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x = this; ~~~~ !!! error TS2331: 'this' cannot be referenced in a module or namespace body. diff --git a/tests/baselines/reference/letDeclarations-scopes.errors.txt b/tests/baselines/reference/letDeclarations-scopes.errors.txt index 821b2e4dcf7..f2839da01cd 100644 --- a/tests/baselines/reference/letDeclarations-scopes.errors.txt +++ b/tests/baselines/reference/letDeclarations-scopes.errors.txt @@ -1,7 +1,8 @@ letDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +letDeclarations-scopes.ts(110,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== letDeclarations-scopes.ts (1 errors) ==== +==== letDeclarations-scopes.ts (2 errors) ==== // global let l = "string"; @@ -114,6 +115,8 @@ letDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not suppo // modules module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. let l = 0; n = l; diff --git a/tests/baselines/reference/letDeclarations-validContexts.errors.txt b/tests/baselines/reference/letDeclarations-validContexts.errors.txt index 4c449306eaf..40c275f274f 100644 --- a/tests/baselines/reference/letDeclarations-validContexts.errors.txt +++ b/tests/baselines/reference/letDeclarations-validContexts.errors.txt @@ -1,7 +1,9 @@ letDeclarations-validContexts.ts(18,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +letDeclarations-validContexts.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +letDeclarations-validContexts.ts(136,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== letDeclarations-validContexts.ts (1 errors) ==== +==== letDeclarations-validContexts.ts (3 errors) ==== // Control flow statements with blocks if (true) { let l1 = 0; @@ -89,6 +91,8 @@ letDeclarations-validContexts.ts(18,1): error TS2410: The 'with' statement is no // modules module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. let l22 = 0; { @@ -140,6 +144,8 @@ letDeclarations-validContexts.ts(18,1): error TS2410: The 'with' statement is no } module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. label: let l34 = 0; { label2: let l35 = 0; diff --git a/tests/baselines/reference/libMembers.errors.txt b/tests/baselines/reference/libMembers.errors.txt index b1d326c8179..d5c4706a917 100644 --- a/tests/baselines/reference/libMembers.errors.txt +++ b/tests/baselines/reference/libMembers.errors.txt @@ -1,9 +1,10 @@ libMembers.ts(4,3): error TS2339: Property 'subby' does not exist on type 'string'. +libMembers.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. libMembers.ts(9,17): error TS1011: An element access expression should take an argument. libMembers.ts(12,15): error TS2339: Property 'prototype' does not exist on type 'C'. -==== libMembers.ts (3 errors) ==== +==== libMembers.ts (4 errors) ==== var s="hello"; s.substring(0); s.substring(3,4); @@ -12,6 +13,8 @@ libMembers.ts(12,15): error TS2339: Property 'prototype' does not exist on type !!! error TS2339: Property 'subby' does not exist on type 'string'. String.fromCharCode(12); module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class C { } var a=new C[]; diff --git a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt index a6a8a41cdf8..8da585f0850 100644 --- a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,4 @@ +logicalNotOperatorWithAnyOtherType.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. logicalNotOperatorWithAnyOtherType.ts(33,25): error TS2873: This kind of expression is always falsy. logicalNotOperatorWithAnyOtherType.ts(34,25): error TS2873: This kind of expression is always falsy. logicalNotOperatorWithAnyOtherType.ts(45,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'. @@ -6,7 +7,7 @@ logicalNotOperatorWithAnyOtherType.ts(47,27): error TS2365: Operator '+' cannot logicalNotOperatorWithAnyOtherType.ts(57,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== logicalNotOperatorWithAnyOtherType.ts (6 errors) ==== +==== logicalNotOperatorWithAnyOtherType.ts (7 errors) ==== // ! operator on any type var ANY: any; @@ -26,6 +27,8 @@ logicalNotOperatorWithAnyOtherType.ts(57,1): error TS2695: Left side of comma op } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.errors.txt b/tests/baselines/reference/logicalNotOperatorWithNumberType.errors.txt index 03ced35d644..a167e4e4392 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.errors.txt @@ -1,9 +1,10 @@ +logicalNotOperatorWithNumberType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. logicalNotOperatorWithNumberType.ts(23,25): error TS2872: This kind of expression is always truthy. logicalNotOperatorWithNumberType.ts(24,25): error TS2872: This kind of expression is always truthy. logicalNotOperatorWithNumberType.ts(45,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== logicalNotOperatorWithNumberType.ts (3 errors) ==== +==== logicalNotOperatorWithNumberType.ts (4 errors) ==== // ! operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -15,6 +16,8 @@ logicalNotOperatorWithNumberType.ts(45,1): error TS2695: Left side of comma oper static foo() { return 1; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: number; } diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.errors.txt b/tests/baselines/reference/logicalNotOperatorWithStringType.errors.txt index 6ea2e395e80..2c9766d941b 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.errors.txt @@ -1,3 +1,4 @@ +logicalNotOperatorWithStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. logicalNotOperatorWithStringType.ts(22,25): error TS2873: This kind of expression is always falsy. logicalNotOperatorWithStringType.ts(23,25): error TS2872: This kind of expression is always truthy. logicalNotOperatorWithStringType.ts(24,25): error TS2872: This kind of expression is always truthy. @@ -5,7 +6,7 @@ logicalNotOperatorWithStringType.ts(40,2): error TS2873: This kind of expression logicalNotOperatorWithStringType.ts(44,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== logicalNotOperatorWithStringType.ts (5 errors) ==== +==== logicalNotOperatorWithStringType.ts (6 errors) ==== // ! operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -17,6 +18,8 @@ logicalNotOperatorWithStringType.ts(44,1): error TS2695: Left side of comma oper static foo() { return ""; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: string; } diff --git a/tests/baselines/reference/mergeClassInterfaceAndModule.errors.txt b/tests/baselines/reference/mergeClassInterfaceAndModule.errors.txt new file mode 100644 index 00000000000..19f57568b91 --- /dev/null +++ b/tests/baselines/reference/mergeClassInterfaceAndModule.errors.txt @@ -0,0 +1,30 @@ +mergeClassInterfaceAndModule.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeClassInterfaceAndModule.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeClassInterfaceAndModule.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeClassInterfaceAndModule.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergeClassInterfaceAndModule.ts (4 errors) ==== + interface C1 {} + declare class C1 {} + module C1 {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + declare class C2 {} + interface C2 {} + module C2 {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + declare class C3 {} + module C3 {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface C3 {} + + module C4 {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + declare class C4 {} // error -- class declaration must precede module declaration + interface C4 {} \ No newline at end of file diff --git a/tests/baselines/reference/mergeThreeInterfaces.errors.txt b/tests/baselines/reference/mergeThreeInterfaces.errors.txt new file mode 100644 index 00000000000..07bb1e401db --- /dev/null +++ b/tests/baselines/reference/mergeThreeInterfaces.errors.txt @@ -0,0 +1,84 @@ +mergeThreeInterfaces.ts(40,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergeThreeInterfaces.ts (1 errors) ==== + // interfaces with the same root module should merge + + // basic case + interface A { + foo: string; + } + + interface A { + bar: number; + } + + interface A { + baz: boolean; + } + + var a: A; + var r1 = a.foo + var r2 = a.bar; + var r3 = a.baz; + + // basic generic case + interface B { + foo: T; + } + + interface B { + bar: T; + } + + interface B { + baz: T; + } + + var b: B; + var r4 = b.foo + var r5 = b.bar; + var r6 = b.baz; + + // basic non-generic and generic case inside a module + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface A { + foo: string; + } + + interface A { + bar: number; + } + + interface A { + baz: boolean; + } + + var a: A; + var r1 = a.foo; + // BUG 856491 + var r2 = a.bar; // any, should be number + // BUG 856491 + var r3 = a.baz; // any, should be boolean + + interface B { + foo: T; + } + + interface B { + bar: T; + } + + interface B { + baz: T; + } + + var b: B; + var r4 = b.foo + // BUG 856491 + var r5 = b.bar; // any, should be number + // BUG 856491 + var r6 = b.baz; // any, should be boolean + } \ No newline at end of file diff --git a/tests/baselines/reference/mergeThreeInterfaces2.errors.txt b/tests/baselines/reference/mergeThreeInterfaces2.errors.txt new file mode 100644 index 00000000000..388127323bf --- /dev/null +++ b/tests/baselines/reference/mergeThreeInterfaces2.errors.txt @@ -0,0 +1,94 @@ +mergeThreeInterfaces2.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(30,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(31,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(43,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(56,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergeThreeInterfaces2.ts(57,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergeThreeInterfaces2.ts (8 errors) ==== + // two interfaces with the same root module should merge + + // root module now multiple module declarations + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface A { + foo: string; + } + + var a: A; + var r1 = a.foo; + var r2 = a.bar; + } + + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface A { + bar: number; + } + + export interface A { + baz: boolean; + } + + var a: A; + var r1 = a.foo; + var r2 = a.bar; + var r3 = a.baz; + } + + // same as above but with an additional level of nesting and third module declaration + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface A { + foo: string; + } + + var a: A; + var r1 = a.foo; + var r2 = a.bar; + } + } + + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface A { + bar: number; + } + + var a: A; + + var r1 = a.foo + var r2 = a.bar; + var r3 = a.baz; + } + } + + module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface A { + baz: boolean; + } + + var a: A; + var r1 = a.foo + var r2 = a.bar; + var r3 = a.baz; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/mergedDeclarations1.errors.txt b/tests/baselines/reference/mergedDeclarations1.errors.txt new file mode 100644 index 00000000000..57d28e7005d --- /dev/null +++ b/tests/baselines/reference/mergedDeclarations1.errors.txt @@ -0,0 +1,22 @@ +mergedDeclarations1.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergedDeclarations1.ts (1 errors) ==== + interface Point { + x: number; + y: number; + } + function point(x: number, y: number): Point { + return { x: x, y: y }; + } + module point { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var origin = point(0, 0); + export function equals(p1: Point, p2: Point) { + return p1.x == p2.x && p1.y == p2.y; + } + } + var p1 = point(0, 0); + var p2 = point.origin; + var b = point.equals(p1, p2); \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt new file mode 100644 index 00000000000..04c2bc16bd6 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt @@ -0,0 +1,30 @@ +mergedModuleDeclarationCodeGen.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen.ts(10,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen.ts(11,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergedModuleDeclarationCodeGen.ts (4 errors) ==== + export module X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class A { + constructor(Y: any) { + new B(); + } + } + } + } + export module X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class B { + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen.types index fcf9b2e57fe..245dafc0bd5 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.types +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.types @@ -15,6 +15,7 @@ export module X { constructor(Y: any) { >Y : any +> : ^^^ new B(); >new B() : B diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.errors.txt new file mode 100644 index 00000000000..88d66f8fe37 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.errors.txt @@ -0,0 +1,43 @@ +mergedModuleDeclarationCodeGen4.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(3,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(3,26): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(4,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(8,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(8,26): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mergedModuleDeclarationCodeGen4.ts(9,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mergedModuleDeclarationCodeGen4.ts (8 errors) ==== + module superContain { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module contain { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module my.buz { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module data { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo() { } + } + } + export module my.buz { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module data { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function bar(contain, my, buz, data) { + foo(); + } + } + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types index d38c5bea8c3..311e6addb82 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen4.types @@ -38,9 +38,13 @@ module superContain { >bar : (contain: any, my: any, buz: any, data: any) => void > : ^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^ >contain : any +> : ^^^ >my : any +> : ^^^ >buz : any +> : ^^^ >data : any +> : ^^^ foo(); >foo() : void diff --git a/tests/baselines/reference/metadataOfClassFromModule.errors.txt b/tests/baselines/reference/metadataOfClassFromModule.errors.txt new file mode 100644 index 00000000000..395bce6a9ad --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.errors.txt @@ -0,0 +1,17 @@ +metadataOfClassFromModule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== metadataOfClassFromModule.ts (1 errors) ==== + module MyModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export function inject(target: any, key: string): void { } + + export class Leg { } + + export class Person { + @inject leftLeg: Leg; + } + + } \ No newline at end of file diff --git a/tests/baselines/reference/metadataOfClassFromModule.types b/tests/baselines/reference/metadataOfClassFromModule.types index fef7de3fb54..6e77771dc78 100644 --- a/tests/baselines/reference/metadataOfClassFromModule.types +++ b/tests/baselines/reference/metadataOfClassFromModule.types @@ -9,6 +9,7 @@ module MyModule { >inject : (target: any, key: string) => void > : ^ ^^ ^^ ^^ ^^^^^ >target : any +> : ^^^ >key : string > : ^^^^^^ diff --git a/tests/baselines/reference/methodContainingLocalFunction.errors.txt b/tests/baselines/reference/methodContainingLocalFunction.errors.txt new file mode 100644 index 00000000000..211b749ef64 --- /dev/null +++ b/tests/baselines/reference/methodContainingLocalFunction.errors.txt @@ -0,0 +1,56 @@ +methodContainingLocalFunction.ts(35,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== methodContainingLocalFunction.ts (1 errors) ==== + // The first case here (BugExhibition) caused a crash. Try with different permutations of features. + class BugExhibition { + public exhibitBug() { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + } + } + + class BugExhibition2 { + private static get exhibitBug() { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + return null; + } + } + + class BugExhibition3 { + public exhibitBug() { + function localGenericFunction(u?: U) { } + var x: { (): void; }; + x = localGenericFunction; + } + } + + class C { + exhibit() { + var funcExpr = (u?: U) => { }; + var x: { (): void; }; + x = funcExpr; + } + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function exhibitBug() { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + } + } + + enum E { + A = (() => { + function localFunction() { } + var x: { (): void; }; + x = localFunction; + return 0; + })() + } \ No newline at end of file diff --git a/tests/baselines/reference/methodContainingLocalFunction.types b/tests/baselines/reference/methodContainingLocalFunction.types index 16e730b1e45..28d8436b51e 100644 --- a/tests/baselines/reference/methodContainingLocalFunction.types +++ b/tests/baselines/reference/methodContainingLocalFunction.types @@ -34,6 +34,7 @@ class BugExhibition2 { private static get exhibitBug() { >exhibitBug : any +> : ^^^ function localFunction() { } >localFunction : () => void diff --git a/tests/baselines/reference/missingTypeArguments3.errors.txt b/tests/baselines/reference/missingTypeArguments3.errors.txt new file mode 100644 index 00000000000..96f2a3b07a2 --- /dev/null +++ b/tests/baselines/reference/missingTypeArguments3.errors.txt @@ -0,0 +1,47 @@ +missingTypeArguments3.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== missingTypeArguments3.ts (1 errors) ==== + declare module linq { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + interface Enumerable { + OrderByDescending(keySelector?: string): OrderedEnumerable; + GroupBy(keySelector: (element: T) => TKey): Enumerable>; + GroupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): Enumerable>; + ToDictionary(keySelector: (element: T) => TKey): Dictionary; + } + + interface OrderedEnumerable extends Enumerable { + ThenBy(keySelector: (element: T) => TCompare): OrderedEnumerable; // used to incorrectly think this was missing a type argument + } + + interface Grouping extends Enumerable { + Key(): TKey; + } + + interface Lookup { + Count(): number; + Get(key): Enumerable; + Contains(key): boolean; + ToEnumerable(): Enumerable>; + } + + interface Dictionary { + Add(key: TKey, value: TValue): void; + Get(ke: TKey): TValue; + Set(key: TKey, value: TValue): boolean; + Contains(key: TKey): boolean; + Clear(): void; + Remove(key: TKey): void; + Count(): number; + ToEnumerable(): Enumerable>; + } + + interface KeyValuePair { + Key: TKey; + Value: TValue; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/missingTypeArguments3.types b/tests/baselines/reference/missingTypeArguments3.types index 15361f8b7f2..d49f2692764 100644 --- a/tests/baselines/reference/missingTypeArguments3.types +++ b/tests/baselines/reference/missingTypeArguments3.types @@ -64,11 +64,13 @@ declare module linq { >Get : (key: any) => Enumerable > : ^ ^^^^^^^^^^ >key : any +> : ^^^ Contains(key): boolean; >Contains : (key: any) => boolean > : ^ ^^^^^^^^^^ >key : any +> : ^^^ ToEnumerable(): Enumerable>; >ToEnumerable : () => Enumerable> diff --git a/tests/baselines/reference/mixedExports.errors.txt b/tests/baselines/reference/mixedExports.errors.txt new file mode 100644 index 00000000000..5bfe77f7073 --- /dev/null +++ b/tests/baselines/reference/mixedExports.errors.txt @@ -0,0 +1,31 @@ +mixedExports.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mixedExports.ts(7,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mixedExports.ts(12,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +mixedExports.ts(14,13): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== mixedExports.ts (4 errors) ==== + declare module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function foo(); + export function foo(); + function foo(); + } + + declare module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface Foo {} + interface Foo {} + } + + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface X {x} + export module X {} + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface X {y} + } \ No newline at end of file diff --git a/tests/baselines/reference/mixedExports.types b/tests/baselines/reference/mixedExports.types index 1bd470ab57a..344e6d37d19 100644 --- a/tests/baselines/reference/mixedExports.types +++ b/tests/baselines/reference/mixedExports.types @@ -26,8 +26,10 @@ declare module M1 { module A { interface X {x} >x : any +> : ^^^ export module X {} interface X {y} >y : any +> : ^^^ } diff --git a/tests/baselines/reference/moduleExports1.errors.txt b/tests/baselines/reference/moduleExports1.errors.txt index 299a23e0e32..4c02d2ab5a9 100644 --- a/tests/baselines/reference/moduleExports1.errors.txt +++ b/tests/baselines/reference/moduleExports1.errors.txt @@ -1,9 +1,18 @@ +moduleExports1.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleExports1.ts(1,26): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleExports1.ts(1,34): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleExports1.ts(13,6): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. moduleExports1.ts(13,22): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== moduleExports1.ts (2 errors) ==== +==== moduleExports1.ts (5 errors) ==== export module TypeScript.Strasse.Street { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Rue { public address:string; } diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.errors.txt b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.errors.txt new file mode 100644 index 00000000000..cbfb2b7c2cf --- /dev/null +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.errors.txt @@ -0,0 +1,67 @@ +moduleMemberWithoutTypeAnnotation1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation1.ts(1,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation1.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation1.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation1.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation1.ts(37,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleMemberWithoutTypeAnnotation1.ts (6 errors) ==== + module TypeScript.Parser { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class SyntaxCursor { + public currentNode(): SyntaxNode { + return null; + } + } + } + + module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface ISyntaxElement { }; + export interface ISyntaxToken { }; + + export class PositionedElement { + public childIndex(child: ISyntaxElement) { + return Syntax.childIndex(); + } + } + + export class PositionedToken { + constructor(parent: PositionedElement, token: ISyntaxToken, fullStart: number) { + } + } + } + + module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class SyntaxNode { + public findToken(position: number, includeSkippedTokens: boolean = false): PositionedToken { + var positionedToken = this.findTokenInternal(null, position, 0); + return null; + } + findTokenInternal(x, y, z) { + return null; + } + } + } + + module TypeScript.Syntax { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function childIndex() { } + + export class VariableWidthTokenWithTrailingTrivia implements ISyntaxToken { + private findTokenInternal(parent: PositionedElement, position: number, fullStart: number) { + return new PositionedToken(parent, this, fullStart); + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types index 6d1a1d52fda..0ef462853f0 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation1.types @@ -84,7 +84,9 @@ module TypeScript { var positionedToken = this.findTokenInternal(null, position, 0); >positionedToken : any +> : ^^^ >this.findTokenInternal(null, position, 0) : any +> : ^^^ >this.findTokenInternal : (x: any, y: any, z: any) => any > : ^ ^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^ >this : this @@ -102,8 +104,11 @@ module TypeScript { >findTokenInternal : (x: any, y: any, z: any) => any > : ^ ^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^ >x : any +> : ^^^ >y : any +> : ^^^ >z : any +> : ^^^ return null; } diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.errors.txt b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.errors.txt new file mode 100644 index 00000000000..8802d9a3814 --- /dev/null +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.errors.txt @@ -0,0 +1,26 @@ +moduleMemberWithoutTypeAnnotation2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMemberWithoutTypeAnnotation2.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleMemberWithoutTypeAnnotation2.ts (2 errors) ==== + module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module CompilerDiagnostics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export interface IDiagnosticWriter { + Alert(output: string): void; + } + + export var diagnosticWriter = null; + + export function Alert(output: string) { + if (diagnosticWriter) { + diagnosticWriter.Alert(output); + } + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types index b67cc2c13d0..8e555c25e92 100644 --- a/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types +++ b/tests/baselines/reference/moduleMemberWithoutTypeAnnotation2.types @@ -19,6 +19,7 @@ module TypeScript { export var diagnosticWriter = null; >diagnosticWriter : any +> : ^^^ export function Alert(output: string) { >Alert : (output: string) => void @@ -28,10 +29,13 @@ module TypeScript { if (diagnosticWriter) { >diagnosticWriter : any +> : ^^^ diagnosticWriter.Alert(output); >diagnosticWriter.Alert(output) : any +> : ^^^ >diagnosticWriter.Alert : any +> : ^^^ >diagnosticWriter : any > : ^^^ >Alert : any diff --git a/tests/baselines/reference/moduleMerge.errors.txt b/tests/baselines/reference/moduleMerge.errors.txt new file mode 100644 index 00000000000..beff8cc4091 --- /dev/null +++ b/tests/baselines/reference/moduleMerge.errors.txt @@ -0,0 +1,32 @@ +moduleMerge.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleMerge.ts(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleMerge.ts (2 errors) ==== + // This should not compile both B classes are in the same module this should be a collission + + module A + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + { + class B + { + public Hello(): string + { + return "from private B"; + } + } + } + + module A + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + { + export class B + { + public Hello(): string + { + return "from export B"; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleProperty1.errors.txt b/tests/baselines/reference/moduleProperty1.errors.txt index 19e7bab7404..acb6668ef30 100644 --- a/tests/baselines/reference/moduleProperty1.errors.txt +++ b/tests/baselines/reference/moduleProperty1.errors.txt @@ -1,16 +1,22 @@ +moduleProperty1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleProperty1.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleProperty1.ts(9,5): error TS1128: Declaration or statement expected. moduleProperty1.ts(9,13): error TS2304: Cannot find name 'y'. moduleProperty1.ts(10,20): error TS2304: Cannot find name 'y'. -==== moduleProperty1.ts (3 errors) ==== +==== moduleProperty1.ts (5 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x=10; // variable local to this module body var y=x; // property visible only in module export var z=y; // property visible to any code } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var x = 10; // variable local to this module body private y = x; // can't use private in modules ~~~~~~~ diff --git a/tests/baselines/reference/moduleProperty2.errors.txt b/tests/baselines/reference/moduleProperty2.errors.txt index 6e2a19391d5..16dcd6deaa1 100644 --- a/tests/baselines/reference/moduleProperty2.errors.txt +++ b/tests/baselines/reference/moduleProperty2.errors.txt @@ -1,9 +1,13 @@ +moduleProperty2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleProperty2.ts(7,15): error TS2304: Cannot find name 'x'. +moduleProperty2.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleProperty2.ts(12,17): error TS2339: Property 'y' does not exist on type 'typeof M'. -==== moduleProperty2.ts (2 errors) ==== +==== moduleProperty2.ts (4 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. function f() { var x; } @@ -16,6 +20,8 @@ moduleProperty2.ts(12,17): error TS2339: Property 'y' does not exist on type 'ty } module N { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var test3=M.y; // nope y private property of M ~ !!! error TS2339: Property 'y' does not exist on type 'typeof M'. diff --git a/tests/baselines/reference/moduleScopingBug.errors.txt b/tests/baselines/reference/moduleScopingBug.errors.txt new file mode 100644 index 00000000000..28687522bc8 --- /dev/null +++ b/tests/baselines/reference/moduleScopingBug.errors.txt @@ -0,0 +1,38 @@ +moduleScopingBug.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleScopingBug.ts(21,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleScopingBug.ts (2 errors) ==== + module M + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + { + + var outer: number; + + function f() { + + var inner = outer; // Ok + + } + + class C { + + constructor() { + var inner = outer; // Ok + } + + } + + module X { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + var inner = outer; // Error: outer not visible + + } + + } + + \ No newline at end of file diff --git a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt3.errors.txt b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt3.errors.txt index 33f779f295c..2be7e13741c 100644 --- a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt3.errors.txt +++ b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt3.errors.txt @@ -1,10 +1,18 @@ +moduleSharesNameWithImportDeclarationInsideIt3.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt3.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt3.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt3.ts(9,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleSharesNameWithImportDeclarationInsideIt3.ts(10,12): error TS2300: Duplicate identifier 'M'. moduleSharesNameWithImportDeclarationInsideIt3.ts(11,12): error TS2300: Duplicate identifier 'M'. -==== moduleSharesNameWithImportDeclarationInsideIt3.ts (2 errors) ==== +==== moduleSharesNameWithImportDeclarationInsideIt3.ts (6 errors) ==== module Z { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function bar() { return ""; } @@ -12,6 +20,10 @@ moduleSharesNameWithImportDeclarationInsideIt3.ts(11,12): error TS2300: Duplicat export interface I { } } module A.M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import M = Z.M; ~ !!! error TS2300: Duplicate identifier 'M'. diff --git a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.errors.txt b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.errors.txt index bd51066e009..46e189c75a2 100644 --- a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.errors.txt +++ b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.errors.txt @@ -1,10 +1,18 @@ +moduleSharesNameWithImportDeclarationInsideIt5.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt5.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt5.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleSharesNameWithImportDeclarationInsideIt5.ts(9,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleSharesNameWithImportDeclarationInsideIt5.ts(10,12): error TS2300: Duplicate identifier 'M'. moduleSharesNameWithImportDeclarationInsideIt5.ts(11,12): error TS2300: Duplicate identifier 'M'. -==== moduleSharesNameWithImportDeclarationInsideIt5.ts (2 errors) ==== +==== moduleSharesNameWithImportDeclarationInsideIt5.ts (6 errors) ==== module Z { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function bar() { return ""; } @@ -12,6 +20,10 @@ moduleSharesNameWithImportDeclarationInsideIt5.ts(11,12): error TS2300: Duplicat export interface I { } } module A.M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import M = Z.I; ~ !!! error TS2300: Duplicate identifier 'M'. diff --git a/tests/baselines/reference/moduleVisibilityTest1.errors.txt b/tests/baselines/reference/moduleVisibilityTest1.errors.txt new file mode 100644 index 00000000000..5cbd13a9169 --- /dev/null +++ b/tests/baselines/reference/moduleVisibilityTest1.errors.txt @@ -0,0 +1,83 @@ +moduleVisibilityTest1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest1.ts(4,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest1.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest1.ts(13,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest1.ts(53,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleVisibilityTest1.ts (5 errors) ==== + module OuterMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function someExportedOuterFunc() { return -1; } + + export module OuterInnerMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function someExportedOuterInnerFunc() { return "foo"; } + } + } + + import OuterInnerAlias = OuterMod.OuterInnerMod; + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export module InnerMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function someExportedInnerFunc() { return -2; } + } + + export enum E { + A, + B, + C, + } + + export var x = 5; + export declare var exported_var; + + var y = x + x; + + + export interface I { + someMethod():number; + } + + class B {public b = 0;} + + export class C implements I { + public someMethodThatCallsAnOuterMethod() {return OuterInnerAlias.someExportedOuterInnerFunc();} + public someMethodThatCallsAnInnerMethod() {return InnerMod.someExportedInnerFunc();} + public someMethodThatCallsAnOuterInnerMethod() {return OuterMod.someExportedOuterFunc();} + public someMethod() { return 0; } + public someProp = 1; + + constructor() { + function someInnerFunc() { return 2; } + var someInnerVar = 3; + } + } + + var someModuleVar = 4; + + function someModuleFunction() { return 5;} + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c = x; + export var meb = M.E.B; + } + + var cprime : M.I = null; + + var c = new M.C(); + var z = M.x; + var alpha = M.E.A; + var omega = M.exported_var; + c.someMethodThatCallsAnOuterMethod(); + \ No newline at end of file diff --git a/tests/baselines/reference/moduleVisibilityTest1.types b/tests/baselines/reference/moduleVisibilityTest1.types index d300bd0a643..1af975ff8d8 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.types +++ b/tests/baselines/reference/moduleVisibilityTest1.types @@ -75,6 +75,7 @@ module M { export declare var exported_var; >exported_var : any +> : ^^^ var y = x + x; >y : number @@ -254,7 +255,9 @@ var alpha = M.E.A; var omega = M.exported_var; >omega : any +> : ^^^ >M.exported_var : any +> : ^^^ >M : typeof M > : ^^^^^^^^ >exported_var : any diff --git a/tests/baselines/reference/moduleVisibilityTest2.errors.txt b/tests/baselines/reference/moduleVisibilityTest2.errors.txt index 0fd8fbeb7a0..e1f4c897277 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.errors.txt +++ b/tests/baselines/reference/moduleVisibilityTest2.errors.txt @@ -1,3 +1,8 @@ +moduleVisibilityTest2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest2.ts(4,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest2.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest2.ts(13,2): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleVisibilityTest2.ts(54,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. moduleVisibilityTest2.ts(55,17): error TS2304: Cannot find name 'x'. moduleVisibilityTest2.ts(56,21): error TS2339: Property 'E' does not exist on type 'typeof M'. moduleVisibilityTest2.ts(59,16): error TS2694: Namespace 'M' has no exported member 'I'. @@ -6,11 +11,15 @@ moduleVisibilityTest2.ts(62,11): error TS2339: Property 'x' does not exist on ty moduleVisibilityTest2.ts(63,15): error TS2339: Property 'E' does not exist on type 'typeof M'. -==== moduleVisibilityTest2.ts (6 errors) ==== +==== moduleVisibilityTest2.ts (11 errors) ==== module OuterMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function someExportedOuterFunc() { return -1; } export module OuterInnerMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function someExportedOuterInnerFunc() { return "foo"; } } } @@ -18,8 +27,12 @@ moduleVisibilityTest2.ts(63,15): error TS2339: Property 'E' does not exist on ty import OuterInnerAlias = OuterMod.OuterInnerMod; module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module InnerMod { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function someExportedInnerFunc() { return -2; } } @@ -61,6 +74,8 @@ moduleVisibilityTest2.ts(63,15): error TS2339: Property 'E' does not exist on ty } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var c = x; ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/moduleWithStatementsOfEveryKind.errors.txt new file mode 100644 index 00000000000..2887de8d0f1 --- /dev/null +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.errors.txt @@ -0,0 +1,73 @@ +moduleWithStatementsOfEveryKind.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleWithStatementsOfEveryKind.ts(11,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleWithStatementsOfEveryKind.ts(30,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduleWithStatementsOfEveryKind.ts(40,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduleWithStatementsOfEveryKind.ts (4 errors) ==== + module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class A { s: string } + class AA { s: T } + interface I { id: number } + + class B extends AA implements I { id: number } + class BB extends A { + id: number; + } + + module Module { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class A { s: string } + } + enum Color { Blue, Red } + var x = 12; + function F(s: string): number { + return 2; + } + var array: I[] = null; + var fn = (s: string) => { + return 'hello ' + s; + } + var ol = { s: 'hello', id: 2, isvalid: true }; + + declare class DC { + static x: number; + } + } + + module Y { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class A { s: string } + export class AA { s: T } + export interface I { id: number } + + export class B extends AA implements I { id: number } + export class BB extends A { + id: number; + } + + export module Module { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class A { s: string } + } + export enum Color { Blue, Red } + export var x = 12; + export function F(s: string): number { + return 2; + } + export var array: I[] = null; + export var fn = (s: string) => { + return 'hello ' + s; + } + export var ol = { s: 'hello', id: 2, isvalid: true }; + + export declare class DC { + static x: number; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduledecl.errors.txt b/tests/baselines/reference/moduledecl.errors.txt new file mode 100644 index 00000000000..e0ab468d383 --- /dev/null +++ b/tests/baselines/reference/moduledecl.errors.txt @@ -0,0 +1,313 @@ +moduledecl.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(4,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(7,10): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(18,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(47,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(84,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(85,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(90,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(95,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(97,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(98,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(104,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(105,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(106,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(107,20): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(118,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(122,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(126,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(130,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(138,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(178,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +moduledecl.ts(195,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== moduledecl.ts (26 errors) ==== + module a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + + module b.a { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + } + + module c.a.b { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import ma = a; + } + + module mImport { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import d = a; + import e = b.a; + import d1 = a; + import e1 = b.a; + } + + module m0 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function f1() { + } + + function f2(s: string); + function f2(n: number); + function f2(ns: any) { + } + + class c1 { + public a : ()=>string; + private b: ()=>number; + private static s1; + public static s2; + } + + interface i1 { + () : Object; + [n: number]: c1; + } + + import m2 = a; + import m3 = b; + import m4 = b.a; + import m5 = c; + import m6 = c.a; + import m7 = c.a.b; + } + + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function f1() { + } + + export function f2(s: string); + export function f2(n: number); + export function f2(ns: any) { + } + + export class c1 { + public a: () =>string; + private b: () =>number; + private static s1; + public static s2; + + public d() { + return "Hello"; + } + + public e: { x: number; y: string; }; + constructor (public n, public n2: number, private n3, private n4: string) { + } + } + + export interface i1 { + () : Object; + [n: number]: c1; + } + + import m2 = a; + import m3 = b; + import m4 = b.a; + import m5 = c; + import m6 = c.a; + import m7 = c.a.b; + } + + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a = 10; + export var b: number; + } + + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c: number; + } + } + + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export module m25 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c: number; + } + } + } + + module m13 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c: number; + } + } + + export function f() { + return 20; + } + } + } + + declare module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var b; + } + + declare module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c; + } + + declare module m43 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var b; + } + + declare module m55 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var c; + } + + declare module "m3" { + export var b: number; + } + + module exportTests { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f2() { + return 30; + } + + public f3() { + return "string"; + } + } + class C2_private { + private f2() { + return 30; + } + + public f3() { + return "string"; + } + } + + export class C3_public { + private getC2_private() { + return new C2_private(); + } + private setC2_private(arg: C2_private) { + } + private get c2() { + return new C2_private(); + } + public getC1_public() { + return new C1_public(); + } + public setC1_public(arg: C1_public) { + } + public get c1() { + return new C1_public(); + } + } + } + + declare module mAmbient { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class C { + public myProp: number; + } + + function foo() : C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z + } + + module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class C { + public myProp: number; + } + + function foo(): C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z + } + } + } + + function foo() { + return mAmbient.foo(); + } + + var cVar = new mAmbient.C(); + var aVar = mAmbient.aVar; + var bB: mAmbient.B; + var eVar: mAmbient.e; + + function m3foo() { + return mAmbient.m3.foo(); + } + + var m3cVar = new mAmbient.m3.C(); + var m3aVar = mAmbient.m3.aVar; + var m3bB: mAmbient.m3.B; + var m3eVar: mAmbient.m3.e; + + \ No newline at end of file diff --git a/tests/baselines/reference/moduledecl.types b/tests/baselines/reference/moduledecl.types index 184d5e917e6..fe528812994 100644 --- a/tests/baselines/reference/moduledecl.types +++ b/tests/baselines/reference/moduledecl.types @@ -11,14 +11,16 @@ module c.a.b { import ma = a; >ma : any > : ^^^ ->a : error +>a : any +> : ^^^ } module mImport { import d = a; >d : any > : ^^^ ->a : error +>a : any +> : ^^^ import e = b.a; >e : any @@ -31,7 +33,8 @@ module mImport { import d1 = a; >d1 : any > : ^^^ ->a : error +>a : any +> : ^^^ import e1 = b.a; >e1 : any @@ -67,6 +70,7 @@ module m0 { >f2 : { (s: string): any; (n: number): any; } > : ^^^ ^^ ^^^^^^^^^ ^^ ^^^^^^^^^ >ns : any +> : ^^^ } class c1 { @@ -83,9 +87,11 @@ module m0 { private static s1; >s1 : any +> : ^^^ public static s2; >s2 : any +> : ^^^ } interface i1 { @@ -98,12 +104,14 @@ module m0 { import m2 = a; >m2 : any > : ^^^ ->a : error +>a : any +> : ^^^ import m3 = b; >m3 : any > : ^^^ ->b : error +>b : any +> : ^^^ import m4 = b.a; >m4 : any @@ -116,7 +124,8 @@ module m0 { import m5 = c; >m5 : any > : ^^^ ->c : error +>c : any +> : ^^^ import m6 = c.a; >m6 : any @@ -162,6 +171,7 @@ module m1 { >f2 : { (s: string): any; (n: number): any; } > : ^^^ ^^ ^^^^^^^^^ ^^ ^^^^^^^^^ >ns : any +> : ^^^ } export class c1 { @@ -178,9 +188,11 @@ module m1 { private static s1; >s1 : any +> : ^^^ public static s2; >s2 : any +> : ^^^ public d() { >d : () => string @@ -201,9 +213,11 @@ module m1 { constructor (public n, public n2: number, private n3, private n4: string) { >n : any +> : ^^^ >n2 : number > : ^^^^^^ >n3 : any +> : ^^^ >n4 : string > : ^^^^^^ } @@ -219,12 +233,14 @@ module m1 { import m2 = a; >m2 : any > : ^^^ ->a : error +>a : any +> : ^^^ import m3 = b; >m3 : any > : ^^^ ->b : error +>b : any +> : ^^^ import m4 = b.a; >m4 : any @@ -237,7 +253,8 @@ module m1 { import m5 = c; >m5 : any > : ^^^ ->c : error +>c : any +> : ^^^ import m6 = c.a; >m6 : any @@ -345,6 +362,7 @@ declare module m4 { export var b; >b : any +> : ^^^ } declare module m5 { @@ -353,6 +371,7 @@ declare module m5 { export var c; >c : any +> : ^^^ } declare module m43 { @@ -361,6 +380,7 @@ declare module m43 { export var b; >b : any +> : ^^^ } declare module m55 { @@ -369,6 +389,7 @@ declare module m55 { export var c; >c : any +> : ^^^ } declare module "m3" { diff --git a/tests/baselines/reference/multiModuleClodule1.errors.txt b/tests/baselines/reference/multiModuleClodule1.errors.txt new file mode 100644 index 00000000000..bbc0e4abde0 --- /dev/null +++ b/tests/baselines/reference/multiModuleClodule1.errors.txt @@ -0,0 +1,27 @@ +multiModuleClodule1.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +multiModuleClodule1.ts(12,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== multiModuleClodule1.ts (2 errors) ==== + class C { + constructor(x: number) { } + foo() { } + bar() { } + static boo() { } + } + + module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x = 1; + var y = 2; + } + module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo() { } + function baz() { return ''; } + } + + var c = new C(C.x); + c.foo = C.foo; \ No newline at end of file diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt new file mode 100644 index 00000000000..32436d2b54c --- /dev/null +++ b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt @@ -0,0 +1,27 @@ +f1.d.ts(3,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +f1.d.ts(3,18): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== f1.d.ts (2 errors) ==== + export {}; + + declare module M.M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export let x: number; + } + declare global { + interface SymbolConstructor { + observable: symbol; + } + class Cls {x} + let [a, b]: number[]; + export import X = M.M1.x; + } + +==== main.ts (0 errors) ==== + Symbol.observable; + new Cls().x + let c = a + b + X; \ No newline at end of file diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.types b/tests/baselines/reference/newNamesInGlobalAugmentations1.types index 324a8b49400..f46c99b0c5b 100644 --- a/tests/baselines/reference/newNamesInGlobalAugmentations1.types +++ b/tests/baselines/reference/newNamesInGlobalAugmentations1.types @@ -26,6 +26,7 @@ declare global { >Cls : Cls > : ^^^ >x : any +> : ^^^ let [a, b]: number[]; >a : number @@ -55,6 +56,7 @@ Symbol.observable; new Cls().x >new Cls().x : any +> : ^^^ >new Cls() : Cls > : ^^^ >Cls : typeof Cls diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index c12003b73e5..f00d267702e 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -18,10 +18,11 @@ newOperator.ts(42,5): error TS2351: This expression is not constructable. Type '{ a: string; }' has no construct signatures. newOperator.ts(46,5): error TS2351: This expression is not constructable. Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. +newOperator.ts(48,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. newOperator.ts(56,24): error TS1011: An element access expression should take an argument. -==== newOperator.ts (14 errors) ==== +==== newOperator.ts (15 errors) ==== interface ifc { } // Attempting to 'new' an interface yields poor error var i = new ifc(); @@ -103,6 +104,8 @@ newOperator.ts(56,24): error TS1011: An element access expression should take an !!! error TS2351: Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class T { x: number; } diff --git a/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt index 2d32b2f64f5..b4014291bb3 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInAmbientModule.errors.txt @@ -1,3 +1,4 @@ +noImplicitAnyParametersInAmbientModule.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. noImplicitAnyParametersInAmbientModule.ts(6,20): error TS7006: Parameter 'x' implicitly has an 'any' type. noImplicitAnyParametersInAmbientModule.ts(12,20): error TS7006: Parameter 'x' implicitly has an 'any' type. noImplicitAnyParametersInAmbientModule.ts(12,23): error TS7006: Parameter 'y' implicitly has an 'any' type. @@ -22,8 +23,10 @@ noImplicitAnyParametersInAmbientModule.ts(44,18): error TS7006: Parameter 'x' im noImplicitAnyParametersInAmbientModule.ts(44,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. -==== noImplicitAnyParametersInAmbientModule.ts (22 errors) ==== +==== noImplicitAnyParametersInAmbientModule.ts (23 errors) ==== declare module D_M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // No implicit-'any' errors. function dm_f1(): void; diff --git a/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt b/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt index 1813c2559b1..022b9b6feec 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyParametersInModule.errors.txt @@ -1,3 +1,4 @@ +noImplicitAnyParametersInModule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. noImplicitAnyParametersInModule.ts(6,19): error TS7006: Parameter 'x' implicitly has an 'any' type. noImplicitAnyParametersInModule.ts(12,19): error TS7006: Parameter 'x' implicitly has an 'any' type. noImplicitAnyParametersInModule.ts(12,22): error TS7006: Parameter 'y' implicitly has an 'any' type. @@ -22,8 +23,10 @@ noImplicitAnyParametersInModule.ts(44,18): error TS7006: Parameter 'x' implicitl noImplicitAnyParametersInModule.ts(44,21): error TS7019: Rest parameter 'r' implicitly has an 'any[]' type. -==== noImplicitAnyParametersInModule.ts (22 errors) ==== +==== noImplicitAnyParametersInModule.ts (23 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // No implicit-'any' errors. function m_f1(): void { } diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.errors.txt b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.errors.txt new file mode 100644 index 00000000000..b00cc418d9a --- /dev/null +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.errors.txt @@ -0,0 +1,100 @@ +nullIsSubtypeOfEverythingButUndefined.ts(57,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +nullIsSubtypeOfEverythingButUndefined.ts(65,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== nullIsSubtypeOfEverythingButUndefined.ts (2 errors) ==== + // null is a subtype of any other types except undefined + + var r0 = true ? null : null; + var r0 = true ? null : null; + + var u: typeof undefined; + var r0b = true ? u : null; + var r0b = true ? null : u; + + var r1 = true ? 1 : null; + var r1 = true ? null : 1; + + var r2 = true ? '' : null; + var r2 = true ? null : ''; + + var r3 = true ? true : null; + var r3 = true ? null : true; + + var r4 = true ? new Date() : null; + var r4 = true ? null : new Date(); + + var r5 = true ? /1/ : null; + var r5 = true ? null : /1/; + + var r6 = true ? { foo: 1 } : null; + var r6 = true ? null : { foo: 1 }; + + var r7 = true ? () => { } : null; + var r7 = true ? null : () => { }; + + var r8 = true ? (x: T) => { return x } : null; + var r8b = true ? null : (x: T) => { return x }; // type parameters not identical across declarations + + interface I1 { foo: number; } + var i1: I1; + var r9 = true ? i1 : null; + var r9 = true ? null : i1; + + class C1 { foo: number; } + var c1: C1; + var r10 = true ? c1 : null; + var r10 = true ? null : c1; + + class C2 { foo: T; } + var c2: C2; + var r12 = true ? c2 : null; + var r12 = true ? null : c2; + + enum E { A } + var r13 = true ? E : null; + var r13 = true ? null : E; + + var r14 = true ? E.A : null; + var r14 = true ? null : E.A; + + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + var af: typeof f; + var r15 = true ? af : null; + var r15 = true ? null : af; + + class c { baz: string } + module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + var ac: typeof c; + var r16 = true ? ac : null; + var r16 = true ? null : ac; + + function f17(x: T) { + var r17 = true ? x : null; + var r17 = true ? null : x; + } + + function f18(x: U) { + var r18 = true ? x : null; + var r18 = true ? null : x; + } + //function f18(x: U) { + // var r18 = true ? x : null; + // var r18 = true ? null : x; + //} + + var r19 = true ? new Object() : null; + var r19 = true ? null : new Object(); + + var r20 = true ? {} : null; + var r20 = true ? null : {}; + \ No newline at end of file diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types index 222e52de3e6..23c006af39f 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.types @@ -5,6 +5,7 @@ var r0 = true ? null : null; >r0 : any +> : ^^^ >true ? null : null : null > : ^^^^ >true : true @@ -12,6 +13,7 @@ var r0 = true ? null : null; var r0 = true ? null : null; >r0 : any +> : ^^^ >true ? null : null : null > : ^^^^ >true : true @@ -19,22 +21,29 @@ var r0 = true ? null : null; var u: typeof undefined; >u : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ var r0b = true ? u : null; >r0b : any +> : ^^^ >true ? u : null : any +> : ^^^ >true : true > : ^^^^ >u : any +> : ^^^ var r0b = true ? null : u; >r0b : any +> : ^^^ >true ? null : u : any +> : ^^^ >true : true > : ^^^^ >u : any +> : ^^^ var r1 = true ? 1 : null; >r1 : number diff --git a/tests/baselines/reference/parserRealSource1.errors.txt b/tests/baselines/reference/parserRealSource1.errors.txt index e7d69ba1045..48bd25d6ca5 100644 --- a/tests/baselines/reference/parserRealSource1.errors.txt +++ b/tests/baselines/reference/parserRealSource1.errors.txt @@ -1,7 +1,9 @@ parserRealSource1.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource1.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserRealSource1.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== parserRealSource1.ts (1 errors) ==== +==== parserRealSource1.ts (3 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -10,7 +12,11 @@ parserRealSource1.ts(4,21): error TS6053: File 'typescript.ts' not found. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module CompilerDiagnostics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var debug = false; export interface IDiagnosticWriter { Alert(output: string): void; diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index e0e0ea045ae..c47f479e38f 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -1,4 +1,5 @@ parserRealSource10.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource10.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource10.ts(127,33): error TS2449: Class 'TokenInfo' used before its declaration. parserRealSource10.ts(127,43): error TS1011: An element access expression should take an argument. parserRealSource10.ts(128,36): error TS2693: 'string' only refers to a type, but is being used as a value here. @@ -343,7 +344,7 @@ parserRealSource10.ts(356,53): error TS2304: Cannot find name 'NodeType'. parserRealSource10.ts(449,41): error TS1011: An element access expression should take an argument. -==== parserRealSource10.ts (343 errors) ==== +==== parserRealSource10.ts (344 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -352,6 +353,8 @@ parserRealSource10.ts(449,41): error TS1011: An element access expression should !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export enum TokenID { // Keywords Any, diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index fd0b98343ed..67f7b6ed877 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -1,4 +1,5 @@ parserRealSource11.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource11.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource11.ts(13,22): error TS2304: Cannot find name 'Type'. parserRealSource11.ts(14,24): error TS2304: Cannot find name 'ASTFlags'. parserRealSource11.ts(17,38): error TS2304: Cannot find name 'CompilerDiagnostics'. @@ -511,7 +512,7 @@ parserRealSource11.ts(2356,30): error TS2304: Cannot find name 'Emitter'. parserRealSource11.ts(2356,48): error TS2304: Cannot find name 'TokenID'. -==== parserRealSource11.ts (511 errors) ==== +==== parserRealSource11.ts (512 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -520,6 +521,8 @@ parserRealSource11.ts(2356,48): error TS2304: Cannot find name 'TokenID'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class ASTSpan { public minChar: number = -1; // -1 = "undefined" or "compiler generated" public limChar: number = -1; // -1 = "undefined" or "compiler generated" diff --git a/tests/baselines/reference/parserRealSource12.errors.txt b/tests/baselines/reference/parserRealSource12.errors.txt index 5d507e5b46a..d453b772f29 100644 --- a/tests/baselines/reference/parserRealSource12.errors.txt +++ b/tests/baselines/reference/parserRealSource12.errors.txt @@ -1,4 +1,5 @@ parserRealSource12.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource12.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource12.ts(8,19): error TS2304: Cannot find name 'AST'. parserRealSource12.ts(8,32): error TS2304: Cannot find name 'AST'. parserRealSource12.ts(8,38): error TS2304: Cannot find name 'AST'. @@ -120,6 +121,7 @@ parserRealSource12.ts(198,34): error TS2304: Cannot find name 'NodeType'. parserRealSource12.ts(199,34): error TS2304: Cannot find name 'NodeType'. parserRealSource12.ts(200,34): error TS2304: Cannot find name 'NodeType'. parserRealSource12.ts(203,33): error TS2304: Cannot find name 'NodeType'. +parserRealSource12.ts(220,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource12.ts(221,42): error TS2304: Cannot find name 'ASTList'. parserRealSource12.ts(221,59): error TS2304: Cannot find name 'AST'. parserRealSource12.ts(225,50): error TS2304: Cannot find name 'ASTList'. @@ -209,7 +211,7 @@ parserRealSource12.ts(523,88): error TS2304: Cannot find name 'AST'. parserRealSource12.ts(524,30): error TS2304: Cannot find name 'ASTList'. -==== parserRealSource12.ts (209 errors) ==== +==== parserRealSource12.ts (211 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -218,6 +220,8 @@ parserRealSource12.ts(524,30): error TS2304: Cannot find name 'ASTList'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface IAstWalker { walk(ast: AST, parent: AST): AST; ~~~ @@ -674,6 +678,8 @@ parserRealSource12.ts(524,30): error TS2304: Cannot find name 'ASTList'. } module ChildrenWalkers { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function walkNone(preAst: ASTList, parent: AST, walker: IAstWalker): void { ~~~~~~~ !!! error TS2304: Cannot find name 'ASTList'. diff --git a/tests/baselines/reference/parserRealSource13.errors.txt b/tests/baselines/reference/parserRealSource13.errors.txt index 2170deb93c1..b58b1c07f00 100644 --- a/tests/baselines/reference/parserRealSource13.errors.txt +++ b/tests/baselines/reference/parserRealSource13.errors.txt @@ -1,4 +1,6 @@ parserRealSource13.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource13.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserRealSource13.ts(6,19): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource13.ts(8,35): error TS2304: Cannot find name 'AST'. parserRealSource13.ts(9,39): error TS2304: Cannot find name 'AST'. parserRealSource13.ts(10,34): error TS2304: Cannot find name 'AST'. @@ -116,7 +118,7 @@ parserRealSource13.ts(132,51): error TS2304: Cannot find name 'AST'. parserRealSource13.ts(135,36): error TS2304: Cannot find name 'NodeType'. -==== parserRealSource13.ts (116 errors) ==== +==== parserRealSource13.ts (118 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -125,6 +127,10 @@ parserRealSource13.ts(135,36): error TS2304: Cannot find name 'NodeType'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript.AstWalkerWithDetailCallback { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface AstWalkerDetailCallback { EmptyCallback? (pre, ast: AST): boolean; ~~~ diff --git a/tests/baselines/reference/parserRealSource14.errors.txt b/tests/baselines/reference/parserRealSource14.errors.txt index 417b0c7c6bb..7af50c3845c 100644 --- a/tests/baselines/reference/parserRealSource14.errors.txt +++ b/tests/baselines/reference/parserRealSource14.errors.txt @@ -1,4 +1,5 @@ parserRealSource14.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource14.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource14.ts(24,33): error TS2694: Namespace 'TypeScript' has no exported member 'AST'. parserRealSource14.ts(38,34): error TS2694: Namespace 'TypeScript' has no exported member 'AST'. parserRealSource14.ts(48,37): error TS2694: Namespace 'TypeScript' has no exported member 'AST'. @@ -160,7 +161,7 @@ parserRealSource14.ts(565,94): error TS2694: Namespace 'TypeScript' has no expor parserRealSource14.ts(572,20): error TS2339: Property 'getAstWalkerFactory' does not exist on type 'typeof TypeScript'. -==== parserRealSource14.ts (160 errors) ==== +==== parserRealSource14.ts (161 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -169,6 +170,8 @@ parserRealSource14.ts(572,20): error TS2339: Property 'getAstWalkerFactory' does !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function lastOf(items: any[]): any { return (items === null || items.length === 0) ? null : items[items.length - 1]; } diff --git a/tests/baselines/reference/parserRealSource2.errors.txt b/tests/baselines/reference/parserRealSource2.errors.txt index fe21785dbda..528f4b03300 100644 --- a/tests/baselines/reference/parserRealSource2.errors.txt +++ b/tests/baselines/reference/parserRealSource2.errors.txt @@ -1,7 +1,8 @@ parserRealSource2.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource2.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== parserRealSource2.ts (1 errors) ==== +==== parserRealSource2.ts (2 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -10,6 +11,8 @@ parserRealSource2.ts(4,21): error TS6053: File 'typescript.ts' not found. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function hasFlag(val: number, flag: number) { return (val & flag) != 0; diff --git a/tests/baselines/reference/parserRealSource3.errors.txt b/tests/baselines/reference/parserRealSource3.errors.txt index ad9c1f9ac64..f6494c968ed 100644 --- a/tests/baselines/reference/parserRealSource3.errors.txt +++ b/tests/baselines/reference/parserRealSource3.errors.txt @@ -1,7 +1,8 @@ parserRealSource3.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource3.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== parserRealSource3.ts (1 errors) ==== +==== parserRealSource3.ts (2 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -10,6 +11,8 @@ parserRealSource3.ts(4,21): error TS6053: File 'typescript.ts' not found. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // Note: Any addition to the NodeType should also be supported with addition to AstWalkerDetailCallback export enum NodeType { None, diff --git a/tests/baselines/reference/parserRealSource4.errors.txt b/tests/baselines/reference/parserRealSource4.errors.txt index d20b2234024..ab69632121c 100644 --- a/tests/baselines/reference/parserRealSource4.errors.txt +++ b/tests/baselines/reference/parserRealSource4.errors.txt @@ -1,8 +1,9 @@ parserRealSource4.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource4.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource4.ts(195,38): error TS1011: An element access expression should take an argument. -==== parserRealSource4.ts (2 errors) ==== +==== parserRealSource4.ts (3 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -11,6 +12,8 @@ parserRealSource4.ts(195,38): error TS1011: An element access expression should !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class BlockIntrinsics { public prototype = undefined; diff --git a/tests/baselines/reference/parserRealSource5.errors.txt b/tests/baselines/reference/parserRealSource5.errors.txt index 9166edb4e68..5541311e04e 100644 --- a/tests/baselines/reference/parserRealSource5.errors.txt +++ b/tests/baselines/reference/parserRealSource5.errors.txt @@ -1,4 +1,5 @@ parserRealSource5.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource5.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource5.ts(14,66): error TS2304: Cannot find name 'Parser'. parserRealSource5.ts(27,17): error TS2304: Cannot find name 'CompilerDiagnostics'. parserRealSource5.ts(52,38): error TS2304: Cannot find name 'AST'. @@ -9,7 +10,7 @@ parserRealSource5.ts(61,52): error TS2304: Cannot find name 'AST'. parserRealSource5.ts(61,65): error TS2304: Cannot find name 'IAstWalker'. -==== parserRealSource5.ts (9 errors) ==== +==== parserRealSource5.ts (10 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -18,6 +19,8 @@ parserRealSource5.ts(61,65): error TS2304: Cannot find name 'IAstWalker'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // TODO: refactor indent logic for use in emit export class PrintContext { public builder = ""; diff --git a/tests/baselines/reference/parserRealSource6.errors.txt b/tests/baselines/reference/parserRealSource6.errors.txt index 9099081e6cd..082bc67889f 100644 --- a/tests/baselines/reference/parserRealSource6.errors.txt +++ b/tests/baselines/reference/parserRealSource6.errors.txt @@ -1,4 +1,5 @@ parserRealSource6.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource6.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource6.ts(8,24): error TS2304: Cannot find name 'Script'. parserRealSource6.ts(10,41): error TS2304: Cannot find name 'ScopeChain'. parserRealSource6.ts(10,69): error TS2304: Cannot find name 'TypeChecker'. @@ -60,7 +61,7 @@ parserRealSource6.ts(212,81): error TS2304: Cannot find name 'ISourceText'. parserRealSource6.ts(215,20): error TS2339: Property 'getAstWalkerFactory' does not exist on type 'typeof TypeScript'. -==== parserRealSource6.ts (60 errors) ==== +==== parserRealSource6.ts (61 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -69,6 +70,8 @@ parserRealSource6.ts(215,20): error TS2339: Property 'getAstWalkerFactory' does !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class TypeCollectionContext { public script: Script = null; ~~~~~~ diff --git a/tests/baselines/reference/parserRealSource7.errors.txt b/tests/baselines/reference/parserRealSource7.errors.txt index bb52a1a2e0c..5abe95064cc 100644 --- a/tests/baselines/reference/parserRealSource7.errors.txt +++ b/tests/baselines/reference/parserRealSource7.errors.txt @@ -1,4 +1,5 @@ parserRealSource7.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource7.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource7.ts(12,38): error TS2304: Cannot find name 'ASTList'. parserRealSource7.ts(12,62): error TS2304: Cannot find name 'TypeLink'. parserRealSource7.ts(16,37): error TS2552: Cannot find name 'TypeLink'. Did you mean 'typeLink'? @@ -304,7 +305,7 @@ parserRealSource7.ts(827,34): error TS2304: Cannot find name 'NodeType'. parserRealSource7.ts(828,13): error TS2304: Cannot find name 'popTypeCollectionScope'. -==== parserRealSource7.ts (304 errors) ==== +==== parserRealSource7.ts (305 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -313,6 +314,8 @@ parserRealSource7.ts(828,13): error TS2304: Cannot find name 'popTypeCollectionS !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Continuation { public exceptionBlock = -1; constructor (public normalBlock: number) { } diff --git a/tests/baselines/reference/parserRealSource8.errors.txt b/tests/baselines/reference/parserRealSource8.errors.txt index 9a767155b9e..004fbb80096 100644 --- a/tests/baselines/reference/parserRealSource8.errors.txt +++ b/tests/baselines/reference/parserRealSource8.errors.txt @@ -1,4 +1,5 @@ parserRealSource8.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource8.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource8.ts(9,41): error TS2304: Cannot find name 'ScopeChain'. parserRealSource8.ts(10,39): error TS2304: Cannot find name 'TypeFlow'. parserRealSource8.ts(11,43): error TS2304: Cannot find name 'ModuleDeclaration'. @@ -130,7 +131,7 @@ parserRealSource8.ts(453,38): error TS2304: Cannot find name 'NodeType'. parserRealSource8.ts(454,35): error TS2304: Cannot find name 'Catch'. -==== parserRealSource8.ts (130 errors) ==== +==== parserRealSource8.ts (131 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -139,6 +140,8 @@ parserRealSource8.ts(454,35): error TS2304: Cannot find name 'Catch'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class AssignScopeContext { constructor (public scopeChain: ScopeChain, diff --git a/tests/baselines/reference/parserRealSource9.errors.txt b/tests/baselines/reference/parserRealSource9.errors.txt index c8c7ac6a30c..35449fe7941 100644 --- a/tests/baselines/reference/parserRealSource9.errors.txt +++ b/tests/baselines/reference/parserRealSource9.errors.txt @@ -1,4 +1,5 @@ parserRealSource9.ts(4,21): error TS6053: File 'typescript.ts' not found. +parserRealSource9.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserRealSource9.ts(8,38): error TS2304: Cannot find name 'TypeChecker'. parserRealSource9.ts(9,48): error TS2304: Cannot find name 'TypeLink'. parserRealSource9.ts(9,67): error TS2304: Cannot find name 'SymbolScope'. @@ -39,7 +40,7 @@ parserRealSource9.ts(200,28): error TS2304: Cannot find name 'SymbolScope'. parserRealSource9.ts(200,48): error TS2304: Cannot find name 'IHashTable'. -==== parserRealSource9.ts (39 errors) ==== +==== parserRealSource9.ts (40 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -48,6 +49,8 @@ parserRealSource9.ts(200,48): error TS2304: Cannot find name 'IHashTable'. !!! error TS6053: File 'typescript.ts' not found. module TypeScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Binder { constructor (public checker: TypeChecker) { } ~~~~~~~~~~~ diff --git a/tests/baselines/reference/parserharness.errors.txt b/tests/baselines/reference/parserharness.errors.txt index 67cb9950d30..50075e56323 100644 --- a/tests/baselines/reference/parserharness.errors.txt +++ b/tests/baselines/reference/parserharness.errors.txt @@ -7,11 +7,19 @@ parserharness.ts(25,17): error TS2304: Cannot find name 'IIO'. parserharness.ts(41,12): error TS2304: Cannot find name 'ActiveXObject'. parserharness.ts(43,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. parserharness.ts(44,14): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +parserharness.ts(50,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(55,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(81,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserharness.ts(341,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? parserharness.ts(347,13): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? parserharness.ts(351,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? parserharness.ts(354,17): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? parserharness.ts(354,35): error TS2662: Cannot find name 'errorHandlerStack'. Did you mean the static member 'Runnable.errorHandlerStack'? +parserharness.ts(499,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(500,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(504,21): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(508,21): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(687,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserharness.ts(691,50): error TS2304: Cannot find name 'ITextWriter'. parserharness.ts(716,47): error TS2503: Cannot find namespace 'TypeScript'. parserharness.ts(721,62): error TS2304: Cannot find name 'ITextWriter'. @@ -77,6 +85,7 @@ parserharness.ts(1321,21): error TS2304: Cannot find name 'TypeScript'. parserharness.ts(1340,38): error TS2503: Cannot find namespace 'TypeScript'. parserharness.ts(1344,165): error TS2503: Cannot find namespace 'TypeScript'. parserharness.ts(1345,26): error TS2503: Cannot find namespace 'TypeScript'. +parserharness.ts(1414,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserharness.ts(1426,25): error TS2503: Cannot find namespace 'TypeScript'. parserharness.ts(1430,9): error TS1128: Declaration or statement expected. parserharness.ts(1430,17): error TS2304: Cannot find name 'optionRegex'. @@ -107,10 +116,12 @@ parserharness.ts(1784,61): error TS2503: Cannot find namespace 'Services'. parserharness.ts(1785,25): error TS2503: Cannot find namespace 'Services'. parserharness.ts(1787,38): error TS2503: Cannot find namespace 'Services'. parserharness.ts(1787,68): error TS2503: Cannot find namespace 'Services'. +parserharness.ts(1869,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +parserharness.ts(1910,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. -==== parserharness.ts (110 errors) ==== +==== parserharness.ts (121 errors) ==== // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -179,11 +190,15 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. } declare module process { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function nextTick(callback: () => any): void; export function on(event: string, listener: Function); } module Harness { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // Settings export var userSpecifiedroot = ""; var global = Function("return this").call(null); @@ -210,6 +225,8 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. // Assert functions export module Assert { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bugIds: string[] = []; export var throwAssertError = (error: Error) => { throw error; @@ -638,15 +655,23 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. // Performance test export module Perf { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module Clock { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var now: () => number; export var resolution: number; declare module WScript { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function InitializeProjection(); } declare module TestUtilities { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function QueryPerformanceCounter(): number; export function QueryPerformanceFrequency(): number; } @@ -826,6 +851,8 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. /** Functionality for compiling TypeScript code */ export module Compiler { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. /** Aggregate various writes into a single array of lines. Useful for passing to the * TypeScript compiler to fill with source code or errors. */ @@ -1683,6 +1710,8 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. * extracts options and individual files in a multifile test */ export module TestCaseParser { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. /** all the necesarry information to set the right compiler settings */ export interface CompilerSetting { flag: string; @@ -2198,6 +2227,8 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. /** Runs TypeScript or Javascript code. */ export module Runner { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function runCollateral(path: string, callback: (error: Error, result: any) => void ) { path = switchToForwardSlashes(path); runString(readFile(path), path.match(/[^\/]*$/)[0], callback); @@ -2239,6 +2270,8 @@ parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. /** Support class for baseline files */ export module Baseline { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var reportFilename = 'baseline-report.html'; var firstRun = true; diff --git a/tests/baselines/reference/parserindenter.errors.txt b/tests/baselines/reference/parserindenter.errors.txt index 2edf551b1e5..73610b54719 100644 --- a/tests/baselines/reference/parserindenter.errors.txt +++ b/tests/baselines/reference/parserindenter.errors.txt @@ -1,4 +1,5 @@ parserindenter.ts(16,21): error TS6053: File 'formatting.ts' not found. +parserindenter.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. parserindenter.ts(20,38): error TS2304: Cannot find name 'ILineIndenationResolver'. parserindenter.ts(22,33): error TS2304: Cannot find name 'IndentationBag'. parserindenter.ts(24,42): error TS2304: Cannot find name 'Dictionary_int_int'. @@ -128,7 +129,7 @@ parserindenter.ts(735,42): error TS2304: Cannot find name 'TokenSpan'. parserindenter.ts(736,38): error TS2304: Cannot find name 'TypeScript'. -==== parserindenter.ts (128 errors) ==== +==== parserindenter.ts (129 errors) ==== // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -150,6 +151,8 @@ parserindenter.ts(736,38): error TS2304: Cannot find name 'TypeScript'. module Formatting { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Indenter implements ILineIndenationResolver { ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'ILineIndenationResolver'. diff --git a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt index 1f09f5ef999..c4e808d8721 100644 --- a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,4 @@ +plusOperatorWithAnyOtherType.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. plusOperatorWithAnyOtherType.ts(34,24): error TS18050: The value 'undefined' cannot be used here. plusOperatorWithAnyOtherType.ts(35,24): error TS18050: The value 'null' cannot be used here. plusOperatorWithAnyOtherType.ts(46,26): error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'. @@ -6,7 +7,7 @@ plusOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot be app plusOperatorWithAnyOtherType.ts(54,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== plusOperatorWithAnyOtherType.ts (6 errors) ==== +==== plusOperatorWithAnyOtherType.ts (7 errors) ==== // + operator on any type var ANY: any; @@ -27,6 +28,8 @@ plusOperatorWithAnyOtherType.ts(54,1): error TS2695: Left side of comma operator } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/privacyAccessorDeclFile.errors.txt b/tests/baselines/reference/privacyAccessorDeclFile.errors.txt new file mode 100644 index 00000000000..424d78ff83e --- /dev/null +++ b/tests/baselines/reference/privacyAccessorDeclFile.errors.txt @@ -0,0 +1,1071 @@ +privacyAccessorDeclFile_GlobalFile.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyAccessorDeclFile_GlobalFile.ts(49,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyAccessorDeclFile_externalModule.ts(203,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyAccessorDeclFile_externalModule.ts(406,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyAccessorDeclFile_externalModule.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { // Error + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { // Error + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { // Error + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + export class publicClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { // Error + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { // Error + } + private set myPrivateMethod(param: privateClass) { + } + } + + export class publicClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + class privateClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + class privateClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + get myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + get myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + + export class publicClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + set myPublicMethod(param: privateModule.publicClass) { // Error + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + class privateClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { // Error + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { // Error + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { // Error + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + export class publicClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { // Error + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { // Error + } + private set myPrivateMethod(param: privateClass) { + } + } + + export class publicClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + class privateClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + class privateClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + get myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + get myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + + export class publicClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + set myPublicMethod(param: privateModule.publicClass) { // Error + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + class privateClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + export class publicClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + export class publicClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + class privateClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + class privateClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + export class publicClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + class privateClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + } + +==== privacyAccessorDeclFile_GlobalFile.ts (2 errors) ==== + class publicClassInGlobal { + } + + class publicClassInGlobalWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClassInGlobal { + return null; + } + private static get myPrivateStaticMethod(): publicClassInGlobal { + return null; + } + get myPublicMethod(): publicClassInGlobal { + return null; + } + private get myPrivateMethod(): publicClassInGlobal { + return null; + } + static get myPublicStaticMethod1() { + return new publicClassInGlobal(); + } + private static get myPrivateStaticMethod1() { + return new publicClassInGlobal(); + } + get myPublicMethod1() { + return new publicClassInGlobal(); + } + private get myPrivateMethod1() { + return new publicClassInGlobal(); + } + } + + class publicClassInGlobalWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClassInGlobal) { + } + private static set myPrivateStaticMethod(param: publicClassInGlobal) { + } + set myPublicMethod(param: publicClassInGlobal) { + } + private set myPrivateMethod(param: publicClassInGlobal) { + } + } + + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + export class publicClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + export class publicClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + class privateClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + class privateClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + export class publicClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + class privateClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + } + + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { // Error + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { // Error + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { // Error + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod(): privateClass { + return null; + } + private static get myPrivateStaticMethod(): privateClass { + return null; + } + get myPublicMethod(): privateClass { + return null; + } + private get myPrivateMethod(): privateClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateClass(); + } + private static get myPrivateStaticMethod1() { + return new privateClass(); + } + get myPublicMethod1() { + return new privateClass(); + } + private get myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicGetAccessorTypes { + static get myPublicStaticMethod(): publicClass { + return null; + } + private static get myPrivateStaticMethod(): publicClass { + return null; + } + get myPublicMethod(): publicClass { + return null; + } + private get myPrivateMethod(): publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new publicClass(); + } + private static get myPrivateStaticMethod1() { + return new publicClass(); + } + get myPublicMethod1() { + return new publicClass(); + } + private get myPrivateMethod1() { + return new publicClass(); + } + } + + export class publicClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { // Error + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { // Error + } + private set myPrivateMethod(param: privateClass) { + } + } + + export class publicClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + class privateClassWithWithPrivateSetAccessorTypes { + static set myPublicStaticMethod(param: privateClass) { + } + private static set myPrivateStaticMethod(param: privateClass) { + } + set myPublicMethod(param: privateClass) { + } + private set myPrivateMethod(param: privateClass) { + } + } + + class privateClassWithWithPublicSetAccessorTypes { + static set myPublicStaticMethod(param: publicClass) { + } + private static set myPrivateStaticMethod(param: publicClass) { + } + set myPublicMethod(param: publicClass) { + } + private set myPrivateMethod(param: publicClass) { + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + get myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static get myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + get myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + + export class publicClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + set myPublicMethod(param: privateModule.publicClass) { // Error + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod(): privateModule.publicClass { + return null; + } + get myPublicMethod(): privateModule.publicClass { + return null; + } + static get myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + get myPublicMethod1() { + return new privateModule.publicClass(); + } + } + + class privateClassWithPrivateModuleSetAccessorTypes { + static set myPublicStaticMethod(param: privateModule.publicClass) { + } + set myPublicMethod(param: privateModule.publicClass) { + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt new file mode 100644 index 00000000000..7864643900f --- /dev/null +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt @@ -0,0 +1,142 @@ +privacyCannotNameAccessorDeclFile_GlobalWidgets.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyCannotNameAccessorDeclFile_Widgets.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyCannotNameAccessorDeclFile_consumer.ts (0 errors) ==== + import exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); + export class publicClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod() { // Error + return exporter.createExportedWidget1(); + } + private static get myPrivateStaticMethod() { + return exporter.createExportedWidget1(); + } + get myPublicMethod() { // Error + return exporter.createExportedWidget1(); + } + private get myPrivateMethod() { + return exporter.createExportedWidget1(); + } + static get myPublicStaticMethod1() { // Error + return exporter.createExportedWidget3(); + } + private static get myPrivateStaticMethod1() { + return exporter.createExportedWidget3(); + } + get myPublicMethod1() { // Error + return exporter.createExportedWidget3(); + } + private get myPrivateMethod1() { + return exporter.createExportedWidget3(); + } + } + + class privateClassWithWithPrivateGetAccessorTypes { + static get myPublicStaticMethod() { + return exporter.createExportedWidget1(); + } + private static get myPrivateStaticMethod() { + return exporter.createExportedWidget1(); + } + get myPublicMethod() { + return exporter.createExportedWidget1(); + } + private get myPrivateMethod() { + return exporter.createExportedWidget1(); + } + static get myPublicStaticMethod1() { + return exporter.createExportedWidget3(); + } + private static get myPrivateStaticMethod1() { + return exporter.createExportedWidget3(); + } + get myPublicMethod1() { + return exporter.createExportedWidget3(); + } + private get myPrivateMethod1() { + return exporter.createExportedWidget3(); + } + } + + export class publicClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod() { // Error + return exporter.createExportedWidget2(); + } + get myPublicMethod() { // Error + return exporter.createExportedWidget2(); + } + static get myPublicStaticMethod1() { // Error + return exporter.createExportedWidget4(); + } + get myPublicMethod1() { // Error + return exporter.createExportedWidget4(); + } + } + + class privateClassWithPrivateModuleGetAccessorTypes { + static get myPublicStaticMethod() { + return exporter.createExportedWidget2(); + } + get myPublicMethod() { + return exporter.createExportedWidget2(); + } + static get myPublicStaticMethod1() { + return exporter.createExportedWidget4(); + } + get myPublicMethod1() { + return exporter.createExportedWidget4(); + } + } +==== privacyCannotNameAccessorDeclFile_GlobalWidgets.ts (1 errors) ==== + declare module "GlobalWidgets" { + export class Widget3 { + name: string; + } + export function createWidget3(): Widget3; + + export module SpecializedGlobalWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget4 { + name: string; + } + function createWidget4(): Widget4; + } + } + +==== privacyCannotNameAccessorDeclFile_Widgets.ts (1 errors) ==== + export class Widget1 { + name = 'one'; + } + export function createWidget1() { + return new Widget1(); + } + + export module SpecializedWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget2 { + name = 'one'; + } + export function createWidget2() { + return new Widget2(); + } + } + +==== privacyCannotNameAccessorDeclFile_exporter.ts (0 errors) ==== + /// + import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); + import Widgets1 = require("GlobalWidgets"); + export function createExportedWidget1() { + return Widgets.createWidget1(); + } + export function createExportedWidget2() { + return Widgets.SpecializedWidget.createWidget2(); + } + export function createExportedWidget3() { + return Widgets1.createWidget3(); + } + export function createExportedWidget4() { + return Widgets1.SpecializedGlobalWidget.createWidget4(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js index afacb295915..e6a1005044d 100644 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js @@ -432,74 +432,3 @@ export declare class publicClassWithPrivateModuleGetAccessorTypes { static get myPublicStaticMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; get myPublicMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; } - - -//// [DtsFileErrors] - - -privacyCannotNameAccessorDeclFile_consumer.d.ts(6,48): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameAccessorDeclFile_consumer.d.ts(8,35): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameAccessorDeclFile_consumer.d.ts(14,48): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameAccessorDeclFile_consumer.d.ts(15,35): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - - -==== privacyCannotNameAccessorDeclFile_consumer.d.ts (4 errors) ==== - export declare class publicClassWithWithPrivateGetAccessorTypes { - static get myPublicStaticMethod(): import("./privacyCannotNameAccessorDeclFile_Widgets").Widget1; - private static get myPrivateStaticMethod(); - get myPublicMethod(): import("./privacyCannotNameAccessorDeclFile_Widgets").Widget1; - private get myPrivateMethod(); - static get myPublicStaticMethod1(): import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private static get myPrivateStaticMethod1(); - get myPublicMethod1(): import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private get myPrivateMethod1(); - } - export declare class publicClassWithPrivateModuleGetAccessorTypes { - static get myPublicStaticMethod(): import("./privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2; - get myPublicMethod(): import("./privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2; - static get myPublicStaticMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - get myPublicMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - } - -==== privacyCannotNameAccessorDeclFile_GlobalWidgets.d.ts (0 errors) ==== - declare module "GlobalWidgets" { - class Widget3 { - name: string; - } - function createWidget3(): Widget3; - namespace SpecializedGlobalWidget { - class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== privacyCannotNameAccessorDeclFile_Widgets.d.ts (0 errors) ==== - export declare class Widget1 { - name: string; - } - export declare function createWidget1(): Widget1; - export declare namespace SpecializedWidget { - class Widget2 { - name: string; - } - function createWidget2(): Widget2; - } - -==== privacyCannotNameAccessorDeclFile_exporter.d.ts (0 errors) ==== - import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export declare function createExportedWidget1(): Widgets.Widget1; - export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; - export declare function createExportedWidget3(): Widgets1.Widget3; - export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; - \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt new file mode 100644 index 00000000000..2f515f6224c --- /dev/null +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt @@ -0,0 +1,105 @@ +privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyCannotNameVarTypeDeclFile_Widgets.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyCannotNameVarTypeDeclFile_consumer.ts (0 errors) ==== + import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty = exporter.createExportedWidget1(); // Error + private static myPrivateStaticProperty = exporter.createExportedWidget1(); + myPublicProperty = exporter.createExportedWidget1(); // Error + private myPrivateProperty = exporter.createExportedWidget1(); + + static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error + private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); + myPublicProperty1 = exporter.createExportedWidget3(); // Error + private myPrivateProperty1 = exporter.createExportedWidget3(); + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty = exporter.createExportedWidget1(); + private static myPrivateStaticProperty = exporter.createExportedWidget1(); + myPublicProperty = exporter.createExportedWidget1(); + private myPrivateProperty = exporter.createExportedWidget1(); + + static myPublicStaticProperty1 = exporter.createExportedWidget3(); + private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); + myPublicProperty1 = exporter.createExportedWidget3(); + private myPrivateProperty1 = exporter.createExportedWidget3(); + } + + export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error + var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); + export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error + var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); + + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty= exporter.createExportedWidget2(); // Error + myPublicProperty = exporter.createExportedWidget2(); // Error + static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error + myPublicProperty1 = exporter.createExportedWidget4(); // Error + } + export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error + export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error + + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty= exporter.createExportedWidget2(); + myPublicProperty= exporter.createExportedWidget2(); + static myPublicStaticProperty1 = exporter.createExportedWidget4(); + myPublicProperty1 = exporter.createExportedWidget4(); + } + var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); + var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); +==== privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts (1 errors) ==== + declare module "GlobalWidgets" { + export class Widget3 { + name: string; + } + export function createWidget3(): Widget3; + + export module SpecializedGlobalWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget4 { + name: string; + } + function createWidget4(): Widget4; + } + } + +==== privacyCannotNameVarTypeDeclFile_Widgets.ts (1 errors) ==== + export class Widget1 { + name = 'one'; + } + export function createWidget1() { + return new Widget1(); + } + + export module SpecializedWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget2 { + name = 'one'; + } + export function createWidget2() { + return new Widget2(); + } + } + +==== privacyCannotNameVarTypeDeclFile_exporter.ts (0 errors) ==== + /// + import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); + import Widgets1 = require("GlobalWidgets"); + export function createExportedWidget1() { + return Widgets.createWidget1(); + } + export function createExportedWidget2() { + return Widgets.SpecializedWidget.createWidget2(); + } + export function createExportedWidget3() { + return Widgets1.createWidget3(); + } + export function createExportedWidget4() { + return Widgets1.SpecializedGlobalWidget.createWidget4(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index 20183ab0cb7..cbc244a0a17 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -263,84 +263,3 @@ export declare class publicClassWithPrivateModulePropertyTypes { } export declare var publicVarWithPrivateModulePropertyTypes: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; export declare var publicVarWithPrivateModulePropertyTypes1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - - -//// [DtsFileErrors] - - -privacyCannotNameVarTypeDeclFile_consumer.d.ts(6,44): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameVarTypeDeclFile_consumer.d.ts(8,31): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameVarTypeDeclFile_consumer.d.ts(12,63): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameVarTypeDeclFile_consumer.d.ts(16,44): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameVarTypeDeclFile_consumer.d.ts(17,31): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyCannotNameVarTypeDeclFile_consumer.d.ts(20,69): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - - -==== privacyCannotNameVarTypeDeclFile_consumer.d.ts (6 errors) ==== - export declare class publicClassWithWithPrivatePropertyTypes { - static myPublicStaticProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; - private static myPrivateStaticProperty; - myPublicProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; - private myPrivateProperty; - static myPublicStaticProperty1: import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private static myPrivateStaticProperty1; - myPublicProperty1: import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private myPrivateProperty1; - } - export declare var publicVarWithPrivatePropertyTypes: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; - export declare var publicVarWithPrivatePropertyTypes1: import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - export declare class publicClassWithPrivateModulePropertyTypes { - static myPublicStaticProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; - myPublicProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; - static myPublicStaticProperty1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - myPublicProperty1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - } - export declare var publicVarWithPrivateModulePropertyTypes: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; - export declare var publicVarWithPrivateModulePropertyTypes1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - -==== privacyCannotNameVarTypeDeclFile_GlobalWidgets.d.ts (0 errors) ==== - declare module "GlobalWidgets" { - class Widget3 { - name: string; - } - function createWidget3(): Widget3; - namespace SpecializedGlobalWidget { - class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== privacyCannotNameVarTypeDeclFile_Widgets.d.ts (0 errors) ==== - export declare class Widget1 { - name: string; - } - export declare function createWidget1(): Widget1; - export declare namespace SpecializedWidget { - class Widget2 { - name: string; - } - function createWidget2(): Widget2; - } - -==== privacyCannotNameVarTypeDeclFile_exporter.d.ts (0 errors) ==== - import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export declare function createExportedWidget1(): Widgets.Widget1; - export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; - export declare function createExportedWidget3(): Widgets1.Widget3; - export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; - \ No newline at end of file diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.errors.txt b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.errors.txt new file mode 100644 index 00000000000..2c872751cde --- /dev/null +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.errors.txt @@ -0,0 +1,22 @@ +privacyCheckAnonymousFunctionParameter.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyCheckAnonymousFunctionParameter.ts (1 errors) ==== + export var x = 1; // Makes this an external module + interface Iterator { + } + + module Query { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function fromDoWhile(doWhile: (test: Iterator) => boolean): Iterator { + return null; + } + + function fromOrderBy() { + return fromDoWhile(test => { + return true; + }); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.errors.txt b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.errors.txt new file mode 100644 index 00000000000..d4b93c7bb80 --- /dev/null +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.errors.txt @@ -0,0 +1,23 @@ +privacyCheckAnonymousFunctionParameter2.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyCheckAnonymousFunctionParameter2.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyCheckAnonymousFunctionParameter2.ts (2 errors) ==== + export var x = 1; // Makes this an external module + interface Iterator { x: T } + + module Q { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo(x: (a: Iterator) => number) { + return x; + } + } + + module Q { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + function bar() { + foo(null); + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyClass.errors.txt b/tests/baselines/reference/privacyClass.errors.txt new file mode 100644 index 00000000000..da31804edb3 --- /dev/null +++ b/tests/baselines/reference/privacyClass.errors.txt @@ -0,0 +1,136 @@ +privacyClass.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyClass.ts(45,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyClass.ts (2 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m1_i_public { + } + + interface m1_i_private { + } + + export class m1_c_public { + private f1() { + } + } + + class m1_c_private { + } + + class m1_C1_private extends m1_c_public { + } + class m1_C2_private extends m1_c_private { + } + export class m1_C3_public extends m1_c_public { + } + export class m1_C4_public extends m1_c_private { + } + + class m1_C5_private implements m1_i_public { + } + class m1_C6_private implements m1_i_private { + } + export class m1_C7_public implements m1_i_public { + } + export class m1_C8_public implements m1_i_private { + } + + class m1_C9_private extends m1_c_public implements m1_i_private, m1_i_public { + } + class m1_C10_private extends m1_c_private implements m1_i_private, m1_i_public { + } + export class m1_C11_public extends m1_c_public implements m1_i_private, m1_i_public { + } + export class m1_C12_public extends m1_c_private implements m1_i_private, m1_i_public { + } + } + + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m2_i_public { + } + + interface m2_i_private { + } + + export class m2_c_public { + private f1() { + } + } + + class m2_c_private { + } + + class m2_C1_private extends m2_c_public { + } + class m2_C2_private extends m2_c_private { + } + export class m2_C3_public extends m2_c_public { + } + export class m2_C4_public extends m2_c_private { + } + + class m2_C5_private implements m2_i_public { + } + class m2_C6_private implements m2_i_private { + } + export class m2_C7_public implements m2_i_public { + } + export class m2_C8_public implements m2_i_private { + } + + class m2_C9_private extends m2_c_public implements m2_i_private, m2_i_public { + } + class m2_C10_private extends m2_c_private implements m2_i_private, m2_i_public { + } + export class m2_C11_public extends m2_c_public implements m2_i_private, m2_i_public { + } + export class m2_C12_public extends m2_c_private implements m2_i_private, m2_i_public { + } + } + + export interface glo_i_public { + } + + interface glo_i_private { + } + + export class glo_c_public { + private f1() { + } + } + + class glo_c_private { + } + + class glo_C1_private extends glo_c_public { + } + class glo_C2_private extends glo_c_private { + } + export class glo_C3_public extends glo_c_public { + } + export class glo_C4_public extends glo_c_private { + } + + class glo_C5_private implements glo_i_public { + } + class glo_C6_private implements glo_i_private { + } + export class glo_C7_public implements glo_i_public { + } + export class glo_C8_public implements glo_i_private { + } + + class glo_C9_private extends glo_c_public implements glo_i_private, glo_i_public { + } + class glo_C10_private extends glo_c_private implements glo_i_private, glo_i_public { + } + export class glo_C11_public extends glo_c_public implements glo_i_private, glo_i_public { + } + export class glo_C12_public extends glo_c_private implements glo_i_private, glo_i_public { + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt index 045bd348386..06831ca87fe 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt @@ -1,9 +1,14 @@ +privacyClassExtendsClauseDeclFile_GlobalFile.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyClassExtendsClauseDeclFile_externalModule.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyClassExtendsClauseDeclFile_externalModule.ts(19,77): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. privacyClassExtendsClauseDeclFile_externalModule.ts(21,83): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. +privacyClassExtendsClauseDeclFile_externalModule.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== privacyClassExtendsClauseDeclFile_externalModule.ts (2 errors) ==== +==== privacyClassExtendsClauseDeclFile_externalModule.ts (4 errors) ==== export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class publicClassInPublicModule { private f1() { } @@ -34,6 +39,8 @@ privacyClassExtendsClauseDeclFile_externalModule.ts(21,83): error TS2449: Class } module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class publicClassInPrivateModule { private f1() { } @@ -79,8 +86,10 @@ privacyClassExtendsClauseDeclFile_externalModule.ts(21,83): error TS2449: Class export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error } -==== privacyClassExtendsClauseDeclFile_GlobalFile.ts (0 errors) ==== +==== privacyClassExtendsClauseDeclFile_GlobalFile.ts (1 errors) ==== module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class publicClassInPublicModule { private f1() { } diff --git a/tests/baselines/reference/privacyClassImplementsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassImplementsClauseDeclFile.errors.txt new file mode 100644 index 00000000000..3077e9027a5 --- /dev/null +++ b/tests/baselines/reference/privacyClassImplementsClauseDeclFile.errors.txt @@ -0,0 +1,103 @@ +privacyClassImplementsClauseDeclFile_GlobalFile.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyClassImplementsClauseDeclFile_externalModule.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyClassImplementsClauseDeclFile_externalModule.ts(26,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyClassImplementsClauseDeclFile_externalModule.ts (2 errors) ==== + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPublicModule { + } + + interface privateInterfaceInPublicModule { + } + + class privateClassImplementingPublicInterfaceInModule implements publicInterfaceInPublicModule { + } + class privateClassImplementingPrivateInterfaceInModule implements privateInterfaceInPublicModule { + } + export class publicClassImplementingPublicInterfaceInModule implements publicInterfaceInPublicModule { + } + export class publicClassImplementingPrivateInterfaceInModule implements privateInterfaceInPublicModule { // Should error + } + + class privateClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { + } + export class publicClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { // Should error + } + + export class publicClassImplementingPrivateAndPublicInterface implements privateInterfaceInPublicModule, publicInterfaceInPublicModule { // Should error + } + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPrivateModule { + + } + + interface privateInterfaceInPrivateModule { + } + + class privateClassImplementingPublicInterfaceInModule implements publicInterfaceInPrivateModule { + } + class privateClassImplementingPrivateInterfaceInModule implements privateInterfaceInPrivateModule { + } + export class publicClassImplementingPublicInterfaceInModule implements publicInterfaceInPrivateModule { + } + export class publicClassImplementingPrivateInterfaceInModule implements privateInterfaceInPrivateModule { + } + + class privateClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { + } + export class publicClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { + } + } + + export interface publicInterface { + + } + + interface privateInterface { + } + + class privateClassImplementingPublicInterface implements publicInterface { + } + class privateClassImplementingPrivateInterfaceInModule implements privateInterface { + } + export class publicClassImplementingPublicInterface implements publicInterface { + } + export class publicClassImplementingPrivateInterface implements privateInterface { // Should error + } + + class privateClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { + } + export class publicClassImplementingFromPrivateModuleInterface implements privateModule.publicInterfaceInPrivateModule { // Should error + } + +==== privacyClassImplementsClauseDeclFile_GlobalFile.ts (1 errors) ==== + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPublicModule { + } + + interface privateInterfaceInPublicModule { + } + + class privateClassImplementingPublicInterfaceInModule implements publicInterfaceInPublicModule { + } + class privateClassImplementingPrivateInterfaceInModule implements privateInterfaceInPublicModule { + } + export class publicClassImplementingPublicInterfaceInModule implements publicInterfaceInPublicModule { + } + export class publicClassImplementingPrivateInterfaceInModule implements privateInterfaceInPublicModule { // Should error + } + } + interface publicInterfaceInGlobal { + } + class publicClassImplementingPublicInterfaceInGlobal implements publicInterfaceInGlobal { + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunc.errors.txt b/tests/baselines/reference/privacyFunc.errors.txt new file mode 100644 index 00000000000..6e9029d6a66 --- /dev/null +++ b/tests/baselines/reference/privacyFunc.errors.txt @@ -0,0 +1,234 @@ +privacyFunc.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyFunc.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + constructor (m1_c3_c1: C1_public); + constructor (m1_c3_c2: C2_private); //error + constructor (m1_c3_c1_2: any) { + } + + private f1_private(m1_c3_f1_arg: C1_public) { + } + + public f2_public(m1_c3_f2_arg: C1_public) { + } + + private f3_private(m1_c3_f3_arg: C2_private) { + } + + public f4_public(m1_c3_f4_arg: C2_private) { // error + } + + private f5_private() { + return new C1_public(); + } + + public f6_public() { + return new C1_public(); + } + + private f7_private() { + return new C2_private(); + } + + public f8_public() { + return new C2_private(); // error + } + + private f9_private(): C1_public { + return new C1_public(); + } + + public f10_public(): C1_public { + return new C1_public(); + } + + private f11_private(): C2_private { + return new C2_private(); + } + + public f12_public(): C2_private { // error + return new C2_private(); //error + } + } + + class C4_private { + constructor (m1_c4_c1: C1_public); + constructor (m1_c4_c2: C2_private); + constructor (m1_c4_c1_2: any) { + } + private f1_private(m1_c4_f1_arg: C1_public) { + } + + public f2_public(m1_c4_f2_arg: C1_public) { + } + + private f3_private(m1_c4_f3_arg: C2_private) { + } + + public f4_public(m1_c4_f4_arg: C2_private) { + } + + + private f5_private() { + return new C1_public(); + } + + public f6_public() { + return new C1_public(); + } + + private f7_private() { + return new C2_private(); + } + + public f8_public() { + return new C2_private(); + } + + + private f9_private(): C1_public { + return new C1_public(); + } + + public f10_public(): C1_public { + return new C1_public(); + } + + private f11_private(): C2_private { + return new C2_private(); + } + + public f12_public(): C2_private { + return new C2_private(); + } + } + + export class C5_public { + constructor (m1_c5_c: C1_public) { + } + } + + class C6_private { + constructor (m1_c6_c: C1_public) { + } + } + export class C7_public { + constructor (m1_c7_c: C2_private) { // error + } + } + + class C8_private { + constructor (m1_c8_c: C2_private) { + } + } + + function f1_public(m1_f1_arg: C1_public) { + } + + export function f2_public(m1_f2_arg: C1_public) { + } + + function f3_public(m1_f3_arg: C2_private) { + } + + export function f4_public(m1_f4_arg: C2_private) { // error + } + + + function f5_public() { + return new C1_public(); + } + + export function f6_public() { + return new C1_public(); + } + + function f7_public() { + return new C2_private(); + } + + export function f8_public() { + return new C2_private(); // error + } + + + function f9_private(): C1_public { + return new C1_public(); + } + + export function f10_public(): C1_public { + return new C1_public(); + } + + function f11_private(): C2_private { + return new C2_private(); + } + + export function f12_public(): C2_private { // error + return new C2_private(); //error + } + } + + class C6_public { + } + + class C7_public { + constructor (c7_c2: C6_public); + constructor (c7_c1_2: any) { + } + private f1_private(c7_f1_arg: C6_public) { + } + + public f2_public(c7_f2_arg: C6_public) { + } + + private f5_private() { + return new C6_public(); + } + + public f6_public() { + return new C6_public(); + } + + private f9_private(): C6_public { + return new C6_public(); + } + + public f10_public(): C6_public { + return new C6_public(); + } + } + + class C9_public { + constructor (c9_c: C6_public) { + } + } + + + function f4_public(f4_arg: C6_public) { + } + + + + function f6_public() { + return new C6_public(); + } + + + function f10_public(): C6_public { + return new C6_public(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunc.types b/tests/baselines/reference/privacyFunc.types index 1ca0f4c140a..f72ae00489b 100644 --- a/tests/baselines/reference/privacyFunc.types +++ b/tests/baselines/reference/privacyFunc.types @@ -34,6 +34,7 @@ module m1 { constructor (m1_c3_c1_2: any) { >m1_c3_c1_2 : any +> : ^^^ } private f1_private(m1_c3_f1_arg: C1_public) { @@ -167,6 +168,7 @@ module m1 { constructor (m1_c4_c1_2: any) { >m1_c4_c1_2 : any +> : ^^^ } private f1_private(m1_c4_f1_arg: C1_public) { >f1_private : (m1_c4_f1_arg: C1_public) => void @@ -460,6 +462,7 @@ class C7_public { constructor (c7_c1_2: any) { >c7_c1_2 : any +> : ^^^ } private f1_private(c7_f1_arg: C6_public) { >f1_private : (c7_f1_arg: C6_public) => void diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt new file mode 100644 index 00000000000..17c78f29c72 --- /dev/null +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt @@ -0,0 +1,161 @@ +privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts (0 errors) ==== + import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error + } + private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { + } + myPublicMethod(param = exporter.createExportedWidget1()) { // Error + } + private myPrivateMethod(param = exporter.createExportedWidget1()) { + } + constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error + } + } + export class publicClassWithWithPrivateParmeterTypes1 { + static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error + } + private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { + } + myPublicMethod(param = exporter.createExportedWidget3()) { // Error + } + private myPrivateMethod(param = exporter.createExportedWidget3()) { + } + constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param = exporter.createExportedWidget1()) { + } + private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { + } + myPublicMethod(param = exporter.createExportedWidget1()) { + } + private myPrivateMethod(param = exporter.createExportedWidget1()) { + } + constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { + } + } + class privateClassWithWithPrivateParmeterTypes2 { + static myPublicStaticMethod(param = exporter.createExportedWidget3()) { + } + private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { + } + myPublicMethod(param = exporter.createExportedWidget3()) { + } + private myPrivateMethod(param = exporter.createExportedWidget3()) { + } + constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error + } + function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { + } + export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error + } + function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { + } + + + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error + } + myPublicMethod(param= exporter.createExportedWidget2()) { // Error + } + constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error + } + } + export class publicClassWithPrivateModuleParameterTypes2 { + static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error + } + myPublicMethod(param= exporter.createExportedWidget4()) { // Error + } + constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error + } + export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error + } + + + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param= exporter.createExportedWidget2()) { + } + myPublicMethod(param= exporter.createExportedWidget2()) { + } + constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { + } + } + class privateClassWithPrivateModuleParameterTypes1 { + static myPublicStaticMethod(param= exporter.createExportedWidget4()) { + } + myPublicMethod(param= exporter.createExportedWidget4()) { + } + constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { + } + function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { + } +==== privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts (1 errors) ==== + declare module "GlobalWidgets" { + export class Widget3 { + name: string; + } + export function createWidget3(): Widget3; + + export module SpecializedGlobalWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget4 { + name: string; + } + function createWidget4(): Widget4; + } + } + +==== privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts (1 errors) ==== + export class Widget1 { + name = 'one'; + } + export function createWidget1() { + return new Widget1(); + } + + export module SpecializedWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget2 { + name = 'one'; + } + export function createWidget2() { + return new Widget2(); + } + } + +==== privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts (0 errors) ==== + /// + import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); + import Widgets1 = require("GlobalWidgets"); + export function createExportedWidget1() { + return Widgets.createWidget1(); + } + export function createExportedWidget2() { + return Widgets.SpecializedWidget.createWidget2(); + } + export function createExportedWidget3() { + return Widgets1.createWidget3(); + } + export function createExportedWidget4() { + return Widgets1.SpecializedGlobalWidget.createWidget4(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js index 78b540204a9..a6eb83c8cb7 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js @@ -465,124 +465,3 @@ export declare class publicClassWithPrivateModuleParameterTypes2 { } export declare function publicFunctionWithPrivateModuleParameterTypes(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; export declare function publicFunctionWithPrivateModuleParameterTypes1(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; - - -//// [DtsFileErrors] - - -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(12,20): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(13,48): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(15,35): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(17,32): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(17,74): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(17,116): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(20,80): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(30,20): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(31,48): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(32,35): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(33,32): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(33,98): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(33,164): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts(36,87): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - - -==== privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts (14 errors) ==== - export declare class publicClassWithWithPrivateParmeterTypes { - private param1; - param2: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1; - static myPublicStaticMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; - private static myPrivateStaticMethod; - myPublicMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; - private myPrivateMethod; - constructor(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1, param1?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1, param2?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1); - } - export declare class publicClassWithWithPrivateParmeterTypes1 { - private param1; - param2: import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - static myPublicStaticMethod(param?: import("GlobalWidgets").Widget3): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private static myPrivateStaticMethod; - myPublicMethod(param?: import("GlobalWidgets").Widget3): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private myPrivateMethod; - constructor(param?: import("GlobalWidgets").Widget3, param1?: import("GlobalWidgets").Widget3, param2?: import("GlobalWidgets").Widget3); - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - } - export declare function publicFunctionWithPrivateParmeterTypes(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; - export declare function publicFunctionWithPrivateParmeterTypes1(param?: import("GlobalWidgets").Widget3): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - export declare class publicClassWithPrivateModuleParameterTypes { - private param1; - param2: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2; - static myPublicStaticMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; - myPublicMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; - constructor(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2, param1?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2, param2?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2); - } - export declare class publicClassWithPrivateModuleParameterTypes2 { - private param1; - param2: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - static myPublicStaticMethod(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - myPublicMethod(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - constructor(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4, param1?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4, param2?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4); - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - } - export declare function publicFunctionWithPrivateModuleParameterTypes(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; - export declare function publicFunctionWithPrivateModuleParameterTypes1(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - -==== privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.d.ts (0 errors) ==== - declare module "GlobalWidgets" { - class Widget3 { - name: string; - } - function createWidget3(): Widget3; - namespace SpecializedGlobalWidget { - class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== privacyFunctionCannotNameParameterTypeDeclFile_Widgets.d.ts (0 errors) ==== - export declare class Widget1 { - name: string; - } - export declare function createWidget1(): Widget1; - export declare namespace SpecializedWidget { - class Widget2 { - name: string; - } - function createWidget2(): Widget2; - } - -==== privacyFunctionCannotNameParameterTypeDeclFile_exporter.d.ts (0 errors) ==== - import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export declare function createExportedWidget1(): Widgets.Widget1; - export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; - export declare function createExportedWidget3(): Widgets1.Widget3; - export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; - \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt new file mode 100644 index 00000000000..32b4be3ba86 --- /dev/null +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt @@ -0,0 +1,168 @@ +privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts(7,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionReturnTypeDeclFile_Widgets.ts(8,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyFunctionReturnTypeDeclFile_consumer.ts (0 errors) ==== + import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod() { // Error + return exporter.createExportedWidget1(); + } + private static myPrivateStaticMethod() { + return exporter.createExportedWidget1();; + } + myPublicMethod() { // Error + return exporter.createExportedWidget1();; + } + private myPrivateMethod() { + return exporter.createExportedWidget1();; + } + static myPublicStaticMethod1() { // Error + return exporter.createExportedWidget3(); + } + private static myPrivateStaticMethod1() { + return exporter.createExportedWidget3();; + } + myPublicMethod1() { // Error + return exporter.createExportedWidget3();; + } + private myPrivateMethod1() { + return exporter.createExportedWidget3();; + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod() { + return exporter.createExportedWidget1(); + } + private static myPrivateStaticMethod() { + return exporter.createExportedWidget1();; + } + myPublicMethod() { + return exporter.createExportedWidget1();; + } + private myPrivateMethod() { + return exporter.createExportedWidget1();; + } + static myPublicStaticMethod1() { + return exporter.createExportedWidget3(); + } + private static myPrivateStaticMethod1() { + return exporter.createExportedWidget3();; + } + myPublicMethod1() { + return exporter.createExportedWidget3();; + } + private myPrivateMethod1() { + return exporter.createExportedWidget3();; + } + } + + export function publicFunctionWithPrivateParmeterTypes() { // Error + return exporter.createExportedWidget1(); + } + function privateFunctionWithPrivateParmeterTypes() { + return exporter.createExportedWidget1(); + } + export function publicFunctionWithPrivateParmeterTypes1() { // Error + return exporter.createExportedWidget3(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return exporter.createExportedWidget3(); + } + + export class publicClassWithPrivateModuleReturnTypes { + static myPublicStaticMethod() { // Error + return exporter.createExportedWidget2(); + } + myPublicMethod() { // Error + return exporter.createExportedWidget2(); + } + static myPublicStaticMethod1() { // Error + return exporter.createExportedWidget4(); + } + myPublicMethod1() { // Error + return exporter.createExportedWidget4(); + } + } + export function publicFunctionWithPrivateModuleReturnTypes() { // Error + return exporter.createExportedWidget2(); + } + export function publicFunctionWithPrivateModuleReturnTypes1() { // Error + return exporter.createExportedWidget4(); + } + + class privateClassWithPrivateModuleReturnTypes { + static myPublicStaticMethod() { + return exporter.createExportedWidget2(); + } + myPublicMethod() { + return exporter.createExportedWidget2(); + } + static myPublicStaticMethod1() { // Error + return exporter.createExportedWidget4(); + } + myPublicMethod1() { // Error + return exporter.createExportedWidget4(); + } + } + function privateFunctionWithPrivateModuleReturnTypes() { + return exporter.createExportedWidget2(); + } + function privateFunctionWithPrivateModuleReturnTypes1() { + return exporter.createExportedWidget4(); + } + +==== privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts (1 errors) ==== + declare module "GlobalWidgets" { + export class Widget3 { + name: string; + } + export function createWidget3(): Widget3; + + export module SpecializedGlobalWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget4 { + name: string; + } + function createWidget4(): Widget4; + } + } + +==== privacyFunctionReturnTypeDeclFile_Widgets.ts (1 errors) ==== + export class Widget1 { + name = 'one'; + } + export function createWidget1() { + return new Widget1(); + } + + export module SpecializedWidget { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class Widget2 { + name = 'one'; + } + export function createWidget2() { + return new Widget2(); + } + } + +==== privacyFunctionReturnTypeDeclFile_exporter.ts (0 errors) ==== + /// + import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); + import Widgets1 = require("GlobalWidgets"); + export function createExportedWidget1() { + return Widgets.createWidget1(); + } + export function createExportedWidget2() { + return Widgets.SpecializedWidget.createWidget2(); + } + export function createExportedWidget3() { + return Widgets1.createWidget3(); + } + export function createExportedWidget4() { + return Widgets1.SpecializedGlobalWidget.createWidget4(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js index cf194848798..621cecf4549 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js @@ -406,84 +406,3 @@ export declare class publicClassWithPrivateModuleReturnTypes { } export declare function publicFunctionWithPrivateModuleReturnTypes(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; export declare function publicFunctionWithPrivateModuleReturnTypes1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - - -//// [DtsFileErrors] - - -privacyFunctionReturnTypeDeclFile_consumer.d.ts(6,44): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionReturnTypeDeclFile_consumer.d.ts(8,31): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionReturnTypeDeclFile_consumer.d.ts(12,75): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionReturnTypeDeclFile_consumer.d.ts(16,44): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionReturnTypeDeclFile_consumer.d.ts(17,31): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. -privacyFunctionReturnTypeDeclFile_consumer.d.ts(20,79): error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - - -==== privacyFunctionReturnTypeDeclFile_consumer.d.ts (6 errors) ==== - export declare class publicClassWithWithPrivateParmeterTypes { - static myPublicStaticMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; - private static myPrivateStaticMethod; - myPublicMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; - private myPrivateMethod; - static myPublicStaticMethod1(): import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private static myPrivateStaticMethod1; - myPublicMethod1(): import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - private myPrivateMethod1; - } - export declare function publicFunctionWithPrivateParmeterTypes(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; - export declare function publicFunctionWithPrivateParmeterTypes1(): import("GlobalWidgets").Widget3; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - export declare class publicClassWithPrivateModuleReturnTypes { - static myPublicStaticMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; - myPublicMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; - static myPublicStaticMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - myPublicMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - } - export declare function publicFunctionWithPrivateModuleReturnTypes(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; - export declare function publicFunctionWithPrivateModuleReturnTypes1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'GlobalWidgets' or its corresponding type declarations. - -==== privacyFunctionReturnTypeDeclFile_GlobalWidgets.d.ts (0 errors) ==== - declare module "GlobalWidgets" { - class Widget3 { - name: string; - } - function createWidget3(): Widget3; - namespace SpecializedGlobalWidget { - class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== privacyFunctionReturnTypeDeclFile_Widgets.d.ts (0 errors) ==== - export declare class Widget1 { - name: string; - } - export declare function createWidget1(): Widget1; - export declare namespace SpecializedWidget { - class Widget2 { - name: string; - } - function createWidget2(): Widget2; - } - -==== privacyFunctionReturnTypeDeclFile_exporter.d.ts (0 errors) ==== - import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export declare function createExportedWidget1(): Widgets.Widget1; - export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; - export declare function createExportedWidget3(): Widgets1.Widget3; - export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; - \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionParameterDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionParameterDeclFile.errors.txt new file mode 100644 index 00000000000..b21b7e1145f --- /dev/null +++ b/tests/baselines/reference/privacyFunctionParameterDeclFile.errors.txt @@ -0,0 +1,698 @@ +privacyFunctionParameterDeclFile_GlobalFile.ts(24,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionParameterDeclFile_GlobalFile.ts(31,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionParameterDeclFile_externalModule.ts(131,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionParameterDeclFile_externalModule.ts(265,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyFunctionParameterDeclFile_externalModule.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (param: privateClass): publicClass; // Error + (param: privateClass): publicClass; // Error + myMethod(param: privateClass): void; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (param: privateClass): privateClass; + (param: privateClass): privateClass; + myMethod(param: privateClass): void; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { // Error + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { // Error + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error + } + export function publicFunctionWithPublicParmeterTypes(param: publicClass) { + } + function privateFunctionWithPrivateParmeterTypes(param: privateClass) { + } + function privateFunctionWithPublicParmeterTypes(param: publicClass) { + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; // Error + (param: privateModule.publicClass): publicClass; // Error + myMethod(param: privateModule.publicClass): void; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + myPublicMethod(param: privateModule.publicClass) { // Error + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + + export interface publicInterfaceWithPrivateParmeterTypes { + new (param: privateClass): publicClass; // Error + (param: privateClass): publicClass; // Error + myMethod(param: privateClass): void; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (param: privateClass): privateClass; + (param: privateClass): privateClass; + myMethod(param: privateClass): void; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { // Error + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { // Error + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error + } + export function publicFunctionWithPublicParmeterTypes(param: publicClass) { + } + function privateFunctionWithPrivateParmeterTypes(param: privateClass) { + } + function privateFunctionWithPublicParmeterTypes(param: publicClass) { + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; // Error + (param: privateModule.publicClass): publicClass; // Error + myMethod(param: privateModule.publicClass): void; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + myPublicMethod(param: privateModule.publicClass) { // Error + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (param: privateClass): publicClass; + (param: privateClass): publicClass; + myMethod(param: privateClass): void; + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (param: privateClass): privateClass; + (param: privateClass): privateClass; + myMethod(param: privateClass): void; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { + } + export function publicFunctionWithPublicParmeterTypes(param: publicClass) { + } + function privateFunctionWithPrivateParmeterTypes(param: privateClass) { + } + function privateFunctionWithPublicParmeterTypes(param: publicClass) { + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + } + +==== privacyFunctionParameterDeclFile_GlobalFile.ts (2 errors) ==== + class publicClassInGlobal { + } + interface publicInterfaceWithPublicParmeterTypesInGlobal { + new (param: publicClassInGlobal): publicClassInGlobal; + (param: publicClassInGlobal): publicClassInGlobal; + myMethod(param: publicClassInGlobal): void; + } + class publicClassWithWithPublicParmeterTypesInGlobal { + static myPublicStaticMethod(param: publicClassInGlobal) { + } + private static myPrivateStaticMethod(param: publicClassInGlobal) { + } + myPublicMethod(param: publicClassInGlobal) { + } + private myPrivateMethod(param: publicClassInGlobal) { + } + constructor(param: publicClassInGlobal, private param1: publicClassInGlobal, public param2: publicClassInGlobal) { + } + } + function publicFunctionWithPublicParmeterTypesInGlobal(param: publicClassInGlobal) { + } + declare function publicAmbientFunctionWithPublicParmeterTypesInGlobal(param: publicClassInGlobal): void; + + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (param: privateClass): publicClass; + (param: privateClass): publicClass; + myMethod(param: privateClass): void; + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (param: privateClass): privateClass; + (param: privateClass): privateClass; + myMethod(param: privateClass): void; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { + } + export function publicFunctionWithPublicParmeterTypes(param: publicClass) { + } + function privateFunctionWithPrivateParmeterTypes(param: privateClass) { + } + function privateFunctionWithPublicParmeterTypes(param: publicClass) { + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (param: privateClass): publicClass; // Error + (param: privateClass): publicClass; // Error + myMethod(param: privateClass): void; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (param: privateClass): privateClass; + (param: privateClass): privateClass; + myMethod(param: privateClass): void; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (param: publicClass): publicClass; + (param: publicClass): publicClass; + myMethod(param: publicClass): void; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { // Error + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { // Error + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(param: privateClass) { + } + private static myPrivateStaticMethod(param: privateClass) { + } + myPublicMethod(param: privateClass) { + } + private myPrivateMethod(param: privateClass) { + } + constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(param: publicClass) { + } + private static myPrivateStaticMethod(param: publicClass) { + } + myPublicMethod(param: publicClass) { + } + private myPrivateMethod(param: publicClass) { + } + constructor(param: publicClass, private param1: publicClass, public param2: publicClass) { + } + } + + export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error + } + export function publicFunctionWithPublicParmeterTypes(param: publicClass) { + } + function privateFunctionWithPrivateParmeterTypes(param: privateClass) { + } + function privateFunctionWithPublicParmeterTypes(param: publicClass) { + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; + declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; // Error + (param: privateModule.publicClass): publicClass; // Error + myMethod(param: privateModule.publicClass): void; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { // Error + } + myPublicMethod(param: privateModule.publicClass) { // Error + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error + } + } + export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (param: privateModule.publicClass): publicClass; + (param: privateModule.publicClass): publicClass; + myMethod(param: privateModule.publicClass): void; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(param: privateModule.publicClass) { + } + myPublicMethod(param: privateModule.publicClass) { + } + constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { + } + } + function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionReturnTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionReturnTypeDeclFile.errors.txt new file mode 100644 index 00000000000..34102d34099 --- /dev/null +++ b/tests/baselines/reference/privacyFunctionReturnTypeDeclFile.errors.txt @@ -0,0 +1,1205 @@ +privacyFunctionReturnTypeDeclFile_GlobalFile.ts(43,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionReturnTypeDeclFile_GlobalFile.ts(50,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionReturnTypeDeclFile_externalModule.ts(229,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyFunctionReturnTypeDeclFile_externalModule.ts(459,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyFunctionReturnTypeDeclFile_externalModule.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (): privateClass; // Error + (): privateClass; // Error + [x: number]: privateClass; // Error + myMethod(): privateClass; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { // Error + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { // Error + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { // Error + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + export function publicFunctionWithPrivateParmeterTypes(): privateClass { // Error + return null; + } + export function publicFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + function privateFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + function privateFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + export function publicFunctionWithPrivateParmeterTypes1() { // Error + return new privateClass(); + } + export function publicFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + function privateFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(): privateClass; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(): publicClass; + declare function privateAmbientFunctionWithPrivateParmeterTypes(): privateClass; + declare function privateAmbientFunctionWithPublicParmeterTypes(): publicClass; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; // Error + (): privateModule.publicClass; // Error + [x: number]: privateModule.publicClass // Error + myMethod(): privateModule.publicClass; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + export function publicFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { // Error + return null; + } + export function publicFunctionWithPrivateModuleParameterTypes1() { // Error + return new privateModule.publicClass(); + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass + myMethod(): privateModule.publicClass; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + function privateFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + function privateFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (): privateClass; // Error + (): privateClass; // Error + [x: number]: privateClass; // Error + myMethod(): privateClass; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { // Error + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { // Error + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { // Error + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + export function publicFunctionWithPrivateParmeterTypes(): privateClass { // Error + return null; + } + export function publicFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + function privateFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + function privateFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + export function publicFunctionWithPrivateParmeterTypes1() { // Error + return new privateClass(); + } + export function publicFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + function privateFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(): privateClass; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(): publicClass; + declare function privateAmbientFunctionWithPrivateParmeterTypes(): privateClass; + declare function privateAmbientFunctionWithPublicParmeterTypes(): publicClass; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; // Error + (): privateModule.publicClass; // Error + [x: number]: privateModule.publicClass; // Error + myMethod(): privateModule.publicClass; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + export function publicFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { // Error + return null; + } + export function publicFunctionWithPrivateModuleParameterTypes1() { // Error + return new privateModule.publicClass(); + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + function privateFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + function privateFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + export function publicFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + export function publicFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + function privateFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + function privateFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + export function publicFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + export function publicFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + function privateFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(): privateClass; + export declare function publicAmbientFunctionWithPublicParmeterTypes(): publicClass; + declare function privateAmbientFunctionWithPrivateParmeterTypes(): privateClass; + declare function privateAmbientFunctionWithPublicParmeterTypes(): publicClass; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + export function publicFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + export function publicFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + function privateFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + function privateFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + } + +==== privacyFunctionReturnTypeDeclFile_GlobalFile.ts (2 errors) ==== + class publicClassInGlobal { + } + interface publicInterfaceWithPublicParmeterTypesInGlobal { + new (): publicClassInGlobal; + (): publicClassInGlobal; + [x: number]: publicClassInGlobal; + myMethod(): publicClassInGlobal; + } + class publicClassWithWithPublicParmeterTypesInGlobal { + static myPublicStaticMethod(): publicClassInGlobal { + return null; + } + private static myPrivateStaticMethod(): publicClassInGlobal { + return null; + } + myPublicMethod(): publicClassInGlobal { + return null; + } + private myPrivateMethod(): publicClassInGlobal { + return null; + } + static myPublicStaticMethod1() { + return new publicClassInGlobal(); + } + private static myPrivateStaticMethod1() { + return new publicClassInGlobal(); + } + myPublicMethod1() { + return new publicClassInGlobal(); + } + private myPrivateMethod1() { + return new publicClassInGlobal(); + } + } + function publicFunctionWithPublicParmeterTypesInGlobal(): publicClassInGlobal { + return null; + } + function publicFunctionWithPublicParmeterTypesInGlobal1() { + return new publicClassInGlobal(); + } + declare function publicAmbientFunctionWithPublicParmeterTypesInGlobal(): publicClassInGlobal; + + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + export function publicFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + export function publicFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + function privateFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + function privateFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + export function publicFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + export function publicFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + function privateFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(): privateClass; + export declare function publicAmbientFunctionWithPublicParmeterTypes(): publicClass; + declare function privateAmbientFunctionWithPrivateParmeterTypes(): privateClass; + declare function privateAmbientFunctionWithPublicParmeterTypes(): publicClass; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + export function publicFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + export function publicFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + function privateFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + function privateFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + } + + export interface publicInterfaceWithPrivateParmeterTypes { + new (): privateClass; // Error + (): privateClass; // Error + [x: number]: privateClass; // Error + myMethod(): privateClass; // Error + } + + export interface publicInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateParmeterTypes { + new (): privateClass; + (): privateClass; + [x: number]: privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicParmeterTypes { + new (): publicClass; + (): publicClass; + [x: number]: publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { // Error + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { // Error + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { // Error + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { // Error + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + export class publicClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + class privateClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): privateClass { + return null; + } + private static myPrivateStaticMethod(): privateClass { + return null; + } + myPublicMethod(): privateClass { + return null; + } + private myPrivateMethod(): privateClass { + return null; + } + static myPublicStaticMethod1() { + return new privateClass(); + } + private static myPrivateStaticMethod1() { + return new privateClass(); + } + myPublicMethod1() { + return new privateClass(); + } + private myPrivateMethod1() { + return new privateClass(); + } + } + + class privateClassWithWithPublicParmeterTypes { + static myPublicStaticMethod(): publicClass { + return null; + } + private static myPrivateStaticMethod(): publicClass { + return null; + } + myPublicMethod(): publicClass { + return null; + } + private myPrivateMethod(): publicClass { + return null; + } + static myPublicStaticMethod1() { + return new publicClass(); + } + private static myPrivateStaticMethod1() { + return new publicClass(); + } + myPublicMethod1() { + return new publicClass(); + } + private myPrivateMethod1() { + return new publicClass(); + } + } + + export function publicFunctionWithPrivateParmeterTypes(): privateClass { // Error + return null; + } + export function publicFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + function privateFunctionWithPrivateParmeterTypes(): privateClass { + return null; + } + function privateFunctionWithPublicParmeterTypes(): publicClass { + return null; + } + export function publicFunctionWithPrivateParmeterTypes1() { // Error + return new privateClass(); + } + export function publicFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + function privateFunctionWithPrivateParmeterTypes1() { + return new privateClass(); + } + function privateFunctionWithPublicParmeterTypes1() { + return new publicClass(); + } + + export declare function publicAmbientFunctionWithPrivateParmeterTypes(): privateClass; // Error + export declare function publicAmbientFunctionWithPublicParmeterTypes(): publicClass; + declare function privateAmbientFunctionWithPrivateParmeterTypes(): privateClass; + declare function privateAmbientFunctionWithPublicParmeterTypes(): publicClass; + + export interface publicInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; // Error + (): privateModule.publicClass; // Error + [x: number]: privateModule.publicClass; // Error + myMethod(): privateModule.publicClass; // Error + } + export class publicClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { // Error + return null; + } + myPublicMethod(): privateModule.publicClass { // Error + return null; + } + static myPublicStaticMethod1() { // Error + return new privateModule.publicClass(); + } + myPublicMethod1() { // Error + return new privateModule.publicClass(); + } + } + export function publicFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { // Error + return null; + } + export function publicFunctionWithPrivateModuleParameterTypes1() { // Error + return new privateModule.publicClass(); + } + export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModuleParameterTypes { + new (): privateModule.publicClass; + (): privateModule.publicClass; + [x: number]: privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithPrivateModuleParameterTypes { + static myPublicStaticMethod(): privateModule.publicClass { + return null; + } + myPublicMethod(): privateModule.publicClass { + return null; + } + static myPublicStaticMethod1() { + return new privateModule.publicClass(); + } + myPublicMethod1() { + return new privateModule.publicClass(); + } + } + function privateFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass { + return null; + } + function privateFunctionWithPrivateModuleParameterTypes1() { + return new privateModule.publicClass(); + } + declare function privateAmbientFunctionWithPrivateModuleParameterTypes(): privateModule.publicClass; + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyGetter.errors.txt b/tests/baselines/reference/privacyGetter.errors.txt new file mode 100644 index 00000000000..b30496e1ce3 --- /dev/null +++ b/tests/baselines/reference/privacyGetter.errors.txt @@ -0,0 +1,216 @@ +privacyGetter.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGetter.ts(71,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGetter.ts (2 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + private get p1_private() { + return new C1_public(); + } + + private set p1_private(m1_c3_p1_arg: C1_public) { + } + + private get p2_private() { + return new C1_public(); + } + + private set p2_private(m1_c3_p2_arg: C1_public) { + } + + private get p3_private() { + return new C2_private(); + } + + private set p3_private(m1_c3_p3_arg: C2_private) { + } + + public get p4_public(): C2_private { // error + return new C2_private(); //error + } + + public set p4_public(m1_c3_p4_arg: C2_private) { // error + } + } + + class C4_private { + private get p1_private() { + return new C1_public(); + } + + private set p1_private(m1_c3_p1_arg: C1_public) { + } + + private get p2_private() { + return new C1_public(); + } + + private set p2_private(m1_c3_p2_arg: C1_public) { + } + + private get p3_private() { + return new C2_private(); + } + + private set p3_private(m1_c3_p3_arg: C2_private) { + } + + public get p4_public(): C2_private { + return new C2_private(); + } + + public set p4_public(m1_c3_p4_arg: C2_private) { + } + } + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class m2_C1_public { + private f1() { + } + } + + class m2_C2_private { + } + + export class m2_C3_public { + private get p1_private() { + return new m2_C1_public(); + } + + private set p1_private(m2_c3_p1_arg: m2_C1_public) { + } + + private get p2_private() { + return new m2_C1_public(); + } + + private set p2_private(m2_c3_p2_arg: m2_C1_public) { + } + + private get p3_private() { + return new m2_C2_private(); + } + + private set p3_private(m2_c3_p3_arg: m2_C2_private) { + } + + public get p4_public(): m2_C2_private { + return new m2_C2_private(); + } + + public set p4_public(m2_c3_p4_arg: m2_C2_private) { + } + } + + class m2_C4_private { + private get p1_private() { + return new m2_C1_public(); + } + + private set p1_private(m2_c3_p1_arg: m2_C1_public) { + } + + private get p2_private() { + return new m2_C1_public(); + } + + private set p2_private(m2_c3_p2_arg: m2_C1_public) { + } + + private get p3_private() { + return new m2_C2_private(); + } + + private set p3_private(m2_c3_p3_arg: m2_C2_private) { + } + + public get p4_public(): m2_C2_private { + return new m2_C2_private(); + } + + public set p4_public(m2_c3_p4_arg: m2_C2_private) { + } + } + } + + class C5_private { + private f() { + } + } + + export class C6_public { + } + + export class C7_public { + private get p1_private() { + return new C6_public(); + } + + private set p1_private(m1_c3_p1_arg: C6_public) { + } + + private get p2_private() { + return new C6_public(); + } + + private set p2_private(m1_c3_p2_arg: C6_public) { + } + + private get p3_private() { + return new C5_private(); + } + + private set p3_private(m1_c3_p3_arg: C5_private) { + } + + public get p4_public(): C5_private { // error + return new C5_private(); //error + } + + public set p4_public(m1_c3_p4_arg: C5_private) { // error + } + } + + class C8_private { + private get p1_private() { + return new C6_public(); + } + + private set p1_private(m1_c3_p1_arg: C6_public) { + } + + private get p2_private() { + return new C6_public(); + } + + private set p2_private(m1_c3_p2_arg: C6_public) { + } + + private get p3_private() { + return new C5_private(); + } + + private set p3_private(m1_c3_p3_arg: C5_private) { + } + + public get p4_public(): C5_private { + return new C5_private(); + } + + public set p4_public(m1_c3_p4_arg: C5_private) { + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloClass.errors.txt b/tests/baselines/reference/privacyGloClass.errors.txt new file mode 100644 index 00000000000..944f42e69a9 --- /dev/null +++ b/tests/baselines/reference/privacyGloClass.errors.txt @@ -0,0 +1,66 @@ +privacyGloClass.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloClass.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m1_i_public { + } + + interface m1_i_private { + } + + export class m1_c_public { + private f1() { + } + } + + class m1_c_private { + } + + class m1_C1_private extends m1_c_public { + } + class m1_C2_private extends m1_c_private { + } + export class m1_C3_public extends m1_c_public { + } + export class m1_C4_public extends m1_c_private { + } + + class m1_C5_private implements m1_i_public { + } + class m1_C6_private implements m1_i_private { + } + export class m1_C7_public implements m1_i_public { + } + export class m1_C8_public implements m1_i_private { + } + + class m1_C9_private extends m1_c_public implements m1_i_private, m1_i_public { + } + class m1_C10_private extends m1_c_private implements m1_i_private, m1_i_public { + } + export class m1_C11_public extends m1_c_public implements m1_i_private, m1_i_public { + } + export class m1_C12_public extends m1_c_private implements m1_i_private, m1_i_public { + } + } + + interface glo_i_public { + } + + class glo_c_public { + private f1() { + } + } + + class glo_C3_public extends glo_c_public { + } + + class glo_C7_public implements glo_i_public { + } + + class glo_C11_public extends glo_c_public implements glo_i_public { + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloFunc.errors.txt b/tests/baselines/reference/privacyGloFunc.errors.txt new file mode 100644 index 00000000000..dcafe239858 --- /dev/null +++ b/tests/baselines/reference/privacyGloFunc.errors.txt @@ -0,0 +1,539 @@ +privacyGloFunc.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloFunc.ts(179,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloFunc.ts (2 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + constructor (m1_c3_c1: C1_public); + constructor (m1_c3_c2: C2_private); //error + constructor (m1_c3_c1_2: any) { + } + + private f1_private(m1_c3_f1_arg: C1_public) { + } + + public f2_public(m1_c3_f2_arg: C1_public) { + } + + private f3_private(m1_c3_f3_arg: C2_private) { + } + + public f4_public(m1_c3_f4_arg: C2_private) { // error + } + + private f5_private() { + return new C1_public(); + } + + public f6_public() { + return new C1_public(); + } + + private f7_private() { + return new C2_private(); + } + + public f8_public() { + return new C2_private(); // error + } + + private f9_private(): C1_public { + return new C1_public(); + } + + public f10_public(): C1_public { + return new C1_public(); + } + + private f11_private(): C2_private { + return new C2_private(); + } + + public f12_public(): C2_private { // error + return new C2_private(); //error + } + } + + class C4_private { + constructor (m1_c4_c1: C1_public); + constructor (m1_c4_c2: C2_private); + constructor (m1_c4_c1_2: any) { + } + private f1_private(m1_c4_f1_arg: C1_public) { + } + + public f2_public(m1_c4_f2_arg: C1_public) { + } + + private f3_private(m1_c4_f3_arg: C2_private) { + } + + public f4_public(m1_c4_f4_arg: C2_private) { + } + + + private f5_private() { + return new C1_public(); + } + + public f6_public() { + return new C1_public(); + } + + private f7_private() { + return new C2_private(); + } + + public f8_public() { + return new C2_private(); + } + + + private f9_private(): C1_public { + return new C1_public(); + } + + public f10_public(): C1_public { + return new C1_public(); + } + + private f11_private(): C2_private { + return new C2_private(); + } + + public f12_public(): C2_private { + return new C2_private(); + } + } + + export class C5_public { + constructor (m1_c5_c: C1_public) { + } + } + + class C6_private { + constructor (m1_c6_c: C1_public) { + } + } + export class C7_public { + constructor (m1_c7_c: C2_private) { // error + } + } + + class C8_private { + constructor (m1_c8_c: C2_private) { + } + } + + function f1_public(m1_f1_arg: C1_public) { + } + + export function f2_public(m1_f2_arg: C1_public) { + } + + function f3_public(m1_f3_arg: C2_private) { + } + + export function f4_public(m1_f4_arg: C2_private) { // error + } + + + function f5_public() { + return new C1_public(); + } + + export function f6_public() { + return new C1_public(); + } + + function f7_public() { + return new C2_private(); + } + + export function f8_public() { + return new C2_private(); // error + } + + + function f9_private(): C1_public { + return new C1_public(); + } + + export function f10_public(): C1_public { + return new C1_public(); + } + + function f11_private(): C2_private { + return new C2_private(); + } + + export function f12_public(): C2_private { // error + return new C2_private(); //error + } + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class m2_C1_public { + private f() { + } + } + + class m2_C2_private { + } + + export class m2_C3_public { + constructor (m2_c3_c1: m2_C1_public); + constructor (m2_c3_c2: m2_C2_private); + constructor (m2_c3_c1_2: any) { + } + + private f1_private(m2_c3_f1_arg: m2_C1_public) { + } + + public f2_public(m2_c3_f2_arg: m2_C1_public) { + } + + private f3_private(m2_c3_f3_arg: m2_C2_private) { + } + + public f4_public(m2_c3_f4_arg: m2_C2_private) { + } + + private f5_private() { + return new m2_C1_public(); + } + + public f6_public() { + return new m2_C1_public(); + } + + private f7_private() { + return new m2_C2_private(); + } + + public f8_public() { + return new m2_C2_private(); + } + + private f9_private(): m2_C1_public { + return new m2_C1_public(); + } + + public f10_public(): m2_C1_public { + return new m2_C1_public(); + } + + private f11_private(): m2_C2_private { + return new m2_C2_private(); + } + + public f12_public(): m2_C2_private { + return new m2_C2_private(); + } + } + + class m2_C4_private { + constructor (m2_c4_c1: m2_C1_public); + constructor (m2_c4_c2: m2_C2_private); + constructor (m2_c4_c1_2: any) { + } + + private f1_private(m2_c4_f1_arg: m2_C1_public) { + } + + public f2_public(m2_c4_f2_arg: m2_C1_public) { + } + + private f3_private(m2_c4_f3_arg: m2_C2_private) { + } + + public f4_public(m2_c4_f4_arg: m2_C2_private) { + } + + + private f5_private() { + return new m2_C1_public(); + } + + public f6_public() { + return new m2_C1_public(); + } + + private f7_private() { + return new m2_C2_private(); + } + + public f8_public() { + return new m2_C2_private(); + } + + + private f9_private(): m2_C1_public { + return new m2_C1_public(); + } + + public f10_public(): m2_C1_public { + return new m2_C1_public(); + } + + private f11_private(): m2_C2_private { + return new m2_C2_private(); + } + + public f12_public(): m2_C2_private { + return new m2_C2_private(); + } + } + + export class m2_C5_public { + constructor (m2_c5_c: m2_C1_public) { + } + } + + class m2_C6_private { + constructor (m2_c6_c: m2_C1_public) { + } + } + export class m2_C7_public { + constructor (m2_c7_c: m2_C2_private) { + } + } + + class m2_C8_private { + constructor (m2_c8_c: m2_C2_private) { + } + } + + function f1_public(m2_f1_arg: m2_C1_public) { + } + + export function f2_public(m2_f2_arg: m2_C1_public) { + } + + function f3_public(m2_f3_arg: m2_C2_private) { + } + + export function f4_public(m2_f4_arg: m2_C2_private) { + } + + + function f5_public() { + return new m2_C1_public(); + } + + export function f6_public() { + return new m2_C1_public(); + } + + function f7_public() { + return new m2_C2_private(); + } + + export function f8_public() { + return new m2_C2_private(); + } + + + function f9_private(): m2_C1_public { + return new m2_C1_public(); + } + + export function f10_public(): m2_C1_public { + return new m2_C1_public(); + } + + function f11_private(): m2_C2_private { + return new m2_C2_private(); + } + + export function f12_public(): m2_C2_private { + return new m2_C2_private(); + } + } + + class C5_private { + private f() { + } + } + + export class C6_public { + } + + export class C7_public { + constructor (c7_c1: C5_private); // error + constructor (c7_c2: C6_public); + constructor (c7_c1_2: any) { + } + private f1_private(c7_f1_arg: C6_public) { + } + + public f2_public(c7_f2_arg: C6_public) { + } + + private f3_private(c7_f3_arg: C5_private) { + } + + public f4_public(c7_f4_arg: C5_private) { //error + } + + private f5_private() { + return new C6_public(); + } + + public f6_public() { + return new C6_public(); + } + + private f7_private() { + return new C5_private(); + } + + public f8_public() { + return new C5_private(); //error + } + + private f9_private(): C6_public { + return new C6_public(); + } + + public f10_public(): C6_public { + return new C6_public(); + } + + private f11_private(): C5_private { + return new C5_private(); + } + + public f12_public(): C5_private { //error + return new C5_private(); //error + } + } + + class C8_private { + constructor (c8_c1: C5_private); + constructor (c8_c2: C6_public); + constructor (c8_c1_2: any) { + } + + private f1_private(c8_f1_arg: C6_public) { + } + + public f2_public(c8_f2_arg: C6_public) { + } + + private f3_private(c8_f3_arg: C5_private) { + } + + public f4_public(c8_f4_arg: C5_private) { + } + + private f5_private() { + return new C6_public(); + } + + public f6_public() { + return new C6_public(); + } + + private f7_private() { + return new C5_private(); + } + + public f8_public() { + return new C5_private(); + } + + private f9_private(): C6_public { + return new C6_public(); + } + + public f10_public(): C6_public { + return new C6_public(); + } + + private f11_private(): C5_private { + return new C5_private(); + } + + public f12_public(): C5_private { + return new C5_private(); + } + } + + + export class C9_public { + constructor (c9_c: C6_public) { + } + } + + class C10_private { + constructor (c10_c: C6_public) { + } + } + export class C11_public { + constructor (c11_c: C5_private) { // error + } + } + + class C12_private { + constructor (c12_c: C5_private) { + } + } + + function f1_private(f1_arg: C5_private) { + } + + export function f2_public(f2_arg: C5_private) { // error + } + + function f3_private(f3_arg: C6_public) { + } + + export function f4_public(f4_arg: C6_public) { + } + + function f5_private() { + return new C6_public(); + } + + export function f6_public() { + return new C6_public(); + } + + function f7_private() { + return new C5_private(); + } + + export function f8_public() { + return new C5_private(); //error + } + + function f9_private(): C6_public { + return new C6_public(); + } + + export function f10_public(): C6_public { + return new C6_public(); + } + + function f11_private(): C5_private { + return new C5_private(); + } + + export function f12_public(): C5_private { //error + return new C5_private(); //error + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloFunc.types b/tests/baselines/reference/privacyGloFunc.types index 46a8ca6c382..720918c8acc 100644 --- a/tests/baselines/reference/privacyGloFunc.types +++ b/tests/baselines/reference/privacyGloFunc.types @@ -34,6 +34,7 @@ export module m1 { constructor (m1_c3_c1_2: any) { >m1_c3_c1_2 : any +> : ^^^ } private f1_private(m1_c3_f1_arg: C1_public) { @@ -167,6 +168,7 @@ export module m1 { constructor (m1_c4_c1_2: any) { >m1_c4_c1_2 : any +> : ^^^ } private f1_private(m1_c4_f1_arg: C1_public) { >f1_private : (m1_c4_f1_arg: C1_public) => void @@ -478,6 +480,7 @@ module m2 { constructor (m2_c3_c1_2: any) { >m2_c3_c1_2 : any +> : ^^^ } private f1_private(m2_c3_f1_arg: m2_C1_public) { @@ -611,6 +614,7 @@ module m2 { constructor (m2_c4_c1_2: any) { >m2_c4_c1_2 : any +> : ^^^ } private f1_private(m2_c4_f1_arg: m2_C1_public) { @@ -919,6 +923,7 @@ export class C7_public { constructor (c7_c1_2: any) { >c7_c1_2 : any +> : ^^^ } private f1_private(c7_f1_arg: C6_public) { >f1_private : (c7_f1_arg: C6_public) => void @@ -1051,6 +1056,7 @@ class C8_private { constructor (c8_c1_2: any) { >c8_c1_2 : any +> : ^^^ } private f1_private(c8_f1_arg: C6_public) { diff --git a/tests/baselines/reference/privacyGloGetter.errors.txt b/tests/baselines/reference/privacyGloGetter.errors.txt new file mode 100644 index 00000000000..5b309edd2ae --- /dev/null +++ b/tests/baselines/reference/privacyGloGetter.errors.txt @@ -0,0 +1,94 @@ +privacyGloGetter.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloGetter.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + private get p1_private() { + return new C1_public(); + } + + private set p1_private(m1_c3_p1_arg: C1_public) { + } + + private get p2_private() { + return new C1_public(); + } + + private set p2_private(m1_c3_p2_arg: C1_public) { + } + + private get p3_private() { + return new C2_private(); + } + + private set p3_private(m1_c3_p3_arg: C2_private) { + } + + public get p4_public(): C2_private { // error + return new C2_private(); //error + } + + public set p4_public(m1_c3_p4_arg: C2_private) { // error + } + } + + class C4_private { + private get p1_private() { + return new C1_public(); + } + + private set p1_private(m1_c3_p1_arg: C1_public) { + } + + private get p2_private() { + return new C1_public(); + } + + private set p2_private(m1_c3_p2_arg: C1_public) { + } + + private get p3_private() { + return new C2_private(); + } + + private set p3_private(m1_c3_p3_arg: C2_private) { + } + + public get p4_public(): C2_private { + return new C2_private(); + } + + public set p4_public(m1_c3_p4_arg: C2_private) { + } + } + } + + class C6_public { + } + + class C7_public { + private get p1_private() { + return new C6_public(); + } + + private set p1_private(m1_c3_p1_arg: C6_public) { + } + + private get p2_private() { + return new C6_public(); + } + + private set p2_private(m1_c3_p2_arg: C6_public) { + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloImport.errors.txt b/tests/baselines/reference/privacyGloImport.errors.txt new file mode 100644 index 00000000000..26e140223a6 --- /dev/null +++ b/tests/baselines/reference/privacyGloImport.errors.txt @@ -0,0 +1,185 @@ +privacyGloImport.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(12,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(120,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(124,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(132,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(137,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(145,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImport.ts(147,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloImport.ts (10 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m1_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + module m1_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + //export declare module "m1_M3_public" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + //declare module "m1_M4_private" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + import m1_im1_private = m1_M1_public; + export var m1_im1_private_v1_public = m1_im1_private.c1; + export var m1_im1_private_v2_public = new m1_im1_private.c1(); + export var m1_im1_private_v3_public = m1_im1_private.f1; + export var m1_im1_private_v4_public = m1_im1_private.f1(); + var m1_im1_private_v1_private = m1_im1_private.c1; + var m1_im1_private_v2_private = new m1_im1_private.c1(); + var m1_im1_private_v3_private = m1_im1_private.f1; + var m1_im1_private_v4_private = m1_im1_private.f1(); + + + import m1_im2_private = m1_M2_private; + export var m1_im2_private_v1_public = m1_im2_private.c1; + export var m1_im2_private_v2_public = new m1_im2_private.c1(); + export var m1_im2_private_v3_public = m1_im2_private.f1; + export var m1_im2_private_v4_public = m1_im2_private.f1(); + var m1_im2_private_v1_private = m1_im2_private.c1; + var m1_im2_private_v2_private = new m1_im2_private.c1(); + var m1_im2_private_v3_private = m1_im2_private.f1; + var m1_im2_private_v4_private = m1_im2_private.f1(); + + //import m1_im3_private = require("m1_M3_public"); + //export var m1_im3_private_v1_public = m1_im3_private.c1; + //export var m1_im3_private_v2_public = new m1_im3_private.c1(); + //export var m1_im3_private_v3_public = m1_im3_private.f1; + //export var m1_im3_private_v4_public = m1_im3_private.f1(); + //var m1_im3_private_v1_private = m1_im3_private.c1; + //var m1_im3_private_v2_private = new m1_im3_private.c1(); + //var m1_im3_private_v3_private = m1_im3_private.f1; + //var m1_im3_private_v4_private = m1_im3_private.f1(); + + //import m1_im4_private = require("m1_M4_private"); + //export var m1_im4_private_v1_public = m1_im4_private.c1; + //export var m1_im4_private_v2_public = new m1_im4_private.c1(); + //export var m1_im4_private_v3_public = m1_im4_private.f1; + //export var m1_im4_private_v4_public = m1_im4_private.f1(); + //var m1_im4_private_v1_private = m1_im4_private.c1; + //var m1_im4_private_v2_private = new m1_im4_private.c1(); + //var m1_im4_private_v3_private = m1_im4_private.f1; + //var m1_im4_private_v4_private = m1_im4_private.f1(); + + export import m1_im1_public = m1_M1_public; + export import m1_im2_public = m1_M2_private; + //export import m1_im3_public = require("m1_M3_public"); + //export import m1_im4_public = require("m1_M4_private"); + } + + module glo_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + declare module "glo_M2_public" { + export function f1(); + export class c1 { + } + export var v1: { new (): c1; }; + export var v2: c1; + } + + declare module "use_glo_M1_public" { + import use_glo_M1_public = glo_M1_public; + export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; }; + export var use_glo_M1_public_v2_public: typeof use_glo_M1_public; + export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1; + var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; }; + var use_glo_M1_public_v2_private: typeof use_glo_M1_public; + var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1; + + import use_glo_M2_public = require("glo_M2_public"); + export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; }; + export var use_glo_M2_public_v2_public: typeof use_glo_M2_public; + export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1; + var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; }; + var use_glo_M2_public_v2_private: typeof use_glo_M2_public; + var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1; + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //import errorImport = require("glo_M2_public"); + import nonerrorImport = glo_M1_public; + + module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //import m5_errorImport = require("glo_M2_public"); + import m5_nonerrorImport = glo_M1_public; + } + } + } + + declare module "anotherParseError" { + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //declare module "abc" { + //} + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //module "abc2" { + //} + } + //module "abc3" { + //} + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //import m3 = require("use_glo_M1_public"); + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a = 10; + //import m2 = require("use_glo_M1_public"); + } + + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt index 358f2ba95a5..553a08b528a 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt @@ -1,3 +1,6 @@ +privacyGloImportParseErrors.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImportParseErrors.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImportParseErrors.ts(12,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(22,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -7,18 +10,29 @@ privacyGloImportParseErrors.ts(69,37): error TS1147: Import declarations in a na privacyGloImportParseErrors.ts(69,37): error TS2307: Cannot find module 'm1_M4_private' or its corresponding type declarations. privacyGloImportParseErrors.ts(81,43): error TS1147: Import declarations in a namespace cannot reference a module. privacyGloImportParseErrors.ts(82,43): error TS1147: Import declarations in a namespace cannot reference a module. +privacyGloImportParseErrors.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloImportParseErrors.ts(120,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(121,38): error TS1147: Import declarations in a namespace cannot reference a module. +privacyGloImportParseErrors.ts(124,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(125,45): error TS1147: Import declarations in a namespace cannot reference a module. +privacyGloImportParseErrors.ts(132,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. privacyGloImportParseErrors.ts(133,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +privacyGloImportParseErrors.ts(137,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(138,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +privacyGloImportParseErrors.ts(145,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(146,25): error TS1147: Import declarations in a namespace cannot reference a module. +privacyGloImportParseErrors.ts(147,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a namespace cannot reference a module. -==== privacyGloImportParseErrors.ts (16 errors) ==== +==== privacyGloImportParseErrors.ts (26 errors) ==== module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m1_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -29,6 +43,8 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n } module m1_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -120,6 +136,8 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n } module glo_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -155,12 +173,16 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1; module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import errorImport = require("glo_M2_public"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. import nonerrorImport = glo_M1_public; module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m5_errorImport = require("glo_M2_public"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. @@ -171,6 +193,8 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n declare module "anotherParseError" { module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare module "abc" { ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -180,6 +204,8 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module "abc2" { ~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -190,10 +216,14 @@ privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in a n } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m3 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = 10; import m2 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/privacyGloInterface.errors.txt b/tests/baselines/reference/privacyGloInterface.errors.txt new file mode 100644 index 00000000000..6d129f70cca --- /dev/null +++ b/tests/baselines/reference/privacyGloInterface.errors.txt @@ -0,0 +1,128 @@ +privacyGloInterface.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyGloInterface.ts(89,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloInterface.ts (2 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + + class C2_private { + } + + export interface C3_public { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + + interface C4_private { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + } + + class C5_public { + private f1() { + } + } + + + interface C7_public { + (c1: C5_public); + (): C5_public; + + new (c1: C5_public); + new (): C5_public; + + [c: number]: C5_public; + + x: C5_public; + + a?: C5_public; + + f1(a1: C5_public); + f3(): C5_public; + } + + module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m3_i_public { + f1(): number; + } + + interface m3_i_private { + f2(): string; + } + + interface m3_C1_private extends m3_i_public { + } + interface m3_C2_private extends m3_i_private { + } + export interface m3_C3_public extends m3_i_public { + } + export interface m3_C4_public extends m3_i_private { + } + + interface m3_C5_private extends m3_i_private, m3_i_public { + } + export interface m3_C6_public extends m3_i_private, m3_i_public { + } + } + + interface glo_i_public { + f1(): number; + } + + interface glo_C3_public extends glo_i_public { + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloVar.errors.txt b/tests/baselines/reference/privacyGloVar.errors.txt new file mode 100644 index 00000000000..7b52a7b1f61 --- /dev/null +++ b/tests/baselines/reference/privacyGloVar.errors.txt @@ -0,0 +1,86 @@ +privacyGloVar.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyGloVar.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + private C3_v1_private: C1_public; + public C3_v2_public: C1_public; + private C3_v3_private: C2_private; + public C3_v4_public: C2_private; // error + + private C3_v11_private = new C1_public(); + public C3_v12_public = new C1_public(); + private C3_v13_private = new C2_private(); + public C3_v14_public = new C2_private(); // error + + private C3_v21_private: C1_public = new C1_public(); + public C3_v22_public: C1_public = new C1_public(); + private C3_v23_private: C2_private = new C2_private(); + public C3_v24_public: C2_private = new C2_private(); // error + } + + class C4_public { + private C4_v1_private: C1_public; + public C4_v2_public: C1_public; + private C4_v3_private: C2_private; + public C4_v4_public: C2_private; + + private C4_v11_private = new C1_public(); + public C4_v12_public = new C1_public(); + private C4_v13_private = new C2_private(); + public C4_v14_public = new C2_private(); + + private C4_v21_private: C1_public = new C1_public(); + public C4_v22_public: C1_public = new C1_public(); + private C4_v23_private: C2_private = new C2_private(); + public C4_v24_public: C2_private = new C2_private(); + } + + var m1_v1_private: C1_public; + export var m1_v2_public: C1_public; + var m1_v3_private: C2_private; + export var m1_v4_public: C2_private; // error + + var m1_v11_private = new C1_public(); + export var m1_v12_public = new C1_public(); + var m1_v13_private = new C2_private(); + export var m1_v14_public = new C2_private(); //error + + var m1_v21_private: C1_public = new C1_public(); + export var m1_v22_public: C1_public = new C1_public(); + var m1_v23_private: C2_private = new C2_private(); + export var m1_v24_public: C2_private = new C2_private(); // error + } + + class glo_C1_public { + private f1() { + } + } + + class glo_C3_public { + private glo_C3_v1_private: glo_C1_public; + public glo_C3_v2_public: glo_C1_public; + + private glo_C3_v11_private = new glo_C1_public(); + public glo_C3_v12_public = new glo_C1_public(); + + private glo_C3_v21_private: glo_C1_public = new glo_C1_public(); + public glo_C3_v22_public: glo_C1_public = new glo_C1_public(); + } + + + var glo_v2_public: glo_C1_public; + var glo_v12_public = new glo_C1_public(); + var glo_v22_public: glo_C1_public = new glo_C1_public(); + \ No newline at end of file diff --git a/tests/baselines/reference/privacyImport.errors.txt b/tests/baselines/reference/privacyImport.errors.txt new file mode 100644 index 00000000000..1539ab5e38a --- /dev/null +++ b/tests/baselines/reference/privacyImport.errors.txt @@ -0,0 +1,395 @@ +privacyImport.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(12,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(86,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(96,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(170,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(188,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(340,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(342,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(349,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImport.ts(351,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyImport.ts (12 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m1_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + module m1_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + //export declare module "m1_M3_public" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + //declare module "m1_M4_private" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + import m1_im1_private = m1_M1_public; + export var m1_im1_private_v1_public = m1_im1_private.c1; + export var m1_im1_private_v2_public = new m1_im1_private.c1(); + export var m1_im1_private_v3_public = m1_im1_private.f1; + export var m1_im1_private_v4_public = m1_im1_private.f1(); + var m1_im1_private_v1_private = m1_im1_private.c1; + var m1_im1_private_v2_private = new m1_im1_private.c1(); + var m1_im1_private_v3_private = m1_im1_private.f1; + var m1_im1_private_v4_private = m1_im1_private.f1(); + + + import m1_im2_private = m1_M2_private; + export var m1_im2_private_v1_public = m1_im2_private.c1; + export var m1_im2_private_v2_public = new m1_im2_private.c1(); + export var m1_im2_private_v3_public = m1_im2_private.f1; + export var m1_im2_private_v4_public = m1_im2_private.f1(); + var m1_im2_private_v1_private = m1_im2_private.c1; + var m1_im2_private_v2_private = new m1_im2_private.c1(); + var m1_im2_private_v3_private = m1_im2_private.f1; + var m1_im2_private_v4_private = m1_im2_private.f1(); + + //import m1_im3_private = require("m1_M3_public"); + //export var m1_im3_private_v1_public = m1_im3_private.c1; + //export var m1_im3_private_v2_public = new m1_im3_private.c1(); + //export var m1_im3_private_v3_public = m1_im3_private.f1; + //export var m1_im3_private_v4_public = m1_im3_private.f1(); + //var m1_im3_private_v1_private = m1_im3_private.c1; + //var m1_im3_private_v2_private = new m1_im3_private.c1(); + //var m1_im3_private_v3_private = m1_im3_private.f1; + //var m1_im3_private_v4_private = m1_im3_private.f1(); + + //import m1_im4_private = require("m1_M4_private"); + //export var m1_im4_private_v1_public = m1_im4_private.c1; + //export var m1_im4_private_v2_public = new m1_im4_private.c1(); + //export var m1_im4_private_v3_public = m1_im4_private.f1; + //export var m1_im4_private_v4_public = m1_im4_private.f1(); + //var m1_im4_private_v1_private = m1_im4_private.c1; + //var m1_im4_private_v2_private = new m1_im4_private.c1(); + //var m1_im4_private_v3_private = m1_im4_private.f1; + //var m1_im4_private_v4_private = m1_im4_private.f1(); + + export import m1_im1_public = m1_M1_public; + export import m1_im2_public = m1_M2_private; + //export import m1_im3_public = require("m1_M3_public"); + //export import m1_im4_public = require("m1_M4_private"); + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module m2_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + module m2_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + //export declare module "m2_M3_public" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + //declare module "m2_M4_private" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + import m1_im1_private = m2_M1_public; + export var m1_im1_private_v1_public = m1_im1_private.c1; + export var m1_im1_private_v2_public = new m1_im1_private.c1(); + export var m1_im1_private_v3_public = m1_im1_private.f1; + export var m1_im1_private_v4_public = m1_im1_private.f1(); + var m1_im1_private_v1_private = m1_im1_private.c1; + var m1_im1_private_v2_private = new m1_im1_private.c1(); + var m1_im1_private_v3_private = m1_im1_private.f1; + var m1_im1_private_v4_private = m1_im1_private.f1(); + + + import m1_im2_private = m2_M2_private; + export var m1_im2_private_v1_public = m1_im2_private.c1; + export var m1_im2_private_v2_public = new m1_im2_private.c1(); + export var m1_im2_private_v3_public = m1_im2_private.f1; + export var m1_im2_private_v4_public = m1_im2_private.f1(); + var m1_im2_private_v1_private = m1_im2_private.c1; + var m1_im2_private_v2_private = new m1_im2_private.c1(); + var m1_im2_private_v3_private = m1_im2_private.f1; + var m1_im2_private_v4_private = m1_im2_private.f1(); + + //import m1_im3_private = require("m2_M3_public"); + //export var m1_im3_private_v1_public = m1_im3_private.c1; + //export var m1_im3_private_v2_public = new m1_im3_private.c1(); + //export var m1_im3_private_v3_public = m1_im3_private.f1; + //export var m1_im3_private_v4_public = m1_im3_private.f1(); + //var m1_im3_private_v1_private = m1_im3_private.c1; + //var m1_im3_private_v2_private = new m1_im3_private.c1(); + //var m1_im3_private_v3_private = m1_im3_private.f1; + //var m1_im3_private_v4_private = m1_im3_private.f1(); + + //import m1_im4_private = require("m2_M4_private"); + //export var m1_im4_private_v1_public = m1_im4_private.c1; + //export var m1_im4_private_v2_public = new m1_im4_private.c1(); + //export var m1_im4_private_v3_public = m1_im4_private.f1; + //export var m1_im4_private_v4_public = m1_im4_private.f1(); + //var m1_im4_private_v1_private = m1_im4_private.c1; + //var m1_im4_private_v2_private = new m1_im4_private.c1(); + //var m1_im4_private_v3_private = m1_im4_private.f1; + //var m1_im4_private_v4_private = m1_im4_private.f1(); + + // Parse error to export module + export import m1_im1_public = m2_M1_public; + export import m1_im2_public = m2_M2_private; + //export import m1_im3_public = require("m2_M3_public"); + //export import m1_im4_public = require("m2_M4_private"); + } + + export module glo_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + //export declare module "glo_M2_public" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + export module glo_M3_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + export function f1() { + return new c1; + } + export var v1 = c1; + export var v2: c1; + } + + //export declare module "glo_M4_private" { + // export function f1(); + // export class c1 { + // } + // export var v1: { new (): c1; }; + // export var v2: c1; + //} + + + import glo_im1_private = glo_M1_public; + export var glo_im1_private_v1_public = glo_im1_private.c1; + export var glo_im1_private_v2_public = new glo_im1_private.c1(); + export var glo_im1_private_v3_public = glo_im1_private.f1; + export var glo_im1_private_v4_public = glo_im1_private.f1(); + var glo_im1_private_v1_private = glo_im1_private.c1; + var glo_im1_private_v2_private = new glo_im1_private.c1(); + var glo_im1_private_v3_private = glo_im1_private.f1; + var glo_im1_private_v4_private = glo_im1_private.f1(); + + + //import glo_im2_private = require("glo_M2_public"); + //export var glo_im2_private_v1_public = glo_im2_private.c1; + //export var glo_im2_private_v2_public = new glo_im2_private.c1(); + //export var glo_im2_private_v3_public = glo_im2_private.f1; + //export var glo_im2_private_v4_public = glo_im2_private.f1(); + //var glo_im2_private_v1_private = glo_im2_private.c1; + //var glo_im2_private_v2_private = new glo_im2_private.c1(); + //var glo_im2_private_v3_private = glo_im2_private.f1; + //var glo_im2_private_v4_private = glo_im2_private.f1(); + + import glo_im3_private = glo_M3_private; + export var glo_im3_private_v1_public = glo_im3_private.c1; + export var glo_im3_private_v2_public = new glo_im3_private.c1(); + export var glo_im3_private_v3_public = glo_im3_private.f1; + export var glo_im3_private_v4_public = glo_im3_private.f1(); + var glo_im3_private_v1_private = glo_im3_private.c1; + var glo_im3_private_v2_private = new glo_im3_private.c1(); + var glo_im3_private_v3_private = glo_im3_private.f1; + var glo_im3_private_v4_private = glo_im3_private.f1(); + + //import glo_im4_private = require("glo_M4_private"); + //export var glo_im4_private_v1_public = glo_im4_private.c1; + //export var glo_im4_private_v2_public = new glo_im4_private.c1(); + //export var glo_im4_private_v3_public = glo_im4_private.f1; + //export var glo_im4_private_v4_public = glo_im4_private.f1(); + //var glo_im4_private_v1_private = glo_im4_private.c1; + //var glo_im4_private_v2_private = new glo_im4_private.c1(); + //var glo_im4_private_v3_private = glo_im4_private.f1; + //var glo_im4_private_v4_private = glo_im4_private.f1(); + + // Parse error to export module + export import glo_im1_public = glo_M1_public; + export import glo_im2_public = glo_M3_private; + //export import glo_im3_public = require("glo_M2_public"); + //export import glo_im4_public = require("glo_M4_private"); + + + //export declare module "use_glo_M1_public" { + // import use_glo_M1_public = glo_M1_public; + // export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; }; + // export var use_glo_M1_public_v2_public: use_glo_M1_public; + // export var use_glo_M1_public_v3_public: () => use_glo_M1_public.c1; + // var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; }; + // var use_glo_M1_public_v2_private: use_glo_M1_public; + // var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1; + + // import use_glo_M2_public = require("glo_M2_public"); + // export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; }; + // export var use_glo_M2_public_v2_public: use_glo_M2_public; + // export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1; + // var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; }; + // var use_glo_M2_public_v2_private: use_glo_M2_public; + // var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1; + + // module m2 { + // import errorImport = require("glo_M2_public"); + // import nonerrorImport = glo_M1_public; + + // module m5 { + // import m5_errorImport = require("glo_M2_public"); + // import m5_nonerrorImport = glo_M1_public; + // } + // } + //} + + + //declare module "use_glo_M3_private" { + // import use_glo_M3_private = glo_M3_private; + // export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; }; + // export var use_glo_M3_private_v2_public: use_glo_M3_private; + // export var use_glo_M3_private_v3_public: () => use_glo_M3_private.c1; + // var use_glo_M3_private_v1_private: { new (): use_glo_M3_private.c1; }; + // var use_glo_M3_private_v2_private: use_glo_M3_private; + // var use_glo_M3_private_v3_private: () => use_glo_M3_private.c1; + + // import use_glo_M4_private = require("glo_M4_private"); + // export var use_glo_M4_private_v1_public: { new (): use_glo_M4_private.c1; }; + // export var use_glo_M4_private_v2_public: use_glo_M4_private; + // export var use_glo_M4_private_v3_public: () => use_glo_M4_private.c1; + // var use_glo_M4_private_v1_private: { new (): use_glo_M4_private.c1; }; + // var use_glo_M4_private_v2_private: use_glo_M4_private; + // var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1; + + // module m2 { + // import errorImport = require("glo_M4_private"); + // import nonerrorImport = glo_M3_private; + + // module m5 { + // import m5_errorImport = require("glo_M4_private"); + // import m5_nonerrorImport = glo_M3_private; + // } + // } + //} + + //declare module "anotherParseError" { + // module m2 { + // declare module "abc" { + // } + // } + + // module m2 { + // module "abc2" { + // } + // } + // module "abc3" { + // } + //} + + //declare export module "anotherParseError2" { + // module m2 { + // declare module "abc" { + // } + // } + + // module m2 { + // module "abc2" { + // } + // } + // module "abc3" { + // } + //} + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //import m3 = require("use_glo_M1_public"); + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a = 10; + //import m2 = require("use_glo_M1_public"); + } + + } + + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + //import m3 = require("use_glo_M1_public"); + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var a = 10; + //import m2 = require("use_glo_M1_public"); + } + + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyImportParseErrors.errors.txt b/tests/baselines/reference/privacyImportParseErrors.errors.txt index 83b3fd5b490..15c039c35f7 100644 --- a/tests/baselines/reference/privacyImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyImportParseErrors.errors.txt @@ -1,3 +1,6 @@ +privacyImportParseErrors.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImportParseErrors.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImportParseErrors.ts(12,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(22,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyImportParseErrors.ts(22,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyImportParseErrors.ts(30,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -7,6 +10,9 @@ privacyImportParseErrors.ts(69,37): error TS1147: Import declarations in a names privacyImportParseErrors.ts(69,37): error TS2307: Cannot find module 'm1_M4_private' or its corresponding type declarations. privacyImportParseErrors.ts(81,43): error TS1147: Import declarations in a namespace cannot reference a module. privacyImportParseErrors.ts(82,43): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(85,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImportParseErrors.ts(86,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyImportParseErrors.ts(96,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(106,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyImportParseErrors.ts(106,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyImportParseErrors.ts(114,20): error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -16,8 +22,10 @@ privacyImportParseErrors.ts(153,37): error TS1147: Import declarations in a name privacyImportParseErrors.ts(153,37): error TS2307: Cannot find module 'm2_M4_private' or its corresponding type declarations. privacyImportParseErrors.ts(166,43): error TS1147: Import declarations in a namespace cannot reference a module. privacyImportParseErrors.ts(167,43): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(170,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(180,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyImportParseErrors.ts(180,23): error TS2664: Invalid module name in augmentation, module 'glo_M2_public' cannot be found. +privacyImportParseErrors.ts(188,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(198,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyImportParseErrors.ts(198,23): error TS2664: Invalid module name in augmentation, module 'glo_M4_private' cannot be found. privacyImportParseErrors.ts(218,34): error TS2307: Cannot find module 'glo_M2_public' or its corresponding type declarations. @@ -29,35 +37,51 @@ privacyImportParseErrors.ts(255,23): error TS2664: Invalid module name in augmen privacyImportParseErrors.ts(258,45): error TS2709: Cannot use namespace 'use_glo_M1_public' as a type. privacyImportParseErrors.ts(261,39): error TS2709: Cannot use namespace 'use_glo_M1_public' as a type. privacyImportParseErrors.ts(264,40): error TS2307: Cannot find module 'glo_M2_public' or its corresponding type declarations. +privacyImportParseErrors.ts(272,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(273,38): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(276,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(277,45): error TS1147: Import declarations in a namespace cannot reference a module. privacyImportParseErrors.ts(284,16): error TS2664: Invalid module name in augmentation, module 'use_glo_M3_private' cannot be found. privacyImportParseErrors.ts(287,46): error TS2709: Cannot use namespace 'use_glo_M3_private' as a type. privacyImportParseErrors.ts(290,40): error TS2709: Cannot use namespace 'use_glo_M3_private' as a type. privacyImportParseErrors.ts(293,41): error TS2307: Cannot find module 'glo_M4_private' or its corresponding type declarations. +privacyImportParseErrors.ts(301,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(302,38): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(305,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(306,45): error TS1147: Import declarations in a namespace cannot reference a module. privacyImportParseErrors.ts(312,16): error TS2664: Invalid module name in augmentation, module 'anotherParseError' cannot be found. +privacyImportParseErrors.ts(313,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(314,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. privacyImportParseErrors.ts(314,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +privacyImportParseErrors.ts(318,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(319,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyImportParseErrors.ts(322,12): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyImportParseErrors.ts(326,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible. privacyImportParseErrors.ts(326,9): error TS1029: 'export' modifier must precede 'declare' modifier. privacyImportParseErrors.ts(326,23): error TS2664: Invalid module name in augmentation, module 'anotherParseError2' cannot be found. +privacyImportParseErrors.ts(327,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(328,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. privacyImportParseErrors.ts(328,24): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +privacyImportParseErrors.ts(332,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(333,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. privacyImportParseErrors.ts(336,12): error TS2435: Ambient modules cannot be nested in other modules or namespaces. +privacyImportParseErrors.ts(340,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(341,25): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(342,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(344,29): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(349,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(350,25): error TS1147: Import declarations in a namespace cannot reference a module. +privacyImportParseErrors.ts(351,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a namespace cannot reference a module. -==== privacyImportParseErrors.ts (55 errors) ==== +==== privacyImportParseErrors.ts (75 errors) ==== export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m1_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -68,6 +92,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m1_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -159,7 +185,11 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export module m2_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -170,6 +200,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m2_M2_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -262,6 +294,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } export module glo_M1_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -284,6 +318,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } export module glo_M3_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class c1 { } export function f1() { @@ -390,12 +426,16 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1; module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import errorImport = require("glo_M2_public"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. import nonerrorImport = glo_M1_public; module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m5_errorImport = require("glo_M2_public"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. @@ -431,12 +471,16 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1; module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import errorImport = require("glo_M4_private"); ~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. import nonerrorImport = glo_M3_private; module m5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m5_errorImport = require("glo_M4_private"); ~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. @@ -449,6 +493,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name ~~~~~~~~~~~~~~~~~~~ !!! error TS2664: Invalid module name in augmentation, module 'anotherParseError' cannot be found. module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare module "abc" { ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -458,6 +504,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module "abc2" { ~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -477,6 +525,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name ~~~~~~~~~~~~~~~~~~~~ !!! error TS2664: Invalid module name in augmentation, module 'anotherParseError2' cannot be found. module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. declare module "abc" { ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -486,6 +536,8 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. module "abc2" { ~~~~~~ !!! error TS2435: Ambient modules cannot be nested in other modules or namespaces. @@ -498,10 +550,14 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m3 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = 10; import m2 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ @@ -511,10 +567,14 @@ privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in a name } export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import m3 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var a = 10; import m2 = require("use_glo_M1_public"); ~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/privacyInterface.errors.txt b/tests/baselines/reference/privacyInterface.errors.txt new file mode 100644 index 00000000000..839701f7eb6 --- /dev/null +++ b/tests/baselines/reference/privacyInterface.errors.txt @@ -0,0 +1,279 @@ +privacyInterface.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyInterface.ts(67,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyInterface.ts(195,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyInterface.ts(220,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyInterface.ts (4 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + + class C2_private { + } + + export interface C3_public { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + + interface C4_private { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + } + + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + + class C2_private { + } + + export interface C3_public { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + + interface C4_private { + (c1: C1_public); + (c1: C2_private); + (): C1_public; + (c2: number): C2_private; + + new (c1: C1_public); + new (c1: C2_private); + new (): C1_public; + new (c2: number): C2_private; + + [c: number]: C1_public; + [c: string]: C2_private; + + x: C1_public; + y: C2_private; + + a?: C1_public; + b?: C2_private; + + f1(a1: C1_public); + f2(a1: C2_private); + f3(): C1_public; + f4(): C2_private; + + } + } + + export class C5_public { + private f1() { + } + } + + + class C6_private { + } + + export interface C7_public { + (c1: C5_public); + (c1: C6_private); + (): C5_public; + (c2: number): C6_private; + + new (c1: C5_public); + new (c1: C6_private); + new (): C5_public; + new (c2: number): C6_private; + + [c: number]: C5_public; + [c: string]: C6_private; + + x: C5_public; + y: C6_private; + + a?: C5_public; + b?: C6_private; + + f1(a1: C5_public); + f2(a1: C6_private); + f3(): C5_public; + f4(): C6_private; + + } + + interface C8_private { + (c1: C5_public); + (c1: C6_private); + (): C5_public; + (c2: number): C6_private; + + new (c1: C5_public); + new (c1: C6_private); + new (): C5_public; + new (c2: number): C6_private; + + [c: number]: C5_public; + [c: string]: C6_private; + + x: C5_public; + y: C6_private; + + a?: C5_public; + b?: C6_private; + + f1(a1: C5_public); + f2(a1: C6_private); + f3(): C5_public; + f4(): C6_private; + + } + + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m3_i_public { + f1(): number; + } + + interface m3_i_private { + f2(): string; + } + + interface m3_C1_private extends m3_i_public { + } + interface m3_C2_private extends m3_i_private { + } + export interface m3_C3_public extends m3_i_public { + } + export interface m3_C4_public extends m3_i_private { + } + + interface m3_C5_private extends m3_i_private, m3_i_public { + } + export interface m3_C6_public extends m3_i_private, m3_i_public { + } + } + + + module m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface m4_i_public { + f1(): number; + } + + interface m4_i_private { + f2(): string; + } + + interface m4_C1_private extends m4_i_public { + } + interface m4_C2_private extends m4_i_private { + } + export interface m4_C3_public extends m4_i_public { + } + export interface m4_C4_public extends m4_i_private { + } + + interface m4_C5_private extends m4_i_private, m4_i_public { + } + export interface m4_C6_public extends m4_i_private, m4_i_public { + } + } + + export interface glo_i_public { + f1(): number; + } + + interface glo_i_private { + f2(): string; + } + + interface glo_C1_private extends glo_i_public { + } + interface glo_C2_private extends glo_i_private { + } + export interface glo_C3_public extends glo_i_public { + } + export interface glo_C4_public extends glo_i_private { + } + + interface glo_C5_private extends glo_i_private, glo_i_public { + } + export interface glo_C6_public extends glo_i_private, glo_i_public { + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt new file mode 100644 index 00000000000..ad522f57e0f --- /dev/null +++ b/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt @@ -0,0 +1,103 @@ +privacyInterfaceExtendsClauseDeclFile_GlobalFile.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyInterfaceExtendsClauseDeclFile_externalModule.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyInterfaceExtendsClauseDeclFile_externalModule.ts(26,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyInterfaceExtendsClauseDeclFile_externalModule.ts (2 errors) ==== + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPublicModule { + } + + interface privateInterfaceInPublicModule { + } + + interface privateInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPublicModule { + } + interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { + } + export interface publicInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPublicModule { + } + export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { // Should error + } + + interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { + } + export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { // Should error + } + + export interface publicInterfaceImplementingPrivateAndPublicInterface extends privateInterfaceInPublicModule, publicInterfaceInPublicModule { // Should error + } + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPrivateModule { + + } + + interface privateInterfaceInPrivateModule { + } + + interface privateInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPrivateModule { + } + interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPrivateModule { + } + export interface publicInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPrivateModule { + } + export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPrivateModule { + } + + interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { + } + export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { + } + } + + export interface publicInterface { + + } + + interface privateInterface { + } + + interface privateInterfaceImplementingPublicInterface extends publicInterface { + } + interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterface { + } + export interface publicInterfaceImplementingPublicInterface extends publicInterface { + } + export interface publicInterfaceImplementingPrivateInterface extends privateInterface { // Should error + } + + interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { + } + export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { // Should error + } + +==== privacyInterfaceExtendsClauseDeclFile_GlobalFile.ts (1 errors) ==== + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface publicInterfaceInPublicModule { + } + + interface privateInterfaceInPublicModule { + } + + interface privateInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPublicModule { + } + interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { + } + export interface publicInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPublicModule { + } + export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { // Should error + } + } + interface publicInterfaceInGlobal { + } + interface publicInterfaceImplementingPublicInterfaceInGlobal extends publicInterfaceInGlobal { + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.errors.txt b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.errors.txt new file mode 100644 index 00000000000..a1696cb1020 --- /dev/null +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.errors.txt @@ -0,0 +1,179 @@ +privacyLocalInternalReferenceImportWithExport.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(15,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(39,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(43,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(49,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithExport.ts(102,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyLocalInternalReferenceImportWithExport.ts (8 errors) ==== + // private elements + module m_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_private { + } + export enum e_private { + Happy, + Grumpy + } + export function f_private() { + return new c_private(); + } + export var v_private = new c_private(); + export interface i_private { + } + export module mi_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // Public elements + export module m_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_public { + } + export enum e_public { + Happy, + Grumpy + } + export function f_public() { + return new c_public(); + } + export var v_public = 10; + export interface i_public { + } + export module mi_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + export module import_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // Privacy errors - importing private elements + export import im_public_c_private = m_private.c_private; + export import im_public_e_private = m_private.e_private; + export import im_public_f_private = m_private.f_private; + export import im_public_v_private = m_private.v_private; + export import im_public_i_private = m_private.i_private; + export import im_public_mi_private = m_private.mi_private; + export import im_public_mu_private = m_private.mu_private; + + // Usage of privacy error imports + var privateUse_im_public_c_private = new im_public_c_private(); + export var publicUse_im_public_c_private = new im_public_c_private(); + var privateUse_im_public_e_private = im_public_e_private.Happy; + export var publicUse_im_public_e_private = im_public_e_private.Grumpy; + var privateUse_im_public_f_private = im_public_f_private(); + export var publicUse_im_public_f_private = im_public_f_private(); + var privateUse_im_public_v_private = im_public_v_private; + export var publicUse_im_public_v_private = im_public_v_private; + var privateUse_im_public_i_private: im_public_i_private; + export var publicUse_im_public_i_private: im_public_i_private; + var privateUse_im_public_mi_private = new im_public_mi_private.c(); + export var publicUse_im_public_mi_private = new im_public_mi_private.c(); + var privateUse_im_public_mu_private: im_public_mu_private.i; + export var publicUse_im_public_mu_private: im_public_mu_private.i; + + + // No Privacy errors - importing public elements + export import im_public_c_public = m_public.c_public; + export import im_public_e_public = m_public.e_public; + export import im_public_f_public = m_public.f_public; + export import im_public_v_public = m_public.v_public; + export import im_public_i_public = m_public.i_public; + export import im_public_mi_public = m_public.mi_public; + export import im_public_mu_public = m_public.mu_public; + + // Usage of above + var privateUse_im_public_c_public = new im_public_c_public(); + export var publicUse_im_public_c_public = new im_public_c_public(); + var privateUse_im_public_e_public = im_public_e_public.Happy; + export var publicUse_im_public_e_public = im_public_e_public.Grumpy; + var privateUse_im_public_f_public = im_public_f_public(); + export var publicUse_im_public_f_public = im_public_f_public(); + var privateUse_im_public_v_public = im_public_v_public; + export var publicUse_im_public_v_public = im_public_v_public; + var privateUse_im_public_i_public: im_public_i_public; + export var publicUse_im_public_i_public: im_public_i_public; + var privateUse_im_public_mi_public = new im_public_mi_public.c(); + export var publicUse_im_public_mi_public = new im_public_mi_public.c(); + var privateUse_im_public_mu_public: im_public_mu_public.i; + export var publicUse_im_public_mu_public: im_public_mu_public.i; + } + + module import_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // No Privacy errors - importing private elements + export import im_private_c_private = m_private.c_private; + export import im_private_e_private = m_private.e_private; + export import im_private_f_private = m_private.f_private; + export import im_private_v_private = m_private.v_private; + export import im_private_i_private = m_private.i_private; + export import im_private_mi_private = m_private.mi_private; + export import im_private_mu_private = m_private.mu_private; + + // Usage of above decls + var privateUse_im_private_c_private = new im_private_c_private(); + export var publicUse_im_private_c_private = new im_private_c_private(); + var privateUse_im_private_e_private = im_private_e_private.Happy; + export var publicUse_im_private_e_private = im_private_e_private.Grumpy; + var privateUse_im_private_f_private = im_private_f_private(); + export var publicUse_im_private_f_private = im_private_f_private(); + var privateUse_im_private_v_private = im_private_v_private; + export var publicUse_im_private_v_private = im_private_v_private; + var privateUse_im_private_i_private: im_private_i_private; + export var publicUse_im_private_i_private: im_private_i_private; + var privateUse_im_private_mi_private = new im_private_mi_private.c(); + export var publicUse_im_private_mi_private = new im_private_mi_private.c(); + var privateUse_im_private_mu_private: im_private_mu_private.i; + export var publicUse_im_private_mu_private: im_private_mu_private.i; + + // No privacy Error - importing public elements + export import im_private_c_public = m_public.c_public; + export import im_private_e_public = m_public.e_public; + export import im_private_f_public = m_public.f_public; + export import im_private_v_public = m_public.v_public; + export import im_private_i_public = m_public.i_public; + export import im_private_mi_public = m_public.mi_public; + export import im_private_mu_public = m_public.mu_public; + + // Usage of no privacy error imports + var privateUse_im_private_c_public = new im_private_c_public(); + export var publicUse_im_private_c_public = new im_private_c_public(); + var privateUse_im_private_e_public = im_private_e_public.Happy; + export var publicUse_im_private_e_public = im_private_e_public.Grumpy; + var privateUse_im_private_f_public = im_private_f_public(); + export var publicUse_im_private_f_public = im_private_f_public(); + var privateUse_im_private_v_public = im_private_v_public; + export var publicUse_im_private_v_public = im_private_v_public; + var privateUse_im_private_i_public: im_private_i_public; + export var publicUse_im_private_i_public: im_private_i_public; + var privateUse_im_private_mi_public = new im_private_mi_public.c(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c(); + var privateUse_im_private_mu_public: im_private_mu_public.i; + export var publicUse_im_private_mu_public: im_private_mu_public.i; + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.errors.txt b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.errors.txt new file mode 100644 index 00000000000..25c88377bab --- /dev/null +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.errors.txt @@ -0,0 +1,179 @@ +privacyLocalInternalReferenceImportWithoutExport.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(15,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(39,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(43,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(49,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyLocalInternalReferenceImportWithoutExport.ts(102,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyLocalInternalReferenceImportWithoutExport.ts (8 errors) ==== + // private elements + module m_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_private { + } + export enum e_private { + Happy, + Grumpy + } + export function f_private() { + return new c_private(); + } + export var v_private = new c_private(); + export interface i_private { + } + export module mi_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // Public elements + export module m_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_public { + } + export enum e_public { + Happy, + Grumpy + } + export function f_public() { + return new c_public(); + } + export var v_public = 10; + export interface i_public { + } + export module mi_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + export module import_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // No Privacy errors - importing private elements + import im_private_c_private = m_private.c_private; + import im_private_e_private = m_private.e_private; + import im_private_f_private = m_private.f_private; + import im_private_v_private = m_private.v_private; + import im_private_i_private = m_private.i_private; + import im_private_mi_private = m_private.mi_private; + import im_private_mu_private = m_private.mu_private; + + // Usage of above decls + var privateUse_im_private_c_private = new im_private_c_private(); + export var publicUse_im_private_c_private = new im_private_c_private(); + var privateUse_im_private_e_private = im_private_e_private.Happy; + export var publicUse_im_private_e_private = im_private_e_private.Grumpy; + var privateUse_im_private_f_private = im_private_f_private(); + export var publicUse_im_private_f_private = im_private_f_private(); + var privateUse_im_private_v_private = im_private_v_private; + export var publicUse_im_private_v_private = im_private_v_private; + var privateUse_im_private_i_private: im_private_i_private; + export var publicUse_im_private_i_private: im_private_i_private; + var privateUse_im_private_mi_private = new im_private_mi_private.c(); + export var publicUse_im_private_mi_private = new im_private_mi_private.c(); + var privateUse_im_private_mu_private: im_private_mu_private.i; + export var publicUse_im_private_mu_private: im_private_mu_private.i; + + + // No Privacy errors - importing public elements + import im_private_c_public = m_public.c_public; + import im_private_e_public = m_public.e_public; + import im_private_f_public = m_public.f_public; + import im_private_v_public = m_public.v_public; + import im_private_i_public = m_public.i_public; + import im_private_mi_public = m_public.mi_public; + import im_private_mu_public = m_public.mu_public; + + // Usage of above decls + var privateUse_im_private_c_public = new im_private_c_public(); + export var publicUse_im_private_c_public = new im_private_c_public(); + var privateUse_im_private_e_public = im_private_e_public.Happy; + export var publicUse_im_private_e_public = im_private_e_public.Grumpy; + var privateUse_im_private_f_public = im_private_f_public(); + export var publicUse_im_private_f_public = im_private_f_public(); + var privateUse_im_private_v_public = im_private_v_public; + export var publicUse_im_private_v_public = im_private_v_public; + var privateUse_im_private_i_public: im_private_i_public; + export var publicUse_im_private_i_public: im_private_i_public; + var privateUse_im_private_mi_public = new im_private_mi_public.c(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c(); + var privateUse_im_private_mu_public: im_private_mu_public.i; + export var publicUse_im_private_mu_public: im_private_mu_public.i; + } + + module import_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // No Privacy errors - importing private elements + import im_private_c_private = m_private.c_private; + import im_private_e_private = m_private.e_private; + import im_private_f_private = m_private.f_private; + import im_private_v_private = m_private.v_private; + import im_private_i_private = m_private.i_private; + import im_private_mi_private = m_private.mi_private; + import im_private_mu_private = m_private.mu_private; + + // Usage of above decls + var privateUse_im_private_c_private = new im_private_c_private(); + export var publicUse_im_private_c_private = new im_private_c_private(); + var privateUse_im_private_e_private = im_private_e_private.Happy; + export var publicUse_im_private_e_private = im_private_e_private.Grumpy; + var privateUse_im_private_f_private = im_private_f_private(); + export var publicUse_im_private_f_private = im_private_f_private(); + var privateUse_im_private_v_private = im_private_v_private; + export var publicUse_im_private_v_private = im_private_v_private; + var privateUse_im_private_i_private: im_private_i_private; + export var publicUse_im_private_i_private: im_private_i_private; + var privateUse_im_private_mi_private = new im_private_mi_private.c(); + export var publicUse_im_private_mi_private = new im_private_mi_private.c(); + var privateUse_im_private_mu_private: im_private_mu_private.i; + export var publicUse_im_private_mu_private: im_private_mu_private.i; + + // No privacy Error - importing public elements + import im_private_c_public = m_public.c_public; + import im_private_e_public = m_public.e_public; + import im_private_f_public = m_public.f_public; + import im_private_v_public = m_public.v_public; + import im_private_i_public = m_public.i_public; + import im_private_mi_public = m_public.mi_public; + import im_private_mu_public = m_public.mu_public; + + // Usage of above decls + var privateUse_im_private_c_public = new im_private_c_public(); + export var publicUse_im_private_c_public = new im_private_c_public(); + var privateUse_im_private_e_public = im_private_e_public.Happy; + export var publicUse_im_private_e_public = im_private_e_public.Grumpy; + var privateUse_im_private_f_public = im_private_f_public(); + export var publicUse_im_private_f_public = im_private_f_public(); + var privateUse_im_private_v_public = im_private_v_public; + export var publicUse_im_private_v_public = im_private_v_public; + var privateUse_im_private_i_public: im_private_i_public; + export var publicUse_im_private_i_public: im_private_i_public; + var privateUse_im_private_mi_public = new im_private_mi_public.c(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c(); + var privateUse_im_private_mu_public: im_private_mu_public.i; + export var publicUse_im_private_mu_public: im_private_mu_public.i; + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.errors.txt b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.errors.txt new file mode 100644 index 00000000000..2502b7a6079 --- /dev/null +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.errors.txt @@ -0,0 +1,120 @@ +privacyTopLevelInternalReferenceImportWithExport.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithExport.ts(15,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithExport.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithExport.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithExport.ts(39,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithExport.ts(43,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyTopLevelInternalReferenceImportWithExport.ts (6 errors) ==== + // private elements + module m_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_private { + } + export enum e_private { + Happy, + Grumpy + } + export function f_private() { + return new c_private(); + } + export var v_private = new c_private(); + export interface i_private { + } + export module mi_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // Public elements + export module m_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_public { + } + export enum e_public { + Happy, + Grumpy + } + export function f_public() { + return new c_public(); + } + export var v_public = 10; + export interface i_public { + } + export module mi_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // Privacy errors - importing private elements + export import im_public_c_private = m_private.c_private; + export import im_public_e_private = m_private.e_private; + export import im_public_f_private = m_private.f_private; + export import im_public_v_private = m_private.v_private; + export import im_public_i_private = m_private.i_private; + export import im_public_mi_private = m_private.mi_private; + export import im_public_mu_private = m_private.mu_private; + + // Usage of privacy error imports + var privateUse_im_public_c_private = new im_public_c_private(); + export var publicUse_im_public_c_private = new im_public_c_private(); + var privateUse_im_public_e_private = im_public_e_private.Happy; + export var publicUse_im_public_e_private = im_public_e_private.Grumpy; + var privateUse_im_public_f_private = im_public_f_private(); + export var publicUse_im_public_f_private = im_public_f_private(); + var privateUse_im_public_v_private = im_public_v_private; + export var publicUse_im_public_v_private = im_public_v_private; + var privateUse_im_public_i_private: im_public_i_private; + export var publicUse_im_public_i_private: im_public_i_private; + var privateUse_im_public_mi_private = new im_public_mi_private.c(); + export var publicUse_im_public_mi_private = new im_public_mi_private.c(); + var privateUse_im_public_mu_private: im_public_mu_private.i; + export var publicUse_im_public_mu_private: im_public_mu_private.i; + + + // No Privacy errors - importing public elements + export import im_public_c_public = m_public.c_public; + export import im_public_e_public = m_public.e_public; + export import im_public_f_public = m_public.f_public; + export import im_public_v_public = m_public.v_public; + export import im_public_i_public = m_public.i_public; + export import im_public_mi_public = m_public.mi_public; + export import im_public_mu_public = m_public.mu_public; + + // Usage of above decls + var privateUse_im_public_c_public = new im_public_c_public(); + export var publicUse_im_public_c_public = new im_public_c_public(); + var privateUse_im_public_e_public = im_public_e_public.Happy; + export var publicUse_im_public_e_public = im_public_e_public.Grumpy; + var privateUse_im_public_f_public = im_public_f_public(); + export var publicUse_im_public_f_public = im_public_f_public(); + var privateUse_im_public_v_public = im_public_v_public; + export var publicUse_im_public_v_public = im_public_v_public; + var privateUse_im_public_i_public: im_public_i_public; + export var publicUse_im_public_i_public: im_public_i_public; + var privateUse_im_public_mi_public = new im_public_mi_public.c(); + export var publicUse_im_public_mi_public = new im_public_mi_public.c(); + var privateUse_im_public_mu_public: im_public_mu_public.i; + export var publicUse_im_public_mu_public: im_public_mu_public.i; + \ No newline at end of file diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.errors.txt b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.errors.txt new file mode 100644 index 00000000000..6e2a7d4bd0a --- /dev/null +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.errors.txt @@ -0,0 +1,120 @@ +privacyTopLevelInternalReferenceImportWithoutExport.ts(2,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithoutExport.ts(15,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithoutExport.ts(19,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithoutExport.ts(26,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithoutExport.ts(39,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTopLevelInternalReferenceImportWithoutExport.ts(43,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyTopLevelInternalReferenceImportWithoutExport.ts (6 errors) ==== + // private elements + module m_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_private { + } + export enum e_private { + Happy, + Grumpy + } + export function f_private() { + return new c_private(); + } + export var v_private = new c_private(); + export interface i_private { + } + export module mi_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_private { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // Public elements + export module m_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c_public { + } + export enum e_public { + Happy, + Grumpy + } + export function f_public() { + return new c_public(); + } + export var v_public = 10; + export interface i_public { + } + export module mi_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c { + } + } + export module mu_public { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface i { + } + } + } + + // No Privacy errors - importing private elements + import im_private_c_private = m_private.c_private; + import im_private_e_private = m_private.e_private; + import im_private_f_private = m_private.f_private; + import im_private_v_private = m_private.v_private; + import im_private_i_private = m_private.i_private; + import im_private_mi_private = m_private.mi_private; + import im_private_mu_private = m_private.mu_private; + + // Usage of above decls + var privateUse_im_private_c_private = new im_private_c_private(); + export var publicUse_im_private_c_private = new im_private_c_private(); + var privateUse_im_private_e_private = im_private_e_private.Happy; + export var publicUse_im_private_e_private = im_private_e_private.Grumpy; + var privateUse_im_private_f_private = im_private_f_private(); + export var publicUse_im_private_f_private = im_private_f_private(); + var privateUse_im_private_v_private = im_private_v_private; + export var publicUse_im_private_v_private = im_private_v_private; + var privateUse_im_private_i_private: im_private_i_private; + export var publicUse_im_private_i_private: im_private_i_private; + var privateUse_im_private_mi_private = new im_private_mi_private.c(); + export var publicUse_im_private_mi_private = new im_private_mi_private.c(); + var privateUse_im_private_mu_private: im_private_mu_private.i; + export var publicUse_im_private_mu_private: im_private_mu_private.i; + + + // No Privacy errors - importing public elements + import im_private_c_public = m_public.c_public; + import im_private_e_public = m_public.e_public; + import im_private_f_public = m_public.f_public; + import im_private_v_public = m_public.v_public; + import im_private_i_public = m_public.i_public; + import im_private_mi_public = m_public.mi_public; + import im_private_mu_public = m_public.mu_public; + + // Usage of above decls + var privateUse_im_private_c_public = new im_private_c_public(); + export var publicUse_im_private_c_public = new im_private_c_public(); + var privateUse_im_private_e_public = im_private_e_public.Happy; + export var publicUse_im_private_e_public = im_private_e_public.Grumpy; + var privateUse_im_private_f_public = im_private_f_public(); + export var publicUse_im_private_f_public = im_private_f_public(); + var privateUse_im_private_v_public = im_private_v_public; + export var publicUse_im_private_v_public = im_private_v_public; + var privateUse_im_private_i_public: im_private_i_public; + export var publicUse_im_private_i_public: im_private_i_public; + var privateUse_im_private_mi_public = new im_private_mi_public.c(); + export var publicUse_im_private_mi_public = new im_private_mi_public.c(); + var privateUse_im_private_mu_public: im_private_mu_public.i; + export var publicUse_im_private_mu_public: im_private_mu_public.i; + \ No newline at end of file diff --git a/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt new file mode 100644 index 00000000000..c14ee1f8c2d --- /dev/null +++ b/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt @@ -0,0 +1,447 @@ +privacyTypeParameterOfFunctionDeclFile.ts(156,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTypeParameterOfFunctionDeclFile.ts(313,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyTypeParameterOfFunctionDeclFile.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateTypeParameters { + new (): privateClass; // Error + (): privateClass; // Error + myMethod(): privateClass; // Error + } + + export interface publicInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateTypeParameters { + new (): privateClass; + (): privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { // Error + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { // Error + } + private myPrivateMethod() { + } + } + + export class publicClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPrivateTypeParameters() { // Error + } + + export function publicFunctionWithPublicTypeParameters() { + } + + function privateFunctionWithPrivateTypeParameters() { + } + + function privateFunctionWithPublicTypeParameters() { + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + class privateClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPublicTypeParametersWithoutExtends() { + } + + function privateFunctionWithPublicTypeParametersWithoutExtends() { + } + + export interface publicInterfaceWithPrivatModuleTypeParameters { + new (): privateModule.publicClass; // Error + (): privateModule.publicClass; // Error + myMethod(): privateModule.publicClass; // Error + } + export class publicClassWithWithPrivateModuleTypeParameters { + static myPublicStaticMethod() { // Error + } + myPublicMethod() { // Error + } + } + export function publicFunctionWithPrivateMopduleTypeParameters() { // Error + } + + + interface privateInterfaceWithPrivatModuleTypeParameters { + new (): privateModule.publicClass; + (): privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithWithPrivateModuleTypeParameters { + static myPublicStaticMethod() { + } + myPublicMethod() { + } + } + function privateFunctionWithPrivateMopduleTypeParameters() { + } + + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateTypeParameters { + new (): privateClass; // Error + (): privateClass; // Error + myMethod(): privateClass; // Error + } + + export interface publicInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateTypeParameters { + new (): privateClass; + (): privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { // Error + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { // Error + } + private myPrivateMethod() { + } + } + + export class publicClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPrivateTypeParameters() { // Error + } + + export function publicFunctionWithPublicTypeParameters() { + } + + function privateFunctionWithPrivateTypeParameters() { + } + + function privateFunctionWithPublicTypeParameters() { + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + class privateClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPublicTypeParametersWithoutExtends() { + } + + function privateFunctionWithPublicTypeParametersWithoutExtends() { + } + + export interface publicInterfaceWithPrivatModuleTypeParameters { + new (): privateModule.publicClass; // Error + (): privateModule.publicClass; // Error + myMethod(): privateModule.publicClass; // Error + } + export class publicClassWithWithPrivateModuleTypeParameters { + static myPublicStaticMethod() { // Error + } + myPublicMethod() { // Error + } + } + export function publicFunctionWithPrivateMopduleTypeParameters() { // Error + } + + + interface privateInterfaceWithPrivatModuleTypeParameters { + new (): privateModule.publicClass; + (): privateModule.publicClass; + myMethod(): privateModule.publicClass; + } + class privateClassWithWithPrivateModuleTypeParameters { + static myPublicStaticMethod() { + } + myPublicMethod() { + } + } + function privateFunctionWithPrivateMopduleTypeParameters() { + } + + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivateTypeParameters { + new (): privateClass; + (): privateClass; + myMethod(): privateClass; + } + + export interface publicInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPrivateTypeParameters { + new (): privateClass; + (): privateClass; + myMethod(): privateClass; + } + + interface privateInterfaceWithPublicTypeParameters { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export class publicClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPrivateTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + class privateClassWithWithPublicTypeParameters { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPrivateTypeParameters() { + } + + export function publicFunctionWithPublicTypeParameters() { + } + + function privateFunctionWithPrivateTypeParameters() { + } + + function privateFunctionWithPublicTypeParameters() { + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + new (): publicClass; + (): publicClass; + myMethod(): publicClass; + } + + export class publicClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + class privateClassWithWithPublicTypeParametersWithoutExtends { + static myPublicStaticMethod() { + } + private static myPrivateStaticMethod() { + } + myPublicMethod() { + } + private myPrivateMethod() { + } + } + + export function publicFunctionWithPublicTypeParametersWithoutExtends() { + } + + function privateFunctionWithPublicTypeParametersWithoutExtends() { + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt new file mode 100644 index 00000000000..d83326876f3 --- /dev/null +++ b/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt @@ -0,0 +1,163 @@ +privacyTypeParametersOfClassDeclFile.ts(55,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTypeParametersOfClassDeclFile.ts(111,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyTypeParametersOfClassDeclFile.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export class publicClassWithPrivateTypeParameters { // Error + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPrivateTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithTypeParametersFromPrivateModule { // Error + myMethod(val: T): T { + return val; + } + } + + class privateClassWithTypeParametersFromPrivateModule { + myMethod(val: T): T { + return val; + } + } + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClassInPublicModule { + } + + export class publicClassInPublicModule { + } + + export class publicClassWithPrivateTypeParameters { // Error + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPrivateTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithTypeParametersFromPrivateModule { // Error + myMethod(val: T): T { + return val; + } + } + + class privateClassWithTypeParametersFromPrivateModule { + myMethod(val: T): T { + return val; + } + } + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClassInPrivateModule { + } + + export class publicClassInPrivateModule { + } + + export class publicClassWithPrivateTypeParameters { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPrivateTypeParameters { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParameters { + myMethod(val: T): T { + return val; + } + } + + export class publicClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + + class privateClassWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T { + return val; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt new file mode 100644 index 00000000000..2d86b707d82 --- /dev/null +++ b/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt @@ -0,0 +1,199 @@ +privacyTypeParametersOfInterfaceDeclFile.ts(66,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyTypeParametersOfInterfaceDeclFile.ts(132,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyTypeParametersOfInterfaceDeclFile.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + class privateClassT { + } + + export class publicClassT { + } + + export interface publicInterfaceWithPrivateTypeParameters { // Error + myMethod(val: T): T; + myMethod0(): publicClassT; + myMethod1(): privateClassT; + myMethod2(): privateClassT; + myMethod3(): publicClassT; + myMethod4(): publicClassT; + } + + export interface publicInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassT + myMethod1(): privateClassT; + myMethod2(): privateClassT; + myMethod3(): publicClassT; + myMethod4(): publicClassT; + } + + interface privateInterfaceWithPrivateTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassT; + myMethod1(): privateClassT; + myMethod2(): privateClassT; + myMethod3(): publicClassT; + myMethod4(): publicClassT; + } + + interface privateInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassT; + myMethod1(): privateClassT; + myMethod2(): privateClassT; + myMethod3(): publicClassT; + myMethod4(): publicClassT; + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassT; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassT; + } + + + export interface publicInterfaceWithPrivateModuleTypeParameterConstraints { // Error + } + + interface privateInterfaceWithPrivateModuleTypeParameterConstraints { // Error + } + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClassInPublicModule { + } + + export class publicClassInPublicModule { + } + + class privateClassInPublicModuleT { + } + + export class publicClassInPublicModuleT { + } + + export interface publicInterfaceWithPrivateTypeParameters { // Error + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT; + myMethod1(): privateClassInPublicModuleT; + myMethod2(): privateClassInPublicModuleT; + myMethod3(): publicClassInPublicModuleT; + myMethod4(): publicClassInPublicModuleT; + } + + export interface publicInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT + myMethod1(): privateClassInPublicModuleT; + myMethod2(): privateClassInPublicModuleT; + myMethod3(): publicClassInPublicModuleT; + myMethod4(): publicClassInPublicModuleT; + } + + interface privateInterfaceWithPrivateTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT; + myMethod1(): privateClassInPublicModuleT; + myMethod2(): privateClassInPublicModuleT; + myMethod3(): publicClassInPublicModuleT; + myMethod4(): publicClassInPublicModuleT; + } + + interface privateInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT; + myMethod1(): privateClassInPublicModuleT; + myMethod2(): privateClassInPublicModuleT; + myMethod3(): publicClassInPublicModuleT; + myMethod4(): publicClassInPublicModuleT; + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassInPublicModuleT; + } + + export interface publicInterfaceWithPrivateModuleTypeParameterConstraints { // Error + } + + interface privateInterfaceWithPrivateModuleTypeParameterConstraints { // Error + } + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClassInPrivateModule { + } + + export class publicClassInPrivateModule { + } + + class privateClassInPrivateModuleT { + } + + export class publicClassInPrivateModuleT { + } + + export interface publicInterfaceWithPrivateTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT; + myMethod1(): privateClassInPrivateModuleT; + myMethod2(): privateClassInPrivateModuleT; + myMethod3(): publicClassInPrivateModuleT; + myMethod4(): publicClassInPrivateModuleT; + } + + export interface publicInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT + myMethod1(): privateClassInPrivateModuleT; + myMethod2(): privateClassInPrivateModuleT; + myMethod3(): publicClassInPrivateModuleT; + myMethod4(): publicClassInPrivateModuleT; + } + + interface privateInterfaceWithPrivateTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT; + myMethod1(): privateClassInPrivateModuleT; + myMethod2(): privateClassInPrivateModuleT; + myMethod3(): publicClassInPrivateModuleT; + myMethod4(): publicClassInPrivateModuleT; + } + + interface privateInterfaceWithPublicTypeParameters { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT; + myMethod1(): privateClassInPrivateModuleT; + myMethod2(): privateClassInPrivateModuleT; + myMethod3(): publicClassInPrivateModuleT; + myMethod4(): publicClassInPrivateModuleT; + } + + export interface publicInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT; + } + + interface privateInterfaceWithPublicTypeParametersWithoutExtends { + myMethod(val: T): T; + myMethod0(): publicClassInPrivateModuleT; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/privacyVar.errors.txt b/tests/baselines/reference/privacyVar.errors.txt new file mode 100644 index 00000000000..e94bff7eb3f --- /dev/null +++ b/tests/baselines/reference/privacyVar.errors.txt @@ -0,0 +1,183 @@ +privacyVar.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyVar.ts(60,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyVar.ts (2 errors) ==== + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C1_public { + private f1() { + } + } + + class C2_private { + } + + export class C3_public { + private C3_v1_private: C1_public; + public C3_v2_public: C1_public; + private C3_v3_private: C2_private; + public C3_v4_public: C2_private; // error + + private C3_v11_private = new C1_public(); + public C3_v12_public = new C1_public(); + private C3_v13_private = new C2_private(); + public C3_v14_public = new C2_private(); // error + + private C3_v21_private: C1_public = new C1_public(); + public C3_v22_public: C1_public = new C1_public(); + private C3_v23_private: C2_private = new C2_private(); + public C3_v24_public: C2_private = new C2_private(); // error + } + + class C4_public { + private C4_v1_private: C1_public; + public C4_v2_public: C1_public; + private C4_v3_private: C2_private; + public C4_v4_public: C2_private; + + private C4_v11_private = new C1_public(); + public C4_v12_public = new C1_public(); + private C4_v13_private = new C2_private(); + public C4_v14_public = new C2_private(); + + private C4_v21_private: C1_public = new C1_public(); + public C4_v22_public: C1_public = new C1_public(); + private C4_v23_private: C2_private = new C2_private(); + public C4_v24_public: C2_private = new C2_private(); + } + + var m1_v1_private: C1_public; + export var m1_v2_public: C1_public; + var m1_v3_private: C2_private; + export var m1_v4_public: C2_private; // error + + var m1_v11_private = new C1_public(); + export var m1_v12_public = new C1_public(); + var m1_v13_private = new C2_private(); + export var m1_v14_public = new C2_private(); //error + + var m1_v21_private: C1_public = new C1_public(); + export var m1_v22_public: C1_public = new C1_public(); + var m1_v23_private: C2_private = new C2_private(); + export var m1_v24_public: C2_private = new C2_private(); // error + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class m2_C1_public { + private f1() { + } + } + + class m2_C2_private { + } + + export class m2_C3_public { + private m2_C3_v1_private: m2_C1_public; + public m2_C3_v2_public: m2_C1_public; + private m2_C3_v3_private: m2_C2_private; + public m2_C3_v4_public: m2_C2_private; + + private m2_C3_v11_private = new m2_C1_public(); + public m2_C3_v12_public = new m2_C1_public(); + private m2_C3_v13_private = new m2_C2_private(); + public m2_C3_v14_public = new m2_C2_private(); + + private m2_C3_v21_private: m2_C1_public = new m2_C1_public(); + public m2_C3_v22_public: m2_C1_public = new m2_C1_public(); + private m2_C3_v23_private: m2_C2_private = new m2_C2_private(); + public m2_C3_v24_public: m2_C2_private = new m2_C2_private(); + } + + class m2_C4_public { + private m2_C4_v1_private: m2_C1_public; + public m2_C4_v2_public: m2_C1_public; + private m2_C4_v3_private: m2_C2_private; + public m2_C4_v4_public: m2_C2_private; + + private m2_C4_v11_private = new m2_C1_public(); + public m2_C4_v12_public = new m2_C1_public(); + private m2_C4_v13_private = new m2_C2_private(); + public m2_C4_v14_public = new m2_C2_private(); + + private m2_C4_v21_private: m2_C1_public = new m2_C1_public(); + public m2_C4_v22_public: m2_C1_public = new m2_C1_public(); + private m2_C4_v23_private: m2_C2_private = new m2_C2_private(); + public m2_C4_v24_public: m2_C2_private = new m2_C2_private(); + } + + var m2_v1_private: m2_C1_public; + export var m2_v2_public: m2_C1_public; + var m2_v3_private: m2_C2_private; + export var m2_v4_public: m2_C2_private; + + var m2_v11_private = new m2_C1_public(); + export var m2_v12_public = new m2_C1_public(); + var m2_v13_private = new m2_C2_private(); + export var m2_v14_public = new m2_C2_private(); + + var m2_v21_private: m2_C1_public = new m2_C1_public(); + export var m2_v22_public: m2_C1_public = new m2_C1_public(); + var m2_v23_private: m2_C2_private = new m2_C2_private(); + export var m2_v24_public: m2_C2_private = new m2_C2_private(); + } + + export class glo_C1_public { + private f1() { + } + } + + class glo_C2_private { + } + + export class glo_C3_public { + private glo_C3_v1_private: glo_C1_public; + public glo_C3_v2_public: glo_C1_public; + private glo_C3_v3_private: glo_C2_private; + public glo_C3_v4_public: glo_C2_private; //error + + private glo_C3_v11_private = new glo_C1_public(); + public glo_C3_v12_public = new glo_C1_public(); + private glo_C3_v13_private = new glo_C2_private(); + public glo_C3_v14_public = new glo_C2_private(); // error + + private glo_C3_v21_private: glo_C1_public = new glo_C1_public(); + public glo_C3_v22_public: glo_C1_public = new glo_C1_public(); + private glo_C3_v23_private: glo_C2_private = new glo_C2_private(); + public glo_C3_v24_public: glo_C2_private = new glo_C2_private(); //error + } + + class glo_C4_public { + private glo_C4_v1_private: glo_C1_public; + public glo_C4_v2_public: glo_C1_public; + private glo_C4_v3_private: glo_C2_private; + public glo_C4_v4_public: glo_C2_private; + + private glo_C4_v11_private = new glo_C1_public(); + public glo_C4_v12_public = new glo_C1_public(); + private glo_C4_v13_private = new glo_C2_private(); + public glo_C4_v14_public = new glo_C2_private(); + + private glo_C4_v21_private: glo_C1_public = new glo_C1_public(); + public glo_C4_v22_public: glo_C1_public = new glo_C1_public(); + private glo_C4_v23_private: glo_C2_private = new glo_C2_private(); + public glo_C4_v24_public: glo_C2_private = new glo_C2_private(); + } + + var glo_v1_private: glo_C1_public; + export var glo_v2_public: glo_C1_public; + var glo_v3_private: glo_C2_private; + export var glo_v4_public: glo_C2_private; // error + + var glo_v11_private = new glo_C1_public(); + export var glo_v12_public = new glo_C1_public(); + var glo_v13_private = new glo_C2_private(); + export var glo_v14_public = new glo_C2_private(); // error + + var glo_v21_private: glo_C1_public = new glo_C1_public(); + export var glo_v22_public: glo_C1_public = new glo_C1_public(); + var glo_v23_private: glo_C2_private = new glo_C2_private(); + export var glo_v24_public: glo_C2_private = new glo_C2_private(); // error \ No newline at end of file diff --git a/tests/baselines/reference/privacyVarDeclFile.errors.txt b/tests/baselines/reference/privacyVarDeclFile.errors.txt new file mode 100644 index 00000000000..753bc1b798b --- /dev/null +++ b/tests/baselines/reference/privacyVarDeclFile.errors.txt @@ -0,0 +1,437 @@ +privacyVarDeclFile_GlobalFile.ts(15,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyVarDeclFile_GlobalFile.ts(22,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyVarDeclFile_externalModule.ts(81,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +privacyVarDeclFile_externalModule.ts(163,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== privacyVarDeclFile_externalModule.ts (2 errors) ==== + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; // Error + } + + export interface publicInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + interface privateInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + interface privateInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; // Error + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; // Error + private myPrivateProperty: privateClass; + } + + export class publicClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + class privateClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + export var publicVarWithPrivatePropertyTypes: privateClass; // Error + export var publicVarWithPublicPropertyTypes: publicClass; + var privateVarWithPrivatePropertyTypes: privateClass; + var privateVarWithPublicPropertyTypes: publicClass; + + export declare var publicAmbientVarWithPrivatePropertyTypes: privateClass; // Error + export declare var publicAmbientVarWithPublicPropertyTypes: publicClass; + declare var privateAmbientVarWithPrivatePropertyTypes: privateClass; + declare var privateAmbientVarWithPublicPropertyTypes: publicClass; + + export interface publicInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; // Error + } + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; // Error + myPublicProperty: privateModule.publicClass; // Error + } + export var publicVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + export declare var publicAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + var privateVarWithPrivateModulePropertyTypes: privateModule.publicClass; + declare var privateAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + + export module publicModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; // Error + } + + export interface publicInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + interface privateInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + interface privateInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; // Error + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; // Error + private myPrivateProperty: privateClass; + } + + export class publicClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + class privateClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + export var publicVarWithPrivatePropertyTypes: privateClass; // Error + export var publicVarWithPublicPropertyTypes: publicClass; + var privateVarWithPrivatePropertyTypes: privateClass; + var privateVarWithPublicPropertyTypes: publicClass; + + export declare var publicAmbientVarWithPrivatePropertyTypes: privateClass; // Error + export declare var publicAmbientVarWithPublicPropertyTypes: publicClass; + declare var privateAmbientVarWithPrivatePropertyTypes: privateClass; + declare var privateAmbientVarWithPublicPropertyTypes: publicClass; + + export interface publicInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; // Error + } + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; // Error + myPublicProperty: privateModule.publicClass; // Error + } + export var publicVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + export declare var publicAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + var privateVarWithPrivateModulePropertyTypes: privateModule.publicClass; + declare var privateAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + export interface publicInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + interface privateInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + interface privateInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + export class publicClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + class privateClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + export var publicVarWithPrivatePropertyTypes: privateClass; + export var publicVarWithPublicPropertyTypes: publicClass; + var privateVarWithPrivatePropertyTypes: privateClass; + var privateVarWithPublicPropertyTypes: publicClass; + + export declare var publicAmbientVarWithPrivatePropertyTypes: privateClass; + export declare var publicAmbientVarWithPublicPropertyTypes: publicClass; + declare var privateAmbientVarWithPrivatePropertyTypes: privateClass; + declare var privateAmbientVarWithPublicPropertyTypes: publicClass; + + export interface publicInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + export var publicVarWithPrivateModulePropertyTypes: privateModule.publicClass; + export declare var publicAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + + interface privateInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + var privateVarWithPrivateModulePropertyTypes: privateModule.publicClass; + declare var privateAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + } + +==== privacyVarDeclFile_GlobalFile.ts (2 errors) ==== + class publicClassInGlobal { + } + interface publicInterfaceWithPublicPropertyTypesInGlobal { + myProperty: publicClassInGlobal; + } + class publicClassWithWithPublicPropertyTypesInGlobal { + static myPublicStaticProperty: publicClassInGlobal; + private static myPrivateStaticProperty: publicClassInGlobal; + myPublicProperty: publicClassInGlobal; + private myPrivateProperty: publicClassInGlobal; + } + var publicVarWithPublicPropertyTypesInGlobal: publicClassInGlobal; + declare var publicAmbientVarWithPublicPropertyTypesInGlobal: publicClassInGlobal; + + module publicModuleInGlobal { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + module privateModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class privateClass { + } + + export class publicClass { + } + + export interface publicInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + export interface publicInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + interface privateInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + interface privateInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + export class publicClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + class privateClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + export var publicVarWithPrivatePropertyTypes: privateClass; + export var publicVarWithPublicPropertyTypes: publicClass; + var privateVarWithPrivatePropertyTypes: privateClass; + var privateVarWithPublicPropertyTypes: publicClass; + + export declare var publicAmbientVarWithPrivatePropertyTypes: privateClass; + export declare var publicAmbientVarWithPublicPropertyTypes: publicClass; + declare var privateAmbientVarWithPrivatePropertyTypes: privateClass; + declare var privateAmbientVarWithPublicPropertyTypes: publicClass; + + export interface publicInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + export var publicVarWithPrivateModulePropertyTypes: privateModule.publicClass; + export declare var publicAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + + interface privateInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + var privateVarWithPrivateModulePropertyTypes: privateModule.publicClass; + declare var privateAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + } + + export interface publicInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; // Error + } + + export interface publicInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + interface privateInterfaceWithPrivatePropertyTypes { + myProperty: privateClass; + } + + interface privateInterfaceWithPublicPropertyTypes { + myProperty: publicClass; + } + + export class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; // Error + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; // Error + private myPrivateProperty: privateClass; + } + + export class publicClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + class privateClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: privateClass; + private static myPrivateStaticProperty: privateClass; + myPublicProperty: privateClass; + private myPrivateProperty: privateClass; + } + + class privateClassWithWithPublicPropertyTypes { + static myPublicStaticProperty: publicClass; + private static myPrivateStaticProperty: publicClass; + myPublicProperty: publicClass; + private myPrivateProperty: publicClass; + } + + export var publicVarWithPrivatePropertyTypes: privateClass; // Error + export var publicVarWithPublicPropertyTypes: publicClass; + var privateVarWithPrivatePropertyTypes: privateClass; + var privateVarWithPublicPropertyTypes: publicClass; + + export declare var publicAmbientVarWithPrivatePropertyTypes: privateClass; // Error + export declare var publicAmbientVarWithPublicPropertyTypes: publicClass; + declare var privateAmbientVarWithPrivatePropertyTypes: privateClass; + declare var privateAmbientVarWithPublicPropertyTypes: publicClass; + + export interface publicInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; // Error + } + export class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; // Error + myPublicProperty: privateModule.publicClass; // Error + } + export var publicVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + export declare var publicAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; // Error + + interface privateInterfaceWithPrivateModulePropertyTypes { + myProperty: privateModule.publicClass; + } + class privateClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: privateModule.publicClass; + myPublicProperty: privateModule.publicClass; + } + var privateVarWithPrivateModulePropertyTypes: privateModule.publicClass; + declare var privateAmbientVarWithPrivateModulePropertyTypes: privateModule.publicClass; + } \ No newline at end of file diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt index 0ed8e38749e..b71ba9290e1 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt @@ -1,7 +1,8 @@ +privateStaticNotAccessibleInClodule.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privateStaticNotAccessibleInClodule.ts(9,22): error TS2341: Property 'bar' is private and only accessible within class 'C'. -==== privateStaticNotAccessibleInClodule.ts (1 errors) ==== +==== privateStaticNotAccessibleInClodule.ts (2 errors) ==== // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { @@ -10,6 +11,8 @@ privateStaticNotAccessibleInClodule.ts(9,22): error TS2341: Property 'bar' is pr } module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var y = C.bar; // error ~~~ !!! error TS2341: Property 'bar' is private and only accessible within class 'C'. diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt index ee6e9339f47..166c2d5574a 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt @@ -1,7 +1,8 @@ +privateStaticNotAccessibleInClodule2.ts(12,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. privateStaticNotAccessibleInClodule2.ts(13,22): error TS2341: Property 'bar' is private and only accessible within class 'C'. -==== privateStaticNotAccessibleInClodule2.ts (1 errors) ==== +==== privateStaticNotAccessibleInClodule2.ts (2 errors) ==== // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { @@ -14,6 +15,8 @@ privateStaticNotAccessibleInClodule2.ts(13,22): error TS2341: Property 'bar' is } module D { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var y = D.bar; // error ~~~ !!! error TS2341: Property 'bar' is private and only accessible within class 'C'. diff --git a/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.errors.txt b/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.errors.txt new file mode 100644 index 00000000000..fa733273309 --- /dev/null +++ b/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.errors.txt @@ -0,0 +1,16 @@ +useModule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== decl.d.ts (0 errors) ==== + export interface A { + b: number; + } + export as namespace moduleA; +==== useModule.ts (1 errors) ==== + module moduleB { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface IUseModuleA { + a: moduleA.A; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.errors.txt b/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.errors.txt new file mode 100644 index 00000000000..fa733273309 --- /dev/null +++ b/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.errors.txt @@ -0,0 +1,16 @@ +useModule.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== decl.d.ts (0 errors) ==== + export interface A { + b: number; + } + export as namespace moduleA; +==== useModule.ts (1 errors) ==== + module moduleB { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export interface IUseModuleA { + a: moduleA.A; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.errors.txt b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.errors.txt new file mode 100644 index 00000000000..b524866dd5d --- /dev/null +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.errors.txt @@ -0,0 +1,37 @@ +useModule.ts(6,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== m4.ts (0 errors) ==== + export class d { + }; + export var x: d; + export function foo() { + return new d(); + } + +==== m5.ts (0 errors) ==== + import m4 = require("m4"); // Emit used + export function foo2() { + return new m4.d(); + } +==== useModule.ts (1 errors) ==== + import m4 = require("m4"); // Emit used + export var x4 = m4.x; + export var d4 = m4.d; + export var f4 = m4.foo(); + + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x2 = m4.x; + export var d2 = m4.d; + export var f2 = m4.foo(); + + var x3 = m4.x; + var d3 = m4.d; + var f3 = m4.foo(); + } + + // Do not emit unused import + import m5 = require("m5"); + export var d = m5.foo2(); \ No newline at end of file diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.errors.txt b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.errors.txt new file mode 100644 index 00000000000..b524866dd5d --- /dev/null +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.errors.txt @@ -0,0 +1,37 @@ +useModule.ts(6,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== m4.ts (0 errors) ==== + export class d { + }; + export var x: d; + export function foo() { + return new d(); + } + +==== m5.ts (0 errors) ==== + import m4 = require("m4"); // Emit used + export function foo2() { + return new m4.d(); + } +==== useModule.ts (1 errors) ==== + import m4 = require("m4"); // Emit used + export var x4 = m4.x; + export var d4 = m4.d; + export var f4 = m4.foo(); + + export module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var x2 = m4.x; + export var d2 = m4.d; + export var f2 = m4.foo(); + + var x3 = m4.x; + var d3 = m4.d; + var f3 = m4.foo(); + } + + // Do not emit unused import + import m5 = require("m5"); + export var d = m5.foo2(); \ No newline at end of file diff --git a/tests/baselines/reference/propertyNamesWithStringLiteral.errors.txt b/tests/baselines/reference/propertyNamesWithStringLiteral.errors.txt new file mode 100644 index 00000000000..324d47aab67 --- /dev/null +++ b/tests/baselines/reference/propertyNamesWithStringLiteral.errors.txt @@ -0,0 +1,22 @@ +propertyNamesWithStringLiteral.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== propertyNamesWithStringLiteral.ts (1 errors) ==== + class _Color { + a: number; r: number; g: number; b: number; + } + + interface NamedColors { + azure: _Color; + "blue": _Color; + "pale blue": _Color; + } + module Color { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var namedColors: NamedColors; + } + var a = Color.namedColors["azure"]; + var a = Color.namedColors.blue; // Should not error + var a = Color.namedColors["pale blue"]; // should not error + \ No newline at end of file diff --git a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt index 9e23438a337..8748c4daf3c 100644 --- a/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt +++ b/tests/baselines/reference/protectedStaticNotAccessibleInClodule.errors.txt @@ -1,7 +1,8 @@ +protectedStaticNotAccessibleInClodule.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. protectedStaticNotAccessibleInClodule.ts(10,22): error TS2445: Property 'bar' is protected and only accessible within class 'C' and its subclasses. -==== protectedStaticNotAccessibleInClodule.ts (1 errors) ==== +==== protectedStaticNotAccessibleInClodule.ts (2 errors) ==== // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. class C { @@ -10,6 +11,8 @@ protectedStaticNotAccessibleInClodule.ts(10,22): error TS2445: Property 'bar' is } module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var f = C.foo; // OK export var b = C.bar; // error ~~~ diff --git a/tests/baselines/reference/reExportAliasMakesInstantiated.errors.txt b/tests/baselines/reference/reExportAliasMakesInstantiated.errors.txt new file mode 100644 index 00000000000..3fcd292e2d4 --- /dev/null +++ b/tests/baselines/reference/reExportAliasMakesInstantiated.errors.txt @@ -0,0 +1,35 @@ +reExportAliasMakesInstantiated.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reExportAliasMakesInstantiated.ts(5,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reExportAliasMakesInstantiated.ts(11,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reExportAliasMakesInstantiated.ts(15,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== reExportAliasMakesInstantiated.ts (4 errors) ==== + declare module pack1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + const test1: string; + export { test1 }; + } + declare module pack2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import test1 = pack1.test1; + export { test1 }; + } + export import test1 = pack2.test1; + + declare module mod1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + type test1 = string; + export { test1 }; + } + declare module mod2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + import test1 = mod1.test1; + export { test1 }; + } + const test2 = mod2; // Possible false positive instantiation, but ok + \ No newline at end of file diff --git a/tests/baselines/reference/reachabilityChecks1.errors.txt b/tests/baselines/reference/reachabilityChecks1.errors.txt index d25977a05b7..58e3144093e 100644 --- a/tests/baselines/reference/reachabilityChecks1.errors.txt +++ b/tests/baselines/reference/reachabilityChecks1.errors.txt @@ -1,19 +1,31 @@ reachabilityChecks1.ts(2,1): error TS7027: Unreachable code detected. +reachabilityChecks1.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. reachabilityChecks1.ts(6,5): error TS7027: Unreachable code detected. +reachabilityChecks1.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(11,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(16,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(18,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. reachabilityChecks1.ts(18,5): error TS7027: Unreachable code detected. +reachabilityChecks1.ts(23,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(28,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(30,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. reachabilityChecks1.ts(30,5): error TS7027: Unreachable code detected. reachabilityChecks1.ts(47,5): error TS7027: Unreachable code detected. +reachabilityChecks1.ts(51,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reachabilityChecks1.ts(53,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. reachabilityChecks1.ts(60,5): error TS7027: Unreachable code detected. reachabilityChecks1.ts(69,5): error TS7027: Unreachable code detected. -==== reachabilityChecks1.ts (7 errors) ==== +==== reachabilityChecks1.ts (17 errors) ==== while (true); var x = 1; ~~~~~~~~~~ !!! error TS7027: Unreachable code detected. module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. while (true); let x; ~~~~~~ @@ -21,15 +33,23 @@ reachabilityChecks1.ts(69,5): error TS7027: Unreachable code detected. } module A1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. do {} while(true); module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface F {} } } module A2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. while (true); module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~~~~~~~ var x = 1; ~~~~~~~~~~~~~~~~~~ @@ -39,13 +59,19 @@ reachabilityChecks1.ts(69,5): error TS7027: Unreachable code detected. } module A3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. while (true); type T = string; } module A4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. while (true); module A { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. ~~~~~~~~~~ const enum E { X } ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -74,8 +100,12 @@ reachabilityChecks1.ts(69,5): error TS7027: Unreachable code detected. } module B { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. for (; ;); module C { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } } diff --git a/tests/baselines/reference/recursiveBaseCheck.errors.txt b/tests/baselines/reference/recursiveBaseCheck.errors.txt index 25e999d547b..e28ed4825b0 100644 --- a/tests/baselines/reference/recursiveBaseCheck.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck.errors.txt @@ -1,3 +1,4 @@ +recursiveBaseCheck.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveBaseCheck.ts(2,11): error TS2506: 'C' is referenced directly or indirectly in its own base expression. recursiveBaseCheck.ts(4,18): error TS2506: 'B' is referenced directly or indirectly in its own base expression. recursiveBaseCheck.ts(6,18): error TS2506: 'A' is referenced directly or indirectly in its own base expression. @@ -5,8 +6,10 @@ recursiveBaseCheck.ts(8,18): error TS2506: 'AmChart' is referenced directly or i recursiveBaseCheck.ts(10,18): error TS2506: 'D' is referenced directly or indirectly in its own base expression. -==== recursiveBaseCheck.ts (5 errors) ==== +==== recursiveBaseCheck.ts (6 errors) ==== declare module Module { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class C extends D { ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. diff --git a/tests/baselines/reference/recursiveBaseCheck2.errors.txt b/tests/baselines/reference/recursiveBaseCheck2.errors.txt index 043d805a779..5083b7a5284 100644 --- a/tests/baselines/reference/recursiveBaseCheck2.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck2.errors.txt @@ -1,9 +1,20 @@ +recursiveBaseCheck2.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveBaseCheck2.ts(1,22): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveBaseCheck2.ts(1,32): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveBaseCheck2.ts(2,18): error TS2506: 'b2CircleShape' is referenced directly or indirectly in its own base expression. recursiveBaseCheck2.ts(4,18): error TS2506: 'b2Shape' is referenced directly or indirectly in its own base expression. +recursiveBaseCheck2.ts(7,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveBaseCheck2.ts(7,22): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== recursiveBaseCheck2.ts (2 errors) ==== +==== recursiveBaseCheck2.ts (7 errors) ==== declare module Box2D.Collision.Shapes { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class b2CircleShape extends b2Shape { ~~~~~~~~~~~~~ !!! error TS2506: 'b2CircleShape' is referenced directly or indirectly in its own base expression. @@ -14,6 +25,10 @@ recursiveBaseCheck2.ts(4,18): error TS2506: 'b2Shape' is referenced directly or } } declare module Box2D.Dynamics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class b2ContactListener extends Box2D.Collision.Shapes.b2Shape { } export class b2FixtureDef extends Box2D.Dynamics.b2ContactListener { diff --git a/tests/baselines/reference/recursiveClassReferenceTest.errors.txt b/tests/baselines/reference/recursiveClassReferenceTest.errors.txt index 06fffd62af3..fabe5eea21d 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.errors.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.errors.txt @@ -1,17 +1,34 @@ +recursiveClassReferenceTest.ts(6,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(6,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot find name 'Element'. +recursiveClassReferenceTest.ts(32,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(32,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(32,23): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(32,29): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(44,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(44,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(44,21): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveClassReferenceTest.ts(56,11): error TS2663: Cannot find name 'domNode'. Did you mean the instance member 'this.domNode'? +recursiveClassReferenceTest.ts(76,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(76,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(76,21): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveClassReferenceTest.ts(76,31): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveClassReferenceTest.ts(88,36): error TS2663: Cannot find name 'mode'. Did you mean the instance member 'this.mode'? recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'. Property 'getInitialState' is missing in type 'Window' but required in type 'IMode'. -==== recursiveClassReferenceTest.ts (4 errors) ==== +==== recursiveClassReferenceTest.ts (17 errors) ==== // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter declare module Sample.Thing { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface IWidget { getDomNode(): any; @@ -40,6 +57,14 @@ recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' i } module Sample.Actions.Thing.Find { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class StartFindAction implements Sample.Thing.IAction { public getId() { return "yo"; } @@ -52,6 +77,12 @@ recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' i } module Sample.Thing.Widgets { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class FindWidget implements Sample.Thing.IWidget { public gar(runner:(widget:Sample.Thing.IWidget)=>any) { if (true) {return runner(this);}} @@ -86,6 +117,14 @@ recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' i declare var self: Window; module Sample.Thing.Languages.PlainText { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~~~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class State implements IState { constructor(private mode: IMode) { } diff --git a/tests/baselines/reference/recursiveMods.errors.txt b/tests/baselines/reference/recursiveMods.errors.txt new file mode 100644 index 00000000000..241ad9c1840 --- /dev/null +++ b/tests/baselines/reference/recursiveMods.errors.txt @@ -0,0 +1,32 @@ +recursiveMods.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +recursiveMods.ts(5,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== recursiveMods.ts (2 errors) ==== + export module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class C {} + } + + export module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + function Bar() : C { + if (true) { return Bar();} + return new C(); + } + + function Baz() : C { + var c = Baz(); + return Bar(); + } + + function Gar() { + var c : C = Baz(); + return; + } + + } + \ No newline at end of file diff --git a/tests/baselines/reference/recursiveTypeComparison2.errors.txt b/tests/baselines/reference/recursiveTypeComparison2.errors.txt index 799776a7f34..86303c66d20 100644 --- a/tests/baselines/reference/recursiveTypeComparison2.errors.txt +++ b/tests/baselines/reference/recursiveTypeComparison2.errors.txt @@ -1,10 +1,13 @@ +recursiveTypeComparison2.ts(3,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. recursiveTypeComparison2.ts(13,80): error TS2304: Cannot find name 'StateValue'. -==== recursiveTypeComparison2.ts (1 errors) ==== +==== recursiveTypeComparison2.ts (2 errors) ==== // Before fix this would cause compiler to hang (#1170) declare module Bacon { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Event { } interface Error extends Event { diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt index 299438f5242..a533811d520 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt @@ -1,31 +1,99 @@ +resolvingClassDeclarationWhenInBaseTypeResolution.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(2,45): error TS2449: Class 'nitidus' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(9,56): error TS2449: Class 'mixtus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(17,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(45,48): error TS2449: Class 'psilurus' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(60,44): error TS2449: Class 'jugularis' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(96,44): error TS2449: Class 'aurata' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(102,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(108,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(114,48): error TS2449: Class 'gilbertii' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(126,43): error TS2449: Class 'johorensis' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(153,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(182,54): error TS2449: Class 'falconeri' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(188,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(199,47): error TS2449: Class 'pygmaea' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(238,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(246,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(247,46): error TS2449: Class 'ciliolabrum' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(254,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(272,35): error TS2449: Class 'coludo' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(301,41): error TS2449: Class 'oreas' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(316,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(357,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(375,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(390,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(402,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(403,53): error TS2449: Class 'johorensis' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(424,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(435,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(436,55): error TS2449: Class 'punicus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(451,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(463,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(468,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(469,52): error TS2449: Class 'stolzmanni' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(473,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(477,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(489,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(490,42): error TS2449: Class 'portoricensis' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(494,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(495,50): error TS2449: Class 'pelurus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(499,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(500,49): error TS2449: Class 'lasiurus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(503,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(516,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(533,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(534,50): error TS2449: Class 'stolzmanni' used before its declaration. resolvingClassDeclarationWhenInBaseTypeResolution.ts(549,53): error TS2449: Class 'daphaenodon' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(579,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(580,54): error TS2449: Class 'johorensis' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(588,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(589,52): error TS2449: Class 'stolzmanni' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(593,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(597,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(604,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(605,55): error TS2449: Class 'psilurus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(615,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(626,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(638,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(654,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(671,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(677,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(683,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(701,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(717,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(721,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(738,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(748,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(764,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(768,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Class 'lasiurus' used before its declaration. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(787,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(815,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(823,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(825,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(838,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(850,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(857,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(874,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(888,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(894,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(900,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(915,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(932,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(944,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(961,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(978,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(983,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(988,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(1000,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +resolvingClassDeclarationWhenInBaseTypeResolution.ts(1009,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== resolvingClassDeclarationWhenInBaseTypeResolution.ts (24 errors) ==== +==== resolvingClassDeclarationWhenInBaseTypeResolution.ts (90 errors) ==== module rionegrensis { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class caniventer extends Lanthanum.nitidus { ~~~~~~~ !!! error TS2449: Class 'nitidus' used before its declaration. @@ -48,6 +116,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module julianae { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class steerii { } export class nudicaudus { @@ -142,12 +212,16 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module ruatanica { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class hector { humulis() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } eurycerus() : panamensis.linulus, lavali.wilsoni> { var x : panamensis.linulus, lavali.wilsoni>; () => { var y = this; }; return x; } } } module Lanthanum { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class suillus { spilosoma() : quasiater.carolinensis { var x : quasiater.carolinensis; () => { var y = this; }; return x; } tumbalensis() : caurinus.megaphyllus { var x : caurinus.megaphyllus; () => { var y = this; }; return x; } @@ -199,6 +273,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module rendalli { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class zuluensis extends julianae.steerii { telfairi() : argurus.wetmorei { var x : argurus.wetmorei; () => { var y = this; }; return x; } keyensis() : quasiater.wattsi { var x : quasiater.wattsi; () => { var y = this; }; return x; } @@ -237,6 +313,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module trivirgatus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class tumidifrons { nivalis() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } vestitus() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } @@ -290,6 +368,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module quasiater { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class bobrinskoi { crassicaudatus() : samarensis.cahirinus { var x : samarensis.cahirinus; () => { var y = this; }; return x; } mulatta() : argurus.oreas { var x : argurus.oreas; () => { var y = this; }; return x; } @@ -298,6 +378,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module ruatanica { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class americanus extends imperfecta.ciliolabrum { ~~~~~~~~~~~ !!! error TS2449: Class 'ciliolabrum' used before its declaration. @@ -309,6 +391,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module lavali { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class wilsoni extends Lanthanum.nitidus { setiger() : nigra.thalia { var x : nigra.thalia; () => { var y = this; }; return x; } lorentzii() : imperfecta.subspinosus { var x : imperfecta.subspinosus; () => { var y = this; }; return x; } @@ -377,6 +461,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module dogramacii { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class robustulus extends lavali.wilsoni { fossor() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } humboldti() : sagitta.cinereus { var x : sagitta.cinereus; () => { var y = this; }; return x; } @@ -418,6 +504,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module lutreolus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class schlegeli extends lavali.beisa { mittendorfi() : rionegrensis.caniventer { var x : rionegrensis.caniventer; () => { var y = this; }; return x; } blicki() : dogramacii.robustulus { var x : dogramacii.robustulus; () => { var y = this; }; return x; } @@ -436,6 +524,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class dauricus { chinensis() : Lanthanum.jugularis { var x : Lanthanum.jugularis; () => { var y = this; }; return x; } duodecimcostatus() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } @@ -451,6 +541,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module nigra { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class dolichurus { solomonis() : panglima.abidi, argurus.netscheri, julianae.oralis>>> { var x : panglima.abidi, argurus.netscheri, julianae.oralis>>>; () => { var y = this; }; return x; } alfredi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } @@ -463,6 +555,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module panglima { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class amphibius extends caurinus.johorensis, Lanthanum.jugularis> { ~~~~~~~~~~ !!! error TS2449: Class 'johorensis' used before its declaration. @@ -488,6 +582,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module quasiater { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class carolinensis { concinna(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } aeneus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } @@ -499,6 +595,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module minutus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class himalayana extends lutreolus.punicus { ~~~~~~~ !!! error TS2449: Class 'punicus' used before its declaration. @@ -518,6 +616,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module caurinus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class mahaganus extends panglima.fundatus { martiniquensis(): ruatanica.hector>> { var x: ruatanica.hector>>; () => { var y = this; }; return x; } devius(): samarensis.pelurus, trivirgatus.falconeri>> { var x: samarensis.pelurus, trivirgatus.falconeri>>; () => { var y = this; }; return x; } @@ -530,11 +630,15 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module macrorhinos { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class marmosurus { tansaniana(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } } } module howi { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class angulatus extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. @@ -543,10 +647,14 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module daubentonii { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class nesiotes { } } module nigra { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class thalia { dichotomus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } arnuxii(): panamensis.linulus, lavali.beisa> { var x: panamensis.linulus, lavali.beisa>; () => { var y = this; }; return x; } @@ -559,6 +667,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module sagitta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class walkeri extends minutus.portoricensis { ~~~~~~~~~~~~~ !!! error TS2449: Class 'portoricensis' used before its declaration. @@ -567,6 +677,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module minutus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class inez extends samarensis.pelurus { ~~~~~~~ !!! error TS2449: Class 'pelurus' used before its declaration. @@ -575,6 +687,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module macrorhinos { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class konganensis extends imperfecta.lasiurus { ~~~~~~~~ !!! error TS2449: Class 'lasiurus' used before its declaration. @@ -582,6 +696,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module panamensis { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class linulus extends ruatanica.hector> { goslingi(): daubentonii.arboreus { var x: daubentonii.arboreus; () => { var y = this; }; return x; } taki(): patas.uralensis { var x: patas.uralensis; () => { var y = this; }; return x; } @@ -595,6 +711,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module nigra { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class gracilis { weddellii(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } echinothrix(): Lanthanum.nitidus, argurus.oreas> { var x: Lanthanum.nitidus, argurus.oreas>; () => { var y = this; }; return x; } @@ -612,6 +730,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module samarensis { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class pelurus extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. @@ -664,6 +784,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module sagitta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class leptoceros extends caurinus.johorensis> { ~~~~~~~~~~ !!! error TS2449: Class 'johorensis' used before its declaration. @@ -676,6 +798,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module daubentonii { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class nigricans extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. @@ -684,10 +808,14 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module dammermani { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class siberu { } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class pygmaea extends rendalli.moojeni { pajeros(): gabriellae.echinatus { var x: gabriellae.echinatus; () => { var y = this; }; return x; } capucinus(): rendalli.zuluensis { var x: rendalli.zuluensis; () => { var y = this; }; return x; } @@ -695,6 +823,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module chrysaeolus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class sarasinorum extends caurinus.psilurus { ~~~~~~~~ !!! error TS2449: Class 'psilurus' used before its declaration. @@ -709,6 +839,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class wetmorei { leucoptera(): petrophilus.rosalia { var x: petrophilus.rosalia; () => { var y = this; }; return x; } ochraventer(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } @@ -720,6 +852,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class oreas extends lavali.wilsoni { salamonis(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } paniscus(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } @@ -732,6 +866,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module daubentonii { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class arboreus { capreolus(): rendalli.crenulata, lavali.wilsoni> { var x: rendalli.crenulata, lavali.wilsoni>; () => { var y = this; }; return x; } moreni(): panglima.abidi { var x: panglima.abidi; () => { var y = this; }; return x; } @@ -748,6 +884,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module patas { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class uralensis { cartilagonodus(): Lanthanum.nitidus { var x: Lanthanum.nitidus; () => { var y = this; }; return x; } pyrrhinus(): lavali.beisa { var x: lavali.beisa; () => { var y = this; }; return x; } @@ -765,18 +903,24 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module provocax { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class melanoleuca extends lavali.wilsoni { Neodymium(): macrorhinos.marmosurus, lutreolus.foina> { var x: macrorhinos.marmosurus, lutreolus.foina>; () => { var y = this; }; return x; } baeri(): imperfecta.lasiurus { var x: imperfecta.lasiurus; () => { var y = this; }; return x; } } } module sagitta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class sicarius { Chlorine(): samarensis.cahirinus, dogramacii.robustulus> { var x: samarensis.cahirinus, dogramacii.robustulus>; () => { var y = this; }; return x; } simulator(): macrorhinos.marmosurus, macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>> { var x: macrorhinos.marmosurus, macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>>; () => { var y = this; }; return x; } } } module howi { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class marcanoi extends Lanthanum.megalonyx { formosae(): Lanthanum.megalonyx { var x: Lanthanum.megalonyx; () => { var y = this; }; return x; } dudui(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } @@ -795,6 +939,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class gilbertii { nasutus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } poecilops(): julianae.steerii { var x: julianae.steerii; () => { var y = this; }; return x; } @@ -811,10 +957,14 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module petrophilus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class minutilla { } } module lutreolus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class punicus { strandi(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } lar(): caurinus.mahaganus { var x: caurinus.mahaganus; () => { var y = this; }; return x; } @@ -832,6 +982,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module macrorhinos { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class daphaenodon { bredanensis(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } othus(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } @@ -842,6 +994,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module sagitta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class cinereus { zunigae(): rendalli.crenulata> { var x: rendalli.crenulata>; () => { var y = this; }; return x; } microps(): daubentonii.nigricans> { var x: daubentonii.nigricans>; () => { var y = this; }; return x; } @@ -858,10 +1012,14 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module nigra { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class caucasica { } } module gabriellae { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class klossii extends imperfecta.lasiurus { ~~~~~~~~ !!! error TS2449: Class 'lasiurus' used before its declaration. @@ -884,6 +1042,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module imperfecta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class lasiurus { marisae(): lavali.thaeleri { var x: lavali.thaeleri; () => { var y = this; }; return x; } fulvus(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } @@ -912,6 +1072,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module quasiater { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class wattsi { lagotis(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } hussoni(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } @@ -920,8 +1082,12 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module butleri { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. } module petrophilus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class sodyi extends quasiater.bobrinskoi { saundersiae(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } imberbis(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } @@ -935,6 +1101,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module caurinus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class megaphyllus extends imperfecta.lasiurus> { montana(): argurus.oreas { var x: argurus.oreas; () => { var y = this; }; return x; } amatus(): lutreolus.schlegeli { var x: lutreolus.schlegeli; () => { var y = this; }; return x; } @@ -947,6 +1115,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module minutus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class portoricensis { relictus(): quasiater.carolinensis { var x: quasiater.carolinensis; () => { var y = this; }; return x; } aequatorianus(): gabriellae.klossii { var x: gabriellae.klossii; () => { var y = this; }; return x; } @@ -954,6 +1124,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module lutreolus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class foina { tarfayensis(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } Promethium(): samarensis.pelurus { var x: samarensis.pelurus; () => { var y = this; }; return x; } @@ -971,6 +1143,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module lutreolus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class cor extends panglima.fundatus, lavali.beisa>, dammermani.melanops> { antinorii(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } voi(): caurinus.johorensis { var x: caurinus.johorensis; () => { var y = this; }; return x; } @@ -985,18 +1159,24 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module howi { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class coludo { bernhardi(): lutreolus.punicus { var x: lutreolus.punicus; () => { var y = this; }; return x; } isseli(): argurus.germaini { var x: argurus.germaini; () => { var y = this; }; return x; } } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class germaini extends gabriellae.amicus { sharpei(): lavali.wilsoni { var x: lavali.wilsoni; () => { var y = this; }; return x; } palmarum(): macrorhinos.marmosurus { var x: macrorhinos.marmosurus; () => { var y = this; }; return x; } } } module sagitta { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class stolzmanni { riparius(): nigra.dolichurus { var x: nigra.dolichurus; () => { var y = this; }; return x; } dhofarensis(): lutreolus.foina { var x: lutreolus.foina; () => { var y = this; }; return x; } @@ -1012,6 +1192,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module dammermani { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class melanops extends minutus.inez { blarina(): dammermani.melanops { var x: dammermani.melanops; () => { var y = this; }; return x; } harwoodi(): rionegrensis.veraecrucis, lavali.wilsoni> { var x: rionegrensis.veraecrucis, lavali.wilsoni>; () => { var y = this; }; return x; } @@ -1029,6 +1211,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class peninsulae extends patas.uralensis { aitkeni(): trivirgatus.mixtus, panglima.amphibius> { var x: trivirgatus.mixtus, panglima.amphibius>; () => { var y = this; }; return x; } novaeangliae(): lavali.xanthognathus { var x: lavali.xanthognathus; () => { var y = this; }; return x; } @@ -1041,6 +1225,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class netscheri { gravis(): nigra.caucasica, dogramacii.kaiseri> { var x: nigra.caucasica, dogramacii.kaiseri>; () => { var y = this; }; return x; } ruschii(): imperfecta.lasiurus> { var x: imperfecta.lasiurus>; () => { var y = this; }; return x; } @@ -1058,6 +1244,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module ruatanica { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class Praseodymium extends ruatanica.hector { clara(): panglima.amphibius, argurus.dauricus> { var x: panglima.amphibius, argurus.dauricus>; () => { var y = this; }; return x; } spectabilis(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } @@ -1075,16 +1263,22 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module caurinus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class johorensis extends lutreolus.punicus { maini(): ruatanica.Praseodymium { var x: ruatanica.Praseodymium; () => { var y = this; }; return x; } } } module argurus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class luctuosa { loriae(): rendalli.moojeni, gabriellae.echinatus>, sagitta.stolzmanni>, lutreolus.punicus> { var x: rendalli.moojeni, gabriellae.echinatus>, sagitta.stolzmanni>, lutreolus.punicus>; () => { var y = this; }; return x; } } } module panamensis { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class setulosus { duthieae(): caurinus.mahaganus, dogramacii.aurata> { var x: caurinus.mahaganus, dogramacii.aurata>; () => { var y = this; }; return x; } guereza(): howi.coludo { var x: howi.coludo; () => { var y = this; }; return x; } @@ -1097,6 +1291,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module petrophilus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class rosalia { palmeri(): panglima.amphibius>, trivirgatus.mixtus, panglima.amphibius>> { var x: panglima.amphibius>, trivirgatus.mixtus, panglima.amphibius>>; () => { var y = this; }; return x; } baeops(): Lanthanum.nitidus { var x: Lanthanum.nitidus; () => { var y = this; }; return x; } @@ -1106,6 +1302,8 @@ resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Clas } } module caurinus { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class psilurus extends lutreolus.punicus { socialis(): panglima.amphibius { var x: panglima.amphibius; () => { var y = this; }; return x; } lundi(): petrophilus.sodyi { var x: petrophilus.sodyi; () => { var y = this; }; return x; } diff --git a/tests/baselines/reference/reuseInnerModuleMember.errors.txt b/tests/baselines/reference/reuseInnerModuleMember.errors.txt new file mode 100644 index 00000000000..0b3802f8420 --- /dev/null +++ b/tests/baselines/reference/reuseInnerModuleMember.errors.txt @@ -0,0 +1,25 @@ +reuseInnerModuleMember_0.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reuseInnerModuleMember_1.ts(2,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +reuseInnerModuleMember_1.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== reuseInnerModuleMember_1.ts (2 errors) ==== + /// + declare module bar { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface alpha { } + } + + import f = require('./reuseInnerModuleMember_0'); + module bar { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x: alpha; + } + +==== reuseInnerModuleMember_0.ts (1 errors) ==== + export module M { } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + \ No newline at end of file diff --git a/tests/baselines/reference/selfRef.errors.txt b/tests/baselines/reference/selfRef.errors.txt index 37bdaf9700b..f6f0193b19f 100644 --- a/tests/baselines/reference/selfRef.errors.txt +++ b/tests/baselines/reference/selfRef.errors.txt @@ -1,9 +1,12 @@ +selfRef.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. selfRef.ts(8,8): error TS2304: Cannot find name 'name'. selfRef.ts(12,18): error TS2304: Cannot find name 'name'. -==== selfRef.ts (2 errors) ==== +==== selfRef.ts (3 errors) ==== module M + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. { export class Test { diff --git a/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.errors.txt b/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.errors.txt new file mode 100644 index 00000000000..16110efd86e --- /dev/null +++ b/tests/baselines/reference/sourceMap-StringLiteralWithNewLine.errors.txt @@ -0,0 +1,19 @@ +sourceMap-StringLiteralWithNewLine.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== sourceMap-StringLiteralWithNewLine.ts (1 errors) ==== + interface Document { + } + interface Window { + document: Document; + } + declare var window: Window; + + module Foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x = "test1"; + var y = "test 2\ + isn't this a lot of fun"; + var z = window.document; + } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt new file mode 100644 index 00000000000..42bdcb3585a --- /dev/null +++ b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt @@ -0,0 +1,25 @@ +a.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +b.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== a.ts (1 errors) ==== + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var X = 1; + } + interface Navigator { + getGamepads(func?: any): any; + webkitGetGamepads(func?: any): any + msGetGamepads(func?: any): any; + webkitGamepads(func?: any): any; + } + +==== b.ts (1 errors) ==== + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class c1 { + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.types b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.types index 2911f8b23b9..94b9908c83e 100644 --- a/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.types +++ b/tests/baselines/reference/sourceMapWithMultipleFilesWithFileEndingWithInterface.types @@ -16,21 +16,25 @@ interface Navigator { >getGamepads : { (): (Gamepad | null)[]; (func?: any): any; } > : ^^^^^^ ^^^ ^^^ ^^^ ^^^ >func : any +> : ^^^ webkitGetGamepads(func?: any): any >webkitGetGamepads : (func?: any) => any > : ^ ^^^ ^^^^^ >func : any +> : ^^^ msGetGamepads(func?: any): any; >msGetGamepads : (func?: any) => any > : ^ ^^^ ^^^^^ >func : any +> : ^^^ webkitGamepads(func?: any): any; >webkitGamepads : (func?: any) => any > : ^ ^^^ ^^^^^ >func : any +> : ^^^ } === b.ts === diff --git a/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=false).errors.txt b/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=false).errors.txt index 2416c0a2ae6..d12e04375df 100644 --- a/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=false).errors.txt +++ b/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=false).errors.txt @@ -42,39 +42,49 @@ staticPropertyNameConflicts.ts(203,12): error TS2699: Static property 'arguments staticPropertyNameConflicts.ts(208,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments_Anonymous2'. staticPropertyNameConflicts.ts(213,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous'. staticPropertyNameConflicts.ts(218,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous2'. +staticPropertyNameConflicts.ts(226,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(228,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName'. staticPropertyNameConflicts.ts(234,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'ExportedStaticName'. +staticPropertyNameConflicts.ts(238,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(240,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn'. staticPropertyNameConflicts.ts(246,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'ExportedStaticNameFn'. +staticPropertyNameConflicts.ts(251,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(252,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(253,16): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'. staticPropertyNameConflicts.ts(259,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'ExportedStaticLength'. +staticPropertyNameConflicts.ts(263,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(264,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(265,16): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn'. staticPropertyNameConflicts.ts(271,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'ExportedStaticLengthFn'. +staticPropertyNameConflicts.ts(276,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(277,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(278,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'. staticPropertyNameConflicts.ts(284,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'ExportedStaticPrototype'. +staticPropertyNameConflicts.ts(288,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(289,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(290,16): error TS2300: Duplicate identifier 'prototype'. staticPropertyNameConflicts.ts(290,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'. staticPropertyNameConflicts.ts(296,12): error TS2300: Duplicate identifier '[FunctionPropertyNames.prototype]'. staticPropertyNameConflicts.ts(296,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'ExportedStaticPrototypeFn'. +staticPropertyNameConflicts.ts(301,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(302,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(303,16): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller'. staticPropertyNameConflicts.ts(309,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'ExportedStaticCaller'. +staticPropertyNameConflicts.ts(313,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(314,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(315,16): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'. staticPropertyNameConflicts.ts(321,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'ExportedStaticCallerFn'. +staticPropertyNameConflicts.ts(326,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(327,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(328,16): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'. staticPropertyNameConflicts.ts(334,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'ExportedStaticArguments'. +staticPropertyNameConflicts.ts(338,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(340,16): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'. staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'ExportedStaticArgumentsFn'. -==== staticPropertyNameConflicts.ts (74 errors) ==== +==== staticPropertyNameConflicts.ts (84 errors) ==== const FunctionPropertyNames = { name: 'name', length: 'length', @@ -389,6 +399,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments // name module TestOnDefaultExportedClass_1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class StaticName { static name: number; // error without useDefineForClassFields ~~~~ @@ -405,6 +417,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments } module TestOnDefaultExportedClass_2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class StaticNameFn { static name() {} // error without useDefineForClassFields ~~~~ @@ -422,6 +436,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments // length module TestOnDefaultExportedClass_3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticLength { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -440,6 +456,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments } module TestOnDefaultExportedClass_4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticLengthFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -459,6 +477,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments // prototype module TestOnDefaultExportedClass_5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticPrototype { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -477,6 +497,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments } module TestOnDefaultExportedClass_6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticPrototypeFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -500,6 +522,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments // caller module TestOnDefaultExportedClass_7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticCaller { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -518,6 +542,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments } module TestOnDefaultExportedClass_8 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticCallerFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -537,6 +563,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments // arguments module TestOnDefaultExportedClass_9 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticArguments { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -555,6 +583,8 @@ staticPropertyNameConflicts.ts(346,12): error TS2699: Static property 'arguments } module TestOnDefaultExportedClass_10 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticArgumentsFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. diff --git a/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=true).errors.txt b/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=true).errors.txt index 4d30b87e5dd..7346b25683f 100644 --- a/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=true).errors.txt +++ b/tests/baselines/reference/staticPropertyNameConflicts(usedefineforclassfields=true).errors.txt @@ -10,23 +10,33 @@ staticPropertyNameConflicts.ts(171,12): error TS2300: Duplicate identifier 'prot staticPropertyNameConflicts.ts(171,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous'. staticPropertyNameConflicts.ts(176,12): error TS2300: Duplicate identifier '[FunctionPropertyNames.prototype]'. staticPropertyNameConflicts.ts(176,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous2'. +staticPropertyNameConflicts.ts(226,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +staticPropertyNameConflicts.ts(238,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +staticPropertyNameConflicts.ts(251,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(252,12): error TS1319: A default export can only be used in an ECMAScript-style module. +staticPropertyNameConflicts.ts(263,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(264,12): error TS1319: A default export can only be used in an ECMAScript-style module. +staticPropertyNameConflicts.ts(276,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(277,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(278,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'. staticPropertyNameConflicts.ts(284,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'ExportedStaticPrototype'. +staticPropertyNameConflicts.ts(288,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(289,12): error TS1319: A default export can only be used in an ECMAScript-style module. staticPropertyNameConflicts.ts(290,16): error TS2300: Duplicate identifier 'prototype'. staticPropertyNameConflicts.ts(290,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'. staticPropertyNameConflicts.ts(296,12): error TS2300: Duplicate identifier '[FunctionPropertyNames.prototype]'. staticPropertyNameConflicts.ts(296,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'ExportedStaticPrototypeFn'. +staticPropertyNameConflicts.ts(301,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(302,12): error TS1319: A default export can only be used in an ECMAScript-style module. +staticPropertyNameConflicts.ts(313,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(314,12): error TS1319: A default export can only be used in an ECMAScript-style module. +staticPropertyNameConflicts.ts(326,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(327,12): error TS1319: A default export can only be used in an ECMAScript-style module. +staticPropertyNameConflicts.ts(338,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only be used in an ECMAScript-style module. -==== staticPropertyNameConflicts.ts (26 errors) ==== +==== staticPropertyNameConflicts.ts (36 errors) ==== const FunctionPropertyNames = { name: 'name', length: 'length', @@ -277,6 +287,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only // name module TestOnDefaultExportedClass_1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class StaticName { static name: number; // error without useDefineForClassFields name: string; // ok @@ -289,6 +301,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only } module TestOnDefaultExportedClass_2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class StaticNameFn { static name() {} // error without useDefineForClassFields name() {} // ok @@ -302,6 +316,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only // length module TestOnDefaultExportedClass_3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticLength { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -316,6 +332,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only } module TestOnDefaultExportedClass_4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticLengthFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -331,6 +349,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only // prototype module TestOnDefaultExportedClass_5 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticPrototype { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -349,6 +369,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only } module TestOnDefaultExportedClass_6 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticPrototypeFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -372,6 +394,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only // caller module TestOnDefaultExportedClass_7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticCaller { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -386,6 +410,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only } module TestOnDefaultExportedClass_8 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticCallerFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -401,6 +427,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only // arguments module TestOnDefaultExportedClass_9 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticArguments { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. @@ -415,6 +443,8 @@ staticPropertyNameConflicts.ts(339,12): error TS1319: A default export can only } module TestOnDefaultExportedClass_10 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export default class StaticArgumentsFn { ~~~~~~~ !!! error TS1319: A default export can only be used in an ECMAScript-style module. diff --git a/tests/baselines/reference/subtypesOfAny.errors.txt b/tests/baselines/reference/subtypesOfAny.errors.txt new file mode 100644 index 00000000000..785109b221c --- /dev/null +++ b/tests/baselines/reference/subtypesOfAny.errors.txt @@ -0,0 +1,142 @@ +subtypesOfAny.ts(89,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypesOfAny.ts(99,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== subtypesOfAny.ts (2 errors) ==== + // every type is a subtype of any, no errors expected + + interface I { + [x: string]: any; + foo: any; + } + + + interface I2 { + [x: string]: any; + foo: number; + } + + + interface I3 { + [x: string]: any; + foo: string; + } + + + interface I4 { + [x: string]: any; + foo: boolean; + } + + + interface I5 { + [x: string]: any; + foo: Date; + } + + + interface I6 { + [x: string]: any; + foo: RegExp; + } + + + interface I7 { + [x: string]: any; + foo: { bar: number }; + } + + + interface I8 { + [x: string]: any; + foo: number[]; + } + + + interface I9 { + [x: string]: any; + foo: I8; + } + + class A { foo: number; } + interface I10 { + [x: string]: any; + foo: A; + } + + class A2 { foo: T; } + interface I11 { + [x: string]: any; + foo: A2; + } + + + interface I12 { + [x: string]: any; + foo: (x) => number; + } + + + interface I13 { + [x: string]: any; + foo: (x:T) => T; + } + + + enum E { A } + interface I14 { + [x: string]: any; + foo: E; + } + + + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + interface I15 { + [x: string]: any; + foo: typeof f; + } + + + class c { baz: string } + module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + interface I16 { + [x: string]: any; + foo: typeof c; + } + + + interface I17 { + [x: string]: any; + foo: T; + } + + + interface I18 { + [x: string]: any; + foo: U; + } + //interface I18 { + // [x: string]: any; + // foo: U; + //} + + + interface I19 { + [x: string]: any; + foo: Object; + } + + + interface I20 { + [x: string]: any; + foo: {}; + } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfAny.types b/tests/baselines/reference/subtypesOfAny.types index f52f5e649ab..dd4adcb4792 100644 --- a/tests/baselines/reference/subtypesOfAny.types +++ b/tests/baselines/reference/subtypesOfAny.types @@ -10,6 +10,7 @@ interface I { foo: any; >foo : any +> : ^^^ } @@ -144,6 +145,7 @@ interface I12 { >foo : (x: any) => number > : ^ ^^^^^^^^^^ >x : any +> : ^^^ } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt index 0e448bce510..95071e552b9 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt @@ -1,9 +1,11 @@ subtypesOfTypeParameter.ts(8,5): error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'. +subtypesOfTypeParameter.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypesOfTypeParameter.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== subtypesOfTypeParameter.ts (1 errors) ==== +==== subtypesOfTypeParameter.ts (3 errors) ==== // checking whether other types are subtypes of type parameters class C3 { @@ -30,10 +32,14 @@ subtypesOfTypeParameter.ts(8,5): error TS2416: Property 'foo' in type 'D1' enum E { A } function f() { } module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } class c { baz: string } module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.errors.txt new file mode 100644 index 00000000000..3b247475e5e --- /dev/null +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.errors.txt @@ -0,0 +1,166 @@ +subtypesOfTypeParameterWithConstraints2.ts(42,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypesOfTypeParameterWithConstraints2.ts(46,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== subtypesOfTypeParameterWithConstraints2.ts (2 errors) ==== + // checking whether other types are subtypes of type parameters with constraints + + function f1(x: T, y: U) { + var r = true ? x : y; + var r = true ? y : x; + } + + // V > U > T + function f2(x: T, y: U, z: V) { + var r = true ? x : y; + var r = true ? y : x; + + // ok + var r2 = true ? z : y; + var r2 = true ? y : z; + + // ok + var r2a = true ? z : x; + var r2b = true ? x : z; + } + + // Date > U > T + function f3(x: T, y: U) { + var r = true ? x : y; + var r = true ? y : x; + + // ok + var r2 = true ? x : new Date(); + var r2 = true ? new Date() : x; + + // ok + var r3 = true ? y : new Date(); + var r3 = true ? new Date() : y; + } + + + interface I1 { foo: number; } + class C1 { foo: number; } + class C2 { foo: T; } + enum E { A } + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + class c { baz: string } + module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + + function f4(x: T) { + var r0 = true ? x : null; // ok + var r0 = true ? null : x; // ok + + var u: typeof undefined; + var r0b = true ? u : x; // ok + var r0b = true ? x : u; // ok + } + + function f5(x: T) { + var r1 = true ? 1 : x; // ok + var r1 = true ? x : 1; // ok + } + + function f6(x: T) { + var r2 = true ? '' : x; // ok + var r2 = true ? x : ''; // ok + } + + function f7(x: T) { + var r3 = true ? true : x; // ok + var r3 = true ? x : true; // ok + } + + function f8(x: T) { + var r4 = true ? new Date() : x; // ok + var r4 = true ? x : new Date(); // ok + } + + function f9(x: T) { + var r5 = true ? /1/ : x; // ok + var r5 = true ? x : /1/; // ok + } + + function f10(x: T) { + var r6 = true ? { foo: 1 } : x; // ok + var r6 = true ? x : { foo: 1 }; // ok + } + + function f11 void>(x: T) { + var r7 = true ? () => { } : x; // ok + var r7 = true ? x : () => { }; // ok + } + + function f12(x: U) => U>(x: T) { + var r8 = true ? (x: T) => { return x } : x; // ok + var r8b = true ? x : (x: T) => { return x }; // ok, type parameters not identical across declarations + } + + function f13(x: T) { + var i1: I1; + var r9 = true ? i1 : x; // ok + var r9 = true ? x : i1; // ok + } + + function f14(x: T) { + var c1: C1; + var r10 = true ? c1 : x; // ok + var r10 = true ? x : c1; // ok + } + + function f15>(x: T) { + var c2: C2; + var r12 = true ? c2 : x; // ok + var r12 = true ? x : c2; // ok + } + + function f16(x: T) { + var r13 = true ? E : x; // ok + var r13 = true ? x : E; // ok + + var r14 = true ? E.A : x; // ok + var r14 = true ? x : E.A; // ok + } + + function f17(x: T) { + var af: typeof f; + var r15 = true ? af : x; // ok + var r15 = true ? x : af; // ok + } + + function f18(x: T) { + var ac: typeof c; + var r16 = true ? ac : x; // ok + var r16 = true ? x : ac; // ok + } + + function f19(x: T) { + function f17(a: U) { + var r17 = true ? x : a; // ok + var r17 = true ? a : x; // ok + } + + function f18(a: V) { + var r18 = true ? x : a; // ok + var r18 = true ? a : x; // ok + } + } + + function f20(x: T) { + var r19 = true ? new Object() : x; // ok + var r19 = true ? x : new Object(); // ok + } + + function f21(x: T) { + var r20 = true ? {} : x; // ok + var r20 = true ? x : {}; // ok + } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types index c181f9980b7..e4adad1bd99 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types @@ -296,26 +296,33 @@ function f4(x: T) { var u: typeof undefined; >u : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ var r0b = true ? u : x; // ok >r0b : any +> : ^^^ >true ? u : x : any +> : ^^^ >true : true > : ^^^^ >u : any +> : ^^^ >x : T > : ^ var r0b = true ? x : u; // ok >r0b : any +> : ^^^ >true ? x : u : any +> : ^^^ >true : true > : ^^^^ >x : T > : ^ >u : any +> : ^^^ } function f5(x: T) { diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt index c889d468425..2fe6829e65d 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt @@ -1,3 +1,4 @@ +subtypesOfTypeParameterWithRecursiveConstraints.ts(56,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2411: Property 'foo' of type 'U' is not assignable to 'string' index type 'T'. subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2416: Property 'foo' in type 'D2' is not assignable to the same property in base type 'Base'. Type 'U' is not assignable to type 'T'. @@ -22,6 +23,7 @@ subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2411: Property subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'Base'. Type 'U' is not assignable to type 'V'. 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'. +subtypesOfTypeParameterWithRecursiveConstraints.ts(108,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypesOfTypeParameterWithRecursiveConstraints.ts(115,9): error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'Base2'. Type 'T' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. @@ -60,7 +62,7 @@ subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2416: Propert 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'. -==== subtypesOfTypeParameterWithRecursiveConstraints.ts (24 errors) ==== +==== subtypesOfTypeParameterWithRecursiveConstraints.ts (26 errors) ==== // checking whether other types are subtypes of type parameters with constraints class Foo { foo: T; } @@ -117,6 +119,8 @@ subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2416: Propert } module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base { foo: T; } @@ -205,6 +209,8 @@ subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2416: Propert module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class Base2 { foo: Foo; } diff --git a/tests/baselines/reference/subtypesOfUnion.errors.txt b/tests/baselines/reference/subtypesOfUnion.errors.txt index 49f667cc429..9440a128f7c 100644 --- a/tests/baselines/reference/subtypesOfUnion.errors.txt +++ b/tests/baselines/reference/subtypesOfUnion.errors.txt @@ -1,3 +1,5 @@ +subtypesOfUnion.ts(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypesOfUnion.ts(8,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypesOfUnion.ts(16,5): error TS2411: Property 'foo4' of type 'boolean' is not assignable to 'string' index type 'string | number'. subtypesOfUnion.ts(18,5): error TS2411: Property 'foo6' of type 'Date' is not assignable to 'string' index type 'string | number'. subtypesOfUnion.ts(19,5): error TS2411: Property 'foo7' of type 'RegExp' is not assignable to 'string' index type 'string | number'. @@ -29,15 +31,19 @@ subtypesOfUnion.ts(50,5): error TS2411: Property 'foo17' of type 'Object' is not subtypesOfUnion.ts(51,5): error TS2411: Property 'foo18' of type '{}' is not assignable to 'string' index type 'number'. -==== subtypesOfUnion.ts (29 errors) ==== +==== subtypesOfUnion.ts (31 errors) ==== enum E { e1, e2 } interface I8 { [x: string]: number[]; } class A { foo: number; } class A2 { foo: T; } function f() { } module f { export var bar = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class c { baz: string } module c { export var bar = 1; } + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // A type T is a subtype of a union type U if T is a subtype of any type in U. interface I1 { diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.errors.txt b/tests/baselines/reference/subtypingWithCallSignatures3.errors.txt new file mode 100644 index 00000000000..612cf0fb7e5 --- /dev/null +++ b/tests/baselines/reference/subtypingWithCallSignatures3.errors.txt @@ -0,0 +1,127 @@ +subtypingWithCallSignatures3.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypingWithCallSignatures3.ts(108,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== subtypingWithCallSignatures3.ts (2 errors) ==== + // checking subtype relations for function types as it relates to contextual signature instantiation + // error cases, so function calls will all result in 'any' + + module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class Base { foo: string; } + class Derived extends Base { bar: string; } + class Derived2 extends Derived { baz: string; } + class OtherDerived extends Base { bing: string; } + + declare function foo2(a2: (x: number) => string[]): typeof a2; + declare function foo2(a2: any): any; + + declare function foo7(a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; + declare function foo7(a2: any): any; + + declare function foo8(a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; + declare function foo8(a2: any): any; + + declare function foo10(a2: (...x: Base[]) => Base): typeof a2; + declare function foo10(a2: any): any; + + declare function foo11(a2: (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; + declare function foo11(a2: any): any; + + declare function foo12(a2: (x: Array, y: Array) => Array): typeof a2; + declare function foo12(a2: any): any; + + declare function foo15(a2: (x: { a: string; b: number }) => number): typeof a2; + declare function foo15(a2: any): any; + + declare function foo16(a2: { + // type of parameter is overload set which means we can't do inference based on this type + (x: { + (a: number): number; + (a?: number): number; + }): number[]; + (x: { + (a: boolean): boolean; + (a?: boolean): boolean; + }): boolean[]; + }): typeof a2; + declare function foo16(a2: any): any; + + declare function foo17(a2: { + (x: { + (a: T): T; + (a: T): T; + }): any[]; + (x: { + (a: T): T; + (a: T): T; + }): any[]; + }): typeof a2; + declare function foo17(a2: any): any; + + var r1 = foo2((x: T) => null); // any + var r1a = [(x: number) => [''], (x: T) => null]; + var r1b = [(x: T) => null, (x: number) => ['']]; + + var r2arg = (x: (arg: T) => U) => (r: T) => null; + var r2arg2 = (x: (arg: Base) => Derived) => (r: Base) => null; + var r2 = foo7(r2arg); // any + var r2a = [r2arg2, r2arg]; + var r2b = [r2arg, r2arg2]; + + var r3arg = (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => null; + var r3arg2 = (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => null; + var r3 = foo8(r3arg); // any + var r3a = [r3arg2, r3arg]; + var r3b = [r3arg, r3arg2]; + + var r4arg = (...x: T[]) => null; + var r4arg2 = (...x: Base[]) => null; + var r4 = foo10(r4arg); // any + var r4a = [r4arg2, r4arg]; + var r4b = [r4arg, r4arg2]; + + var r5arg = (x: T, y: T) => null; + var r5arg2 = (x: { foo: string }, y: { foo: string; bar: string }) => null; + var r5 = foo11(r5arg); // any + var r5a = [r5arg2, r5arg]; + var r5b = [r5arg, r5arg2]; + + var r6arg = (x: Array, y: Array) => >null; + var r6arg2 = >(x: Array, y: Array) => null; + var r6 = foo12(r6arg); // (x: Array, y: Array) => Array + var r6a = [r6arg2, r6arg]; + var r6b = [r6arg, r6arg2]; + + var r7arg = (x: { a: T; b: T }) => null; + var r7arg2 = (x: { a: string; b: number }) => 1; + var r7 = foo15(r7arg); // any + var r7a = [r7arg2, r7arg]; + var r7b = [r7arg, r7arg2]; + + var r7arg3 = (x: { a: T; b: T }) => 1; + var r7c = foo15(r7arg3); // (x: { a: string; b: number }) => number): number; + var r7d = [r7arg2, r7arg3]; + var r7e = [r7arg3, r7arg2]; + + var r8arg = (x: (a: T) => T) => null; + var r8 = foo16(r8arg); // any + + var r9arg = (x: (a: T) => T) => null; + var r9 = foo17(r9arg); // (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; + } + + module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + declare function foo2(a2: (x: T) => T[]): typeof a2; + declare function foo2(a2: any): any; + var r2arg2 = (x: T) => ['']; + var r2 = foo2(r2arg2); // (x:T) => T[] since we can infer from generic signatures now + + declare function foo3(a2: (x: T) => string[]): typeof a2; + declare function foo3(a2: any): any; + var r3arg2 = (x: T) => null; + var r3 = foo3(r3arg2); // any + } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index 5618553cd89..5697b48d4b5 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -52,6 +52,7 @@ module Errors { >foo2 : { (a2: (x: number) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo7(a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; >foo7 : { (a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; (a2: any): any; } @@ -71,6 +72,7 @@ module Errors { >foo7 : { (a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo8(a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; >foo8 : { (a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; (a2: any): any; } @@ -94,6 +96,7 @@ module Errors { >foo8 : { (a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo10(a2: (...x: Base[]) => Base): typeof a2; >foo10 : { (a2: (...x: Base[]) => Base): typeof a2; (a2: any): any; } @@ -109,6 +112,7 @@ module Errors { >foo10 : { (a2: (...x: Base[]) => Base): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo11(a2: (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; >foo11 : { (a2: (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } @@ -132,6 +136,7 @@ module Errors { >foo11 : { (a2: (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo12(a2: (x: Array, y: Array) => Array): typeof a2; >foo12 : { (a2: (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } @@ -149,6 +154,7 @@ module Errors { >foo12 : { (a2: (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo15(a2: (x: { a: string; b: number }) => number): typeof a2; >foo15 : { (a2: (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } @@ -168,6 +174,7 @@ module Errors { >foo15 : { (a2: (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo16(a2: { >foo16 : { (a2: { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } @@ -210,6 +217,7 @@ module Errors { >foo16 : { (a2: { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo17(a2: { >foo17 : { (a2: { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } @@ -251,6 +259,7 @@ module Errors { >foo17 : { (a2: { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r1 = foo2((x: T) => null); // any >r1 : (x: number) => string[] @@ -412,7 +421,9 @@ module Errors { var r3 = foo8(r3arg); // any >r3 : any +> : ^^^ >foo8(r3arg) : any +> : ^^^ >foo8 : { (a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r3arg : (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U @@ -632,7 +643,9 @@ module Errors { var r7 = foo15(r7arg); // any >r7 : any +> : ^^^ >foo15(r7arg) : any +> : ^^^ >foo15 : { (a2: (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r7arg : (x: { a: T; b: T; }) => T @@ -674,7 +687,9 @@ module Errors { var r7c = foo15(r7arg3); // (x: { a: string; b: number }) => number): number; >r7c : any +> : ^^^ >foo15(r7arg3) : any +> : ^^^ >foo15 : { (a2: (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r7arg3 : (x: { a: T; b: T; }) => number @@ -714,7 +729,9 @@ module Errors { var r8 = foo16(r8arg); // any >r8 : any +> : ^^^ >foo16(r8arg) : any +> : ^^^ >foo16 : { (a2: { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r8arg : (x: (a: T) => T) => T[] @@ -761,6 +778,7 @@ module WithGenericSignaturesInBaseType { >foo2 : { (a2: (x: T) => T[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r2arg2 = (x: T) => ['']; >r2arg2 : (x: T) => string[] @@ -776,7 +794,9 @@ module WithGenericSignaturesInBaseType { var r2 = foo2(r2arg2); // (x:T) => T[] since we can infer from generic signatures now >r2 : any +> : ^^^ >foo2(r2arg2) : any +> : ^^^ >foo2 : { (a2: (x: T) => T[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r2arg2 : (x: T) => string[] @@ -796,6 +816,7 @@ module WithGenericSignaturesInBaseType { >foo3 : { (a2: (x: T) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r3arg2 = (x: T) => null; >r3arg2 : (x: T) => T[] @@ -809,7 +830,9 @@ module WithGenericSignaturesInBaseType { var r3 = foo3(r3arg2); // any >r3 : any +> : ^^^ >foo3(r3arg2) : any +> : ^^^ >foo3 : { (a2: (x: T) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r3arg2 : (x: T) => T[] diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt index b94eb098732..3e0dd88e555 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt @@ -1,3 +1,5 @@ +subtypingWithCallSignaturesWithSpecializedSignatures.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypingWithCallSignaturesWithSpecializedSignatures.ts(38,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithCallSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. The types returned by 'a(...)' are incompatible between these types. Type 'string' is not assignable to type 'number'. @@ -7,10 +9,12 @@ subtypingWithCallSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: In 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== subtypingWithCallSignaturesWithSpecializedSignatures.ts (2 errors) ==== +==== subtypingWithCallSignaturesWithSpecializedSignatures.ts (4 errors) ==== // same as subtypingWithCallSignatures but with additional specialized signatures that should not affect the results module CallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's (x: 'a'): void; @@ -46,6 +50,8 @@ subtypingWithCallSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: In } module MemberWithCallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's a: { diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.errors.txt b/tests/baselines/reference/subtypingWithConstructSignatures3.errors.txt new file mode 100644 index 00000000000..22cb2e3500d --- /dev/null +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.errors.txt @@ -0,0 +1,129 @@ +subtypingWithConstructSignatures3.ts(4,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypingWithConstructSignatures3.ts(110,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== subtypingWithConstructSignatures3.ts (2 errors) ==== + // checking subtype relations for function types as it relates to contextual signature instantiation + // error cases, so function calls will all result in 'any' + + module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + class Base { foo: string; } + class Derived extends Base { bar: string; } + class Derived2 extends Derived { baz: string; } + class OtherDerived extends Base { bing: string; } + + declare function foo2(a2: new (x: number) => string[]): typeof a2; + declare function foo2(a2: any): any; + + declare function foo7(a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; + declare function foo7(a2: any): any; + + declare function foo8(a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; + declare function foo8(a2: any): any; + + declare function foo10(a2: new (...x: Base[]) => Base): typeof a2; + declare function foo10(a2: any): any; + + declare function foo11(a2: new (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; + declare function foo11(a2: any): any; + + declare function foo12(a2: new (x: Array, y: Array) => Array): typeof a2; + declare function foo12(a2: any): any; + + declare function foo15(a2: new (x: { a: string; b: number }) => number): typeof a2; + declare function foo15(a2: any): any; + + declare function foo16(a2: { + // type of parameter is overload set which means we can't do inference based on this type + new (x: { + new (a: number): number; + new (a?: number): number; + }): number[]; + new (x: { + new (a: boolean): boolean; + new (a?: boolean): boolean; + }): boolean[]; + }): typeof a2; + declare function foo16(a2: any): any; + + declare function foo17(a2: { + new (x: { + new (a: T): T; + new (a: T): T; + }): any[]; + new (x: { + new (a: T): T; + new (a: T): T; + }): any[]; + }): typeof a2; + declare function foo17(a2: any): any; + + var r1arg1: new (x: T) => U[]; + var r1arg2: new (x: number) => string[]; + var r1 = foo2(r1arg1); // any + var r1a = [r1arg2, r1arg1]; + var r1b = [r1arg1, r1arg2]; + + var r2arg1: new (x: new (arg: T) => U) => new (r: T) => V; + var r2arg2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2; + var r2 = foo7(r2arg1); // any + var r2a = [r2arg2, r2arg1]; + var r2b = [r2arg1, r2arg2]; + + var r3arg1: new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U; + var r3arg2: new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived; + var r3 = foo8(r3arg1); // any + var r3a = [r3arg2, r3arg1]; + var r3b = [r3arg1, r3arg2]; + + var r4arg1: new (...x: T[]) => T; + var r4arg2: new (...x: Base[]) => Base; + var r4 = foo10(r4arg1); // any + var r4a = [r4arg2, r4arg1]; + var r4b = [r4arg1, r4arg2]; + + var r5arg1: new (x: T, y: T) => T; + var r5arg2: new (x: { foo: string }, y: { foo: string; bar: string }) => Base; + var r5 = foo11(r5arg1); // any + var r5a = [r5arg2, r5arg1]; + var r5b = [r5arg1, r5arg2]; + + var r6arg1: new (x: Array, y: Array) => Array; + var r6arg2: new >(x: Array, y: Array) => T; + var r6 = foo12(r6arg1); // new (x: Array, y: Array) => Array + var r6a = [r6arg2, r6arg1]; + var r6b = [r6arg1, r6arg2]; + + var r7arg1: new (x: { a: T; b: T }) => T; + var r7arg2: new (x: { a: string; b: number }) => number; + var r7 = foo15(r7arg1); // (x: { a: string; b: number }) => number): number; + var r7a = [r7arg2, r7arg1]; + var r7b = [r7arg1, r7arg2]; + + var r7arg3: new (x: { a: T; b: T }) => number; + var r7c = foo15(r7arg3); // any + var r7d = [r7arg2, r7arg3]; + var r7e = [r7arg3, r7arg2]; + + var r8arg: new (x: new (a: T) => T) => T[]; + var r8 = foo16(r8arg); // any + + var r9arg: new (x: new (a: T) => T) => any[]; + var r9 = foo17(r9arg); // // (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; + } + + module WithGenericSignaturesInBaseType { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + declare function foo2(a2: new (x: T) => T[]): typeof a2; + declare function foo2(a2: any): any; + var r2arg2: new (x: T) => string[]; + var r2 = foo2(r2arg2); // (x:T) => T[] since we can infer from generic signatures now + + declare function foo3(a2: new (x: T) => string[]): typeof a2; + declare function foo3(a2: any): any; + var r3arg2: new (x: T) => T[]; + var r3 = foo3(r3arg2); // any + } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index d6cd126a6f6..a489bb19159 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -52,6 +52,7 @@ module Errors { >foo2 : { (a2: new (x: number) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo7(a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; >foo7 : { (a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; (a2: any): any; } @@ -71,6 +72,7 @@ module Errors { >foo7 : { (a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo8(a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; >foo8 : { (a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; (a2: any): any; } @@ -94,6 +96,7 @@ module Errors { >foo8 : { (a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo10(a2: new (...x: Base[]) => Base): typeof a2; >foo10 : { (a2: new (...x: Base[]) => Base): typeof a2; (a2: any): any; } @@ -109,6 +112,7 @@ module Errors { >foo10 : { (a2: new (...x: Base[]) => Base): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo11(a2: new (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; >foo11 : { (a2: new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } @@ -132,6 +136,7 @@ module Errors { >foo11 : { (a2: new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo12(a2: new (x: Array, y: Array) => Array): typeof a2; >foo12 : { (a2: new (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } @@ -149,6 +154,7 @@ module Errors { >foo12 : { (a2: new (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo15(a2: new (x: { a: string; b: number }) => number): typeof a2; >foo15 : { (a2: new (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } @@ -168,6 +174,7 @@ module Errors { >foo15 : { (a2: new (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo16(a2: { >foo16 : { (a2: { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } @@ -210,6 +217,7 @@ module Errors { >foo16 : { (a2: { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ declare function foo17(a2: { >foo17 : { (a2: { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } @@ -251,6 +259,7 @@ module Errors { >foo17 : { (a2: { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r1arg1: new (x: T) => U[]; >r1arg1 : new (x: T) => U[] @@ -376,7 +385,9 @@ module Errors { var r3 = foo8(r3arg1); // any >r3 : any +> : ^^^ >foo8(r3arg1) : any +> : ^^^ >foo8 : { (a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r3arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U @@ -564,7 +575,9 @@ module Errors { var r7 = foo15(r7arg1); // (x: { a: string; b: number }) => number): number; >r7 : any +> : ^^^ >foo15(r7arg1) : any +> : ^^^ >foo15 : { (a2: new (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r7arg1 : new (x: { a: T; b: T; }) => T @@ -602,7 +615,9 @@ module Errors { var r7c = foo15(r7arg3); // any >r7c : any +> : ^^^ >foo15(r7arg3) : any +> : ^^^ >foo15 : { (a2: new (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r7arg3 : new (x: { a: T; b: T; }) => number @@ -638,7 +653,9 @@ module Errors { var r8 = foo16(r8arg); // any >r8 : any +> : ^^^ >foo16(r8arg) : any +> : ^^^ >foo16 : { (a2: { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r8arg : new (x: new (a: T) => T) => T[] @@ -681,6 +698,7 @@ module WithGenericSignaturesInBaseType { >foo2 : { (a2: new (x: T) => T[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r2arg2: new (x: T) => string[]; >r2arg2 : new (x: T) => string[] @@ -690,7 +708,9 @@ module WithGenericSignaturesInBaseType { var r2 = foo2(r2arg2); // (x:T) => T[] since we can infer from generic signatures now >r2 : any +> : ^^^ >foo2(r2arg2) : any +> : ^^^ >foo2 : { (a2: new (x: T) => T[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r2arg2 : new (x: T) => string[] @@ -710,6 +730,7 @@ module WithGenericSignaturesInBaseType { >foo3 : { (a2: new (x: T) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >a2 : any +> : ^^^ var r3arg2: new (x: T) => T[]; >r3arg2 : new (x: T) => T[] @@ -719,7 +740,9 @@ module WithGenericSignaturesInBaseType { var r3 = foo3(r3arg2); // any >r3 : any +> : ^^^ >foo3(r3arg2) : any +> : ^^^ >foo3 : { (a2: new (x: T) => string[]): typeof a2; (a2: any): any; } > : ^^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^ >r3arg2 : new (x: T) => T[] diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt index 5ecff96f90d..8c75ad39ce9 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt @@ -1,3 +1,5 @@ +subtypingWithConstructSignaturesWithSpecializedSignatures.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +subtypingWithConstructSignaturesWithSpecializedSignatures.ts(38,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithConstructSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. The types returned by 'new a(...)' are incompatible between these types. Type 'string' is not assignable to type 'number'. @@ -7,10 +9,12 @@ subtypingWithConstructSignaturesWithSpecializedSignatures.ts(76,15): error TS243 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. -==== subtypingWithConstructSignaturesWithSpecializedSignatures.ts (2 errors) ==== +==== subtypingWithConstructSignaturesWithSpecializedSignatures.ts (4 errors) ==== // same as subtypingWithCallSignatures but with additional specialized signatures that should not affect the results module CallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's new (x: 'a'): void; @@ -46,6 +50,8 @@ subtypingWithConstructSignaturesWithSpecializedSignatures.ts(76,15): error TS243 } module MemberWithCallSignature { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { // T // M's a: { diff --git a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt index a69d2499601..6a2c5d8fe42 100644 --- a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,3 +1,4 @@ +subtypingWithGenericCallSignaturesWithOptionalParameters.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericCallSignaturesWithOptionalParameters.ts(20,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -6,6 +7,7 @@ subtypingWithGenericCallSignaturesWithOptionalParameters.ts(50,15): error TS2430 Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. Target signature provides too few arguments. Expected 2 or more, but got 1. +subtypingWithGenericCallSignaturesWithOptionalParameters.ts(89,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericCallSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. The types returned by 'a()' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -98,6 +100,7 @@ subtypingWithGenericCallSignaturesWithOptionalParameters.ts(172,15): error TS243 Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. +subtypingWithGenericCallSignaturesWithOptionalParameters.ts(177,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericCallSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -108,10 +111,12 @@ subtypingWithGenericCallSignaturesWithOptionalParameters.ts(226,15): error TS243 Target signature provides too few arguments. Expected 2 or more, but got 1. -==== subtypingWithGenericCallSignaturesWithOptionalParameters.ts (22 errors) ==== +==== subtypingWithGenericCallSignaturesWithOptionalParameters.ts (25 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the base type module ClassTypeParam { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { a: () => T; a2: (x?: T) => T; @@ -208,6 +213,8 @@ subtypingWithGenericCallSignaturesWithOptionalParameters.ts(226,15): error TS243 } module GenericSignaturesInvalid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // all of these are errors interface Base2 { @@ -422,6 +429,8 @@ subtypingWithGenericCallSignaturesWithOptionalParameters.ts(226,15): error TS243 } module GenericSignaturesValid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base2 { a: () => T; diff --git a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt index 962bd6f02a2..a1cf562fc10 100644 --- a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt @@ -1,3 +1,4 @@ +subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(3,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(20,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -6,6 +7,7 @@ subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(50,15): error T Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. Target signature provides too few arguments. Expected 2 or more, but got 1. +subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(89,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. The types returned by 'new a()' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -98,6 +100,7 @@ subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(172,15): error Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. +subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(177,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -108,10 +111,12 @@ subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(226,15): error Target signature provides too few arguments. Expected 2 or more, but got 1. -==== subtypingWithGenericConstructSignaturesWithOptionalParameters.ts (22 errors) ==== +==== subtypingWithGenericConstructSignaturesWithOptionalParameters.ts (25 errors) ==== // call signatures in derived types must have the same or fewer optional parameters as the base type module ClassTypeParam { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base { a: new () => T; a2: new (x?: T) => T; @@ -208,6 +213,8 @@ subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(226,15): error } module GenericSignaturesInvalid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // all of these are errors interface Base2 { @@ -422,6 +429,8 @@ subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(226,15): error } module GenericSignaturesValid { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Base2 { a: new () => T; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt index 4ffb55f7afd..7ed0d3bf5c3 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt @@ -1,6 +1,7 @@ subtypingWithNumericIndexer2.ts(11,11): error TS2430: Interface 'B' incorrectly extends interface 'A'. 'number' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. +subtypingWithNumericIndexer2.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithNumericIndexer2.ts(24,27): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithNumericIndexer2.ts(32,15): error TS2430: Interface 'B3' incorrectly extends interface 'A'. @@ -17,7 +18,7 @@ subtypingWithNumericIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrec 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. -==== subtypingWithNumericIndexer2.ts (5 errors) ==== +==== subtypingWithNumericIndexer2.ts (6 errors) ==== // Derived type indexer must be subtype of base type indexer interface Base { foo: string; } @@ -42,6 +43,8 @@ subtypingWithNumericIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrec } module Generics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { [x: number]: T; } diff --git a/tests/baselines/reference/subtypingWithObjectMembers.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers.errors.txt index 3a4205341f9..bb87877ab5f 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers.errors.txt @@ -4,6 +4,7 @@ subtypingWithObjectMembers.ts(24,5): error TS2416: Property '2' in type 'B2' is Type 'string' is not assignable to type 'Base'. subtypingWithObjectMembers.ts(34,5): error TS2416: Property ''2.0'' in type 'B3' is not assignable to the same property in base type 'A3'. Type 'string' is not assignable to type 'Base'. +subtypingWithObjectMembers.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers.ts(45,9): error TS2416: Property 'bar' in type 'B' is not assignable to the same property in base type 'A'. Type 'string' is not assignable to type 'Base'. subtypingWithObjectMembers.ts(55,9): error TS2416: Property '2' in type 'B2' is not assignable to the same property in base type 'A2'. @@ -12,7 +13,7 @@ subtypingWithObjectMembers.ts(65,9): error TS2416: Property ''2.0'' in type 'B3' Type 'string' is not assignable to type 'Base'. -==== subtypingWithObjectMembers.ts (6 errors) ==== +==== subtypingWithObjectMembers.ts (7 errors) ==== class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } @@ -59,6 +60,8 @@ subtypingWithObjectMembers.ts(65,9): error TS2416: Property ''2.0'' in type 'B3' } module TwoLevels { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { foo: Base; bar: Base; diff --git a/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt index 391292aadbd..b9146a14ca4 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers2.errors.txt @@ -1,3 +1,4 @@ +subtypingWithObjectMembers2.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers2.ts(17,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. Type 'string' is not assignable to type 'Base'. @@ -7,6 +8,7 @@ subtypingWithObjectMembers2.ts(27,15): error TS2430: Interface 'B2' incorrectly subtypingWithObjectMembers2.ts(37,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'. Types of property ''2.0'' are incompatible. Type 'string' is not assignable to type 'Base'. +subtypingWithObjectMembers2.ts(44,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers2.ts(50,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. Type 'string' is not assignable to type 'Base'. @@ -18,7 +20,7 @@ subtypingWithObjectMembers2.ts(70,15): error TS2430: Interface 'B3' incorrectly Type 'string' is not assignable to type 'Base'. -==== subtypingWithObjectMembers2.ts (6 errors) ==== +==== subtypingWithObjectMembers2.ts (8 errors) ==== interface Base { foo: string; } @@ -30,6 +32,8 @@ subtypingWithObjectMembers2.ts(70,15): error TS2430: Interface 'B3' incorrectly // N and M have the same name, same accessibility, same optionality, and N is a subtype of M // foo properties are valid, bar properties cause errors in the derived class declarations module NotOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo: Base; bar: Base; @@ -75,6 +79,8 @@ subtypingWithObjectMembers2.ts(70,15): error TS2430: Interface 'B3' incorrectly // same cases as above but with optional module Optional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo?: Base; bar?: Base; diff --git a/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt index c69465b1ee1..08af4716892 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt @@ -1,3 +1,4 @@ +subtypingWithObjectMembers3.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers3.ts(17,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. @@ -7,6 +8,7 @@ subtypingWithObjectMembers3.ts(27,15): error TS2430: Interface 'B2' incorrectly subtypingWithObjectMembers3.ts(37,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'. Types of property ''2.0'' are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. +subtypingWithObjectMembers3.ts(43,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers3.ts(49,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. @@ -18,7 +20,7 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly Property 'bar' is missing in type 'Base' but required in type 'Derived'. -==== subtypingWithObjectMembers3.ts (6 errors) ==== +==== subtypingWithObjectMembers3.ts (8 errors) ==== interface Base { foo: string; } @@ -30,6 +32,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly // N and M have the same name, same accessibility, same optionality, and N is a subtype of M // foo properties are valid, bar properties cause errors in the derived class declarations module NotOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo: Base; bar: Derived; @@ -77,6 +81,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly } module Optional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo?: Base; bar?: Derived; diff --git a/tests/baselines/reference/subtypingWithObjectMembers5.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers5.errors.txt index d5251e2ce7a..c8f9a840e20 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers5.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers5.errors.txt @@ -1,15 +1,17 @@ +subtypingWithObjectMembers5.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers5.ts(16,11): error TS2420: Class 'B' incorrectly implements interface 'A'. Property 'foo' is missing in type 'B' but required in type 'A'. subtypingWithObjectMembers5.ts(24,11): error TS2420: Class 'B2' incorrectly implements interface 'A2'. Property '1' is missing in type 'B2' but required in type 'A2'. subtypingWithObjectMembers5.ts(32,11): error TS2420: Class 'B3' incorrectly implements interface 'A3'. Property ''1'' is missing in type 'B3' but required in type 'A3'. +subtypingWithObjectMembers5.ts(38,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembers5.ts(43,11): error TS2559: Type 'B' has no properties in common with type 'A'. subtypingWithObjectMembers5.ts(51,11): error TS2559: Type 'B2' has no properties in common with type 'A2'. subtypingWithObjectMembers5.ts(59,11): error TS2559: Type 'B3' has no properties in common with type 'A3'. -==== subtypingWithObjectMembers5.ts (6 errors) ==== +==== subtypingWithObjectMembers5.ts (8 errors) ==== interface Base { foo: string; } @@ -21,6 +23,8 @@ subtypingWithObjectMembers5.ts(59,11): error TS2559: Type 'B3' has no properties // N and M have the same name, same accessibility, same optionality, and N is a subtype of M // foo properties are valid, bar properties cause errors in the derived class declarations module NotOptional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo: Base; } @@ -60,6 +64,8 @@ subtypingWithObjectMembers5.ts(59,11): error TS2559: Type 'B3' has no properties // same cases as above but with optional module Optional { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { foo?: Base; } diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt index bb4fec3208f..8558d08205a 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt @@ -1,9 +1,11 @@ +subtypingWithObjectMembersAccessibility2.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembersAccessibility2.ts(16,11): error TS2415: Class 'B' incorrectly extends base class 'A'. Property 'foo' is private in type 'A' but not in type 'B'. subtypingWithObjectMembersAccessibility2.ts(24,11): error TS2415: Class 'B2' incorrectly extends base class 'A2'. Property '1' is private in type 'A2' but not in type 'B2'. subtypingWithObjectMembersAccessibility2.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A3'. Property ''1'' is private in type 'A3' but not in type 'B3'. +subtypingWithObjectMembersAccessibility2.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithObjectMembersAccessibility2.ts(42,11): error TS2415: Class 'B' incorrectly extends base class 'A'. Property 'foo' is private in type 'A' but not in type 'B'. subtypingWithObjectMembersAccessibility2.ts(50,11): error TS2415: Class 'B2' incorrectly extends base class 'A2'. @@ -12,7 +14,7 @@ subtypingWithObjectMembersAccessibility2.ts(58,11): error TS2415: Class 'B3' inc Property ''1'' is private in type 'A3' but not in type 'B3'. -==== subtypingWithObjectMembersAccessibility2.ts (6 errors) ==== +==== subtypingWithObjectMembersAccessibility2.ts (8 errors) ==== // Derived member is private, base member is not causes errors class Base { @@ -24,6 +26,8 @@ subtypingWithObjectMembersAccessibility2.ts(58,11): error TS2415: Class 'B3' inc } module ExplicitPublic { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { private foo: Base; } @@ -59,6 +63,8 @@ subtypingWithObjectMembersAccessibility2.ts(58,11): error TS2415: Class 'B3' inc } module ImplicitPublic { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { private foo: Base; } diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.errors.txt b/tests/baselines/reference/subtypingWithObjectMembersOptionality.errors.txt new file mode 100644 index 00000000000..055b5da2659 --- /dev/null +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.errors.txt @@ -0,0 +1,79 @@ +subtypingWithObjectMembersOptionality.ts(44,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== subtypingWithObjectMembersOptionality.ts (1 errors) ==== + // Derived member is not optional but base member is, should be ok + + interface Base { foo: string; } + interface Derived extends Base { bar: string; } + interface Derived2 extends Derived { baz: string; } + + // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: + // - S' and T are object types and, for each member M in T, one of the following is true: + // - M is a property and S' contains a property N where + // M and N have the same name, + // the type of N is a subtype of that of M, + // M and N are both public or both private, and + // if M is a required property, N is also a required property. + // - M is an optional property and S' contains no property of the same name as M. + interface T { + Foo?: Base; + } + + interface S extends T { + Foo: Derived + } + + interface T2 { + 1?: Base; + } + + interface S2 extends T2 { + 1: Derived; + } + + interface T3 { + '1'?: Base; + } + + interface S3 extends T3 { + '1.': Derived; + } + + // object literal case + var a: { Foo?: Base; }; + var b = { Foo: null }; + var r = true ? a : b; + + module TwoLevels { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface T { + Foo?: Base; + } + + interface S extends T { + Foo: Derived2 + } + + interface T2 { + 1?: Base; + } + + interface S2 extends T2 { + 1: Derived2; + } + + interface T3 { + '1'?: Base; + } + + interface S3 extends T3 { + '1.': Derived2; + } + + // object literal case + var a: { Foo?: Base; }; + var b = { Foo: null }; + var r = true ? a : b; + } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt index 2097ececc05..da735191b60 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt @@ -1,6 +1,7 @@ subtypingWithStringIndexer3.ts(11,7): error TS2415: Class 'B' incorrectly extends base class 'A'. 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. +subtypingWithStringIndexer3.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. subtypingWithStringIndexer3.ts(24,23): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithStringIndexer3.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. @@ -17,7 +18,7 @@ subtypingWithStringIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly e 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. -==== subtypingWithStringIndexer3.ts (5 errors) ==== +==== subtypingWithStringIndexer3.ts (6 errors) ==== // Derived type indexer must be subtype of base type indexer interface Base { foo: string; } @@ -42,6 +43,8 @@ subtypingWithStringIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly e } module Generics { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. class A { [x: string]: T; } diff --git a/tests/baselines/reference/superAccessInFatArrow1.errors.txt b/tests/baselines/reference/superAccessInFatArrow1.errors.txt new file mode 100644 index 00000000000..f940963be37 --- /dev/null +++ b/tests/baselines/reference/superAccessInFatArrow1.errors.txt @@ -0,0 +1,21 @@ +superAccessInFatArrow1.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== superAccessInFatArrow1.ts (1 errors) ==== + module test { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class A { + foo() { + } + } + export class B extends A { + bar(callback: () => void ) { + } + runme() { + this.bar(() => { + super.foo(); + }); + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/switchStatements.errors.txt b/tests/baselines/reference/switchStatements.errors.txt index 5ffcf502b7b..0041af22e6e 100644 --- a/tests/baselines/reference/switchStatements.errors.txt +++ b/tests/baselines/reference/switchStatements.errors.txt @@ -1,8 +1,11 @@ +switchStatements.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. switchStatements.ts(35,20): error TS2353: Object literal may only specify known properties, and 'name' does not exist in type 'C'. -==== switchStatements.ts (1 errors) ==== +==== switchStatements.ts (2 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export function fn(x: number) { return ''; } diff --git a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt index d9c0e5a618b..6df2d68ee6c 100644 --- a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt +++ b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt @@ -1,9 +1,12 @@ +symbolDeclarationEmit12.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. symbolDeclarationEmit12.ts(9,13): error TS2300: Duplicate identifier '[Symbol.toPrimitive]'. symbolDeclarationEmit12.ts(10,13): error TS2300: Duplicate identifier '[Symbol.toPrimitive]'. -==== symbolDeclarationEmit12.ts (2 errors) ==== +==== symbolDeclarationEmit12.ts (3 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface I { } export class C { [Symbol.iterator]: I; diff --git a/tests/baselines/reference/symbolProperty55.errors.txt b/tests/baselines/reference/symbolProperty55.errors.txt new file mode 100644 index 00000000000..16dff4d599c --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.errors.txt @@ -0,0 +1,16 @@ +symbolProperty55.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== symbolProperty55.ts (1 errors) ==== + var obj = { + [Symbol.iterator]: 0 + }; + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty56.errors.txt b/tests/baselines/reference/symbolProperty56.errors.txt new file mode 100644 index 00000000000..dbd12421f5d --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.errors.txt @@ -0,0 +1,16 @@ +symbolProperty56.ts(5,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== symbolProperty56.ts (1 errors) ==== + var obj = { + [Symbol.iterator]: 0 + }; + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty56.types b/tests/baselines/reference/symbolProperty56.types index 45b764021ad..ffb708bf821 100644 --- a/tests/baselines/reference/symbolProperty56.types +++ b/tests/baselines/reference/symbolProperty56.types @@ -32,10 +32,12 @@ module M { // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. obj[Symbol["iterator"]]; ->obj[Symbol["iterator"]] : error +>obj[Symbol["iterator"]] : any +> : ^^^ >obj : { [Symbol.iterator]: number; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Symbol["iterator"] : error +>Symbol["iterator"] : any +> : ^^^ >Symbol : {} > : ^^ >"iterator" : "iterator" diff --git a/tests/baselines/reference/systemModuleConstEnums.errors.txt b/tests/baselines/reference/systemModuleConstEnums.errors.txt new file mode 100644 index 00000000000..5640746d9dd --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnums.errors.txt @@ -0,0 +1,17 @@ +systemModuleConstEnums.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== systemModuleConstEnums.ts (1 errors) ==== + declare function use(a: any); + const enum TopLevelConstEnum { X } + + export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum NonTopLevelConstEnum { X } + } \ No newline at end of file diff --git a/tests/baselines/reference/systemModuleConstEnums.types b/tests/baselines/reference/systemModuleConstEnums.types index 56d1f19b1e2..5c81a34b24f 100644 --- a/tests/baselines/reference/systemModuleConstEnums.types +++ b/tests/baselines/reference/systemModuleConstEnums.types @@ -5,6 +5,7 @@ declare function use(a: any); >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >a : any +> : ^^^ const enum TopLevelConstEnum { X } >TopLevelConstEnum : TopLevelConstEnum @@ -18,6 +19,7 @@ export function foo() { use(TopLevelConstEnum.X); >use(TopLevelConstEnum.X) : any +> : ^^^ >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >TopLevelConstEnum.X : TopLevelConstEnum @@ -29,6 +31,7 @@ export function foo() { use(M.NonTopLevelConstEnum.X); >use(M.NonTopLevelConstEnum.X) : any +> : ^^^ >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.errors.txt b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.errors.txt new file mode 100644 index 00000000000..fc401b52632 --- /dev/null +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.errors.txt @@ -0,0 +1,17 @@ +systemModuleConstEnumsSeparateCompilation.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== systemModuleConstEnumsSeparateCompilation.ts (1 errors) ==== + declare function use(a: any); + const enum TopLevelConstEnum { X } + + export function foo() { + use(TopLevelConstEnum.X); + use(M.NonTopLevelConstEnum.X); + } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export const enum NonTopLevelConstEnum { X } + } \ No newline at end of file diff --git a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types index 89c2edb8e0e..4c915efbf94 100644 --- a/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types +++ b/tests/baselines/reference/systemModuleConstEnumsSeparateCompilation.types @@ -5,6 +5,7 @@ declare function use(a: any); >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >a : any +> : ^^^ const enum TopLevelConstEnum { X } >TopLevelConstEnum : TopLevelConstEnum @@ -18,6 +19,7 @@ export function foo() { use(TopLevelConstEnum.X); >use(TopLevelConstEnum.X) : any +> : ^^^ >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >TopLevelConstEnum.X : TopLevelConstEnum @@ -29,6 +31,7 @@ export function foo() { use(M.NonTopLevelConstEnum.X); >use(M.NonTopLevelConstEnum.X) : any +> : ^^^ >use : (a: any) => any > : ^ ^^ ^^^^^^^^ >M.NonTopLevelConstEnum.X : M.NonTopLevelConstEnum diff --git a/tests/baselines/reference/thisBinding.errors.txt b/tests/baselines/reference/thisBinding.errors.txt index 44b2c84be07..aa4b3c5b608 100644 --- a/tests/baselines/reference/thisBinding.errors.txt +++ b/tests/baselines/reference/thisBinding.errors.txt @@ -1,8 +1,11 @@ +thisBinding.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. thisBinding.ts(9,8): error TS2339: Property 'e' does not exist on type 'I'. -==== thisBinding.ts (1 errors) ==== +==== thisBinding.ts (2 errors) ==== module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I { z; } diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index c123b758ac6..04b7a1be854 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -1,5 +1,6 @@ thisInInvalidContextsExternalModule.ts(9,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. thisInInvalidContextsExternalModule.ts(17,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +thisInInvalidContextsExternalModule.ts(21,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. thisInInvalidContextsExternalModule.ts(23,13): error TS2331: 'this' cannot be referenced in a module or namespace body. thisInInvalidContextsExternalModule.ts(31,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface. thisInInvalidContextsExternalModule.ts(33,25): error TS2507: Type 'undefined' is not a constructor function type. @@ -7,7 +8,7 @@ thisInInvalidContextsExternalModule.ts(39,9): error TS2332: 'this' cannot be ref thisInInvalidContextsExternalModule.ts(40,9): error TS2332: 'this' cannot be referenced in current location. -==== thisInInvalidContextsExternalModule.ts (7 errors) ==== +==== thisInInvalidContextsExternalModule.ts (8 errors) ==== class BaseErrClass { constructor(t: any) { } } @@ -33,6 +34,8 @@ thisInInvalidContextsExternalModule.ts(40,9): error TS2332: 'this' cannot be ref } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. //'this' in module variable var x = this; // Error ~~~~ diff --git a/tests/baselines/reference/this_inside-object-literal-getters-and-setters.errors.txt b/tests/baselines/reference/this_inside-object-literal-getters-and-setters.errors.txt new file mode 100644 index 00000000000..7d4d310956e --- /dev/null +++ b/tests/baselines/reference/this_inside-object-literal-getters-and-setters.errors.txt @@ -0,0 +1,22 @@ +this_inside-object-literal-getters-and-setters.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== this_inside-object-literal-getters-and-setters.ts (1 errors) ==== + module ObjectLiteral { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var ThisInObjectLiteral = { + _foo: '1', + get foo(): string { + return this._foo; + }, + set foo(value: string) { + this._foo = value; + }, + test: function () { + return this._foo; + } + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/this_inside-object-literal-getters-and-setters.types b/tests/baselines/reference/this_inside-object-literal-getters-and-setters.types index fb1143f861b..ddc5581dd4c 100644 --- a/tests/baselines/reference/this_inside-object-literal-getters-and-setters.types +++ b/tests/baselines/reference/this_inside-object-literal-getters-and-setters.types @@ -23,6 +23,7 @@ module ObjectLiteral { return this._foo; >this._foo : any +> : ^^^ >this : any > : ^^^ >_foo : any @@ -39,6 +40,7 @@ module ObjectLiteral { >this._foo = value : string > : ^^^^^^ >this._foo : any +> : ^^^ >this : any > : ^^^ >_foo : any @@ -55,6 +57,7 @@ module ObjectLiteral { return this._foo; >this._foo : any +> : ^^^ >this : any > : ^^^ >_foo : any diff --git a/tests/baselines/reference/throwStatements.errors.txt b/tests/baselines/reference/throwStatements.errors.txt new file mode 100644 index 00000000000..5f26b86a96e --- /dev/null +++ b/tests/baselines/reference/throwStatements.errors.txt @@ -0,0 +1,91 @@ +throwStatements.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== throwStatements.ts (1 errors) ==== + // all legal + + interface I { + id: number; + } + + class C implements I { + id: number; + } + + class D{ + source: T; + recurse: D; + wrapped: D> + } + + function F(x: string): number { return 42; } + + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class A { + name: string; + } + + export function F2(x: number): string { return x.toString(); } + } + + var aNumber = 9.9; + throw aNumber; + var aString = 'this is a string'; + throw aString; + var aDate = new Date(12); + throw aDate; + var anObject = new Object(); + throw anObject; + + var anAny = null; + throw anAny; + var anOtherAny = new C(); + throw anOtherAny; + var anUndefined = undefined; + throw anUndefined; + + var aClass = new C(); + throw aClass; + var aGenericClass = new D(); + throw aGenericClass; + var anObjectLiteral = { id: 12 }; + throw anObjectLiteral; + + var aFunction = F; + throw aFunction; + throw aFunction(''); + var aLambda = (x) => 2; + throw aLambda; + throw aLambda(1); + + var aModule = M; + throw aModule; + throw typeof M; + var aClassInModule = new M.A(); + throw aClassInModule; + var aFunctionInModule = M.F2; + throw aFunctionInModule; + + // no initializer or annotation, so this is an 'any' + var x; + throw x; + + // literals + throw 0.0; + throw false; + throw null; + throw undefined; + throw 'a string'; + throw function () { return 'a string' }; + throw (x:T) => 42; + throw { x: 12, y: 13 }; + throw []; + throw ['a', ['b']]; + throw /[a-z]/; + throw new Date(); + throw new C(); + throw new Object(); + throw new D(); + \ No newline at end of file diff --git a/tests/baselines/reference/throwStatements.types b/tests/baselines/reference/throwStatements.types index 697b9d5d871..9dadb89c2a9 100644 --- a/tests/baselines/reference/throwStatements.types +++ b/tests/baselines/reference/throwStatements.types @@ -119,13 +119,17 @@ throw anObject; var anAny = null; >anAny : any +> : ^^^ throw anAny; >anAny : any +> : ^^^ var anOtherAny = new C(); >anOtherAny : any +> : ^^^ > new C() : any +> : ^^^ >new C() : C > : ^ >C : typeof C @@ -133,14 +137,17 @@ var anOtherAny = new C(); throw anOtherAny; >anOtherAny : any +> : ^^^ var anUndefined = undefined; >anUndefined : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ throw anUndefined; >anUndefined : any +> : ^^^ var aClass = new C(); >aClass : C @@ -204,6 +211,7 @@ var aLambda = (x) => 2; >(x) => 2 : (x: any) => number > : ^ ^^^^^^^^^^^^^^^^ >x : any +> : ^^^ >2 : 2 > : ^ @@ -268,9 +276,11 @@ throw aFunctionInModule; // no initializer or annotation, so this is an 'any' var x; >x : any +> : ^^^ throw x; >x : any +> : ^^^ // literals throw 0.0; diff --git a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt index 339091ece5b..021840ccd5c 100644 --- a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt +++ b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt @@ -1,3 +1,4 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(10,8): error TS1003: Identifier expected. file.tsx(10,10): error TS1005: ';' expected. file.tsx(10,10): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. @@ -13,8 +14,10 @@ file.tsx(11,13): error TS1005: ';' expected. file.tsx(11,19): error TS1161: Unterminated regular expression literal. -==== file.tsx (13 errors) ==== +==== file.tsx (14 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { test1: { "data-foo"?: string }; diff --git a/tests/baselines/reference/tsxAttributeResolution2.errors.txt b/tests/baselines/reference/tsxAttributeResolution2.errors.txt index a883324c5ad..3a728551da2 100644 --- a/tests/baselines/reference/tsxAttributeResolution2.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution2.errors.txt @@ -1,8 +1,11 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(17,21): error TS2339: Property 'leng' does not exist on type 'string'. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { test1: Attribs1; diff --git a/tests/baselines/reference/tsxAttributeResolution4.errors.txt b/tests/baselines/reference/tsxAttributeResolution4.errors.txt index 2f74bf4ab3d..c1f72e16abf 100644 --- a/tests/baselines/reference/tsxAttributeResolution4.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution4.errors.txt @@ -1,8 +1,11 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(15,26): error TS2339: Property 'len' does not exist on type 'string'. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { test1: Attribs1; diff --git a/tests/baselines/reference/tsxAttributeResolution6.errors.txt b/tests/baselines/reference/tsxAttributeResolution6.errors.txt index 343c4a27098..840373c81c7 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution6.errors.txt @@ -1,10 +1,13 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(10,8): error TS2322: Type 'boolean' is not assignable to type 'string'. file.tsx(11,8): error TS2322: Type 'string' is not assignable to type 'boolean'. file.tsx(12,2): error TS2741: Property 'n' is missing in type '{}' but required in type '{ n: boolean; }'. -==== file.tsx (3 errors) ==== +==== file.tsx (4 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { test1: { n?: boolean; s?: string}; diff --git a/tests/baselines/reference/tsxAttributeResolution7.errors.txt b/tests/baselines/reference/tsxAttributeResolution7.errors.txt index 66020bf8916..c5b55e9d6a7 100644 --- a/tests/baselines/reference/tsxAttributeResolution7.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution7.errors.txt @@ -1,10 +1,13 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(9,2): error TS2322: Type '{ "data-foo": number; }' is not assignable to type '{ "data-foo"?: string; }'. Types of property '"data-foo"' are incompatible. Type 'number' is not assignable to type 'string'. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { test1: { "data-foo"?: string }; diff --git a/tests/baselines/reference/tsxDynamicTagName2.errors.txt b/tests/baselines/reference/tsxDynamicTagName2.errors.txt index 2d65c21ad0e..92fdf81cc0c 100644 --- a/tests/baselines/reference/tsxDynamicTagName2.errors.txt +++ b/tests/baselines/reference/tsxDynamicTagName2.errors.txt @@ -1,9 +1,12 @@ +tsxDynamicTagName2.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. tsxDynamicTagName2.tsx(9,1): error TS2339: Property 'customTag' does not exist on type 'JSX.IntrinsicElements'. tsxDynamicTagName2.tsx(9,25): error TS2339: Property 'customTag' does not exist on type 'JSX.IntrinsicElements'. -==== tsxDynamicTagName2.tsx (2 errors) ==== +==== tsxDynamicTagName2.tsx (3 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { div: any diff --git a/tests/baselines/reference/tsxDynamicTagName3.errors.txt b/tests/baselines/reference/tsxDynamicTagName3.errors.txt index 0e35fd3af45..41fbf51bdc9 100644 --- a/tests/baselines/reference/tsxDynamicTagName3.errors.txt +++ b/tests/baselines/reference/tsxDynamicTagName3.errors.txt @@ -1,9 +1,12 @@ +tsxDynamicTagName3.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. tsxDynamicTagName3.tsx(9,1): error TS2339: Property 'h1' does not exist on type 'JSX.IntrinsicElements'. tsxDynamicTagName3.tsx(9,2): error TS2604: JSX element type 'CustomTag' does not have any construct or call signatures. -==== tsxDynamicTagName3.tsx (2 errors) ==== +==== tsxDynamicTagName3.tsx (3 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { div: any diff --git a/tests/baselines/reference/tsxElementResolution13.errors.txt b/tests/baselines/reference/tsxElementResolution13.errors.txt new file mode 100644 index 00000000000..be4af881805 --- /dev/null +++ b/tests/baselines/reference/tsxElementResolution13.errors.txt @@ -0,0 +1,17 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== file.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + interface ElementAttributesProperty { pr1: any; pr2: any; } + } + + interface Obj1 { + new(n: string): any; + } + var obj1: Obj1; + ; // Error + \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution13.types b/tests/baselines/reference/tsxElementResolution13.types index 3f0b05cbc05..e153ff2d87e 100644 --- a/tests/baselines/reference/tsxElementResolution13.types +++ b/tests/baselines/reference/tsxElementResolution13.types @@ -5,7 +5,9 @@ declare module JSX { interface Element { } interface ElementAttributesProperty { pr1: any; pr2: any; } >pr1 : any +> : ^^^ >pr2 : any +> : ^^^ } interface Obj1 { diff --git a/tests/baselines/reference/tsxElementResolution15.errors.txt b/tests/baselines/reference/tsxElementResolution15.errors.txt index c445681d5ec..fee184d69e7 100644 --- a/tests/baselines/reference/tsxElementResolution15.errors.txt +++ b/tests/baselines/reference/tsxElementResolution15.errors.txt @@ -1,9 +1,12 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(3,12): error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property. file.tsx(11,2): error TS2322: Type '{ x: number; }' is not assignable to type 'string'. -==== file.tsx (2 errors) ==== +==== file.tsx (3 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface ElementAttributesProperty { pr1: any; pr2: any; } ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/tsxElementResolution19.errors.txt b/tests/baselines/reference/tsxElementResolution19.errors.txt new file mode 100644 index 00000000000..c665cb1f73f --- /dev/null +++ b/tests/baselines/reference/tsxElementResolution19.errors.txt @@ -0,0 +1,23 @@ +file1.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== react.d.ts (0 errors) ==== + declare module "react" { + + } + +==== file1.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + } + export class MyClass { } + +==== file2.tsx (0 errors) ==== + // Should not elide React import + import * as React from 'react'; + import {MyClass} from './file1'; + + ; + \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution19.types b/tests/baselines/reference/tsxElementResolution19.types index 84abd9ed7fe..aa1492af6e4 100644 --- a/tests/baselines/reference/tsxElementResolution19.types +++ b/tests/baselines/reference/tsxElementResolution19.types @@ -26,7 +26,8 @@ import {MyClass} from './file1'; > : ^^^^^^^^^^^^^^ ; -> : error +> : any +> : ^^^ >MyClass : typeof MyClass > : ^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/tsxElementResolution4.errors.txt b/tests/baselines/reference/tsxElementResolution4.errors.txt index a47a97b2e68..cda45e5b73d 100644 --- a/tests/baselines/reference/tsxElementResolution4.errors.txt +++ b/tests/baselines/reference/tsxElementResolution4.errors.txt @@ -1,9 +1,12 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(16,7): error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. Property 'q' does not exist on type '{ m: string; }'. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { div: { n: string; }; diff --git a/tests/baselines/reference/tsxElementResolution7.errors.txt b/tests/baselines/reference/tsxElementResolution7.errors.txt index fbed105e3f6..f5ab44383ec 100644 --- a/tests/baselines/reference/tsxElementResolution7.errors.txt +++ b/tests/baselines/reference/tsxElementResolution7.errors.txt @@ -1,14 +1,21 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +file.tsx(6,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(12,5): error TS2339: Property 'other' does not exist on type 'typeof my'. +file.tsx(14,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(19,11): error TS2339: Property 'non' does not exist on type 'typeof my'. -==== file.tsx (2 errors) ==== +==== file.tsx (5 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { } } module my { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var div: any; } // OK @@ -19,6 +26,8 @@ file.tsx(19,11): error TS2339: Property 'non' does not exist on type 'typeof my' !!! error TS2339: Property 'other' does not exist on type 'typeof my'. module q { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. import mine = my; // OK ; diff --git a/tests/baselines/reference/tsxEmit1.errors.txt b/tests/baselines/reference/tsxEmit1.errors.txt new file mode 100644 index 00000000000..d4f8c7ec663 --- /dev/null +++ b/tests/baselines/reference/tsxEmit1.errors.txt @@ -0,0 +1,46 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== file.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + + var p; + var selfClosed1 =
; + var selfClosed2 =
; + var selfClosed3 =
; + var selfClosed4 =
; + var selfClosed5 =
; + var selfClosed6 =
; + var selfClosed7 =
; + + var openClosed1 =
; + var openClosed2 =
foo
; + var openClosed3 =
{p}
; + var openClosed4 =
{p < p}
; + var openClosed5 =
{p > p}
; + + class SomeClass { + f() { + var rewrites1 =
{() => this}
; + var rewrites2 =
{[p, ...p, p]}
; + var rewrites3 =
{{p}}
; + + var rewrites4 =
this}>
; + var rewrites5 =
; + var rewrites6 =
; + } + } + + var whitespace1 =
; + var whitespace2 =
{p}
; + var whitespace3 =
+ {p} +
; + \ No newline at end of file diff --git a/tests/baselines/reference/tsxEmit1.types b/tests/baselines/reference/tsxEmit1.types index 3d54a51b0ce..3eb4f3b55ee 100644 --- a/tests/baselines/reference/tsxEmit1.types +++ b/tests/baselines/reference/tsxEmit1.types @@ -12,6 +12,7 @@ declare module JSX { var p; >p : any +> : ^^^ var selfClosed1 =
; >selfClosed1 : JSX.Element @@ -89,7 +90,9 @@ var selfClosed7 =
; >div : any > : ^^^ >x : any +> : ^^^ >p : any +> : ^^^ >y : string > : ^^^^^^ @@ -125,6 +128,7 @@ var openClosed3 =
{p}
; >n : string > : ^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -140,7 +144,9 @@ var openClosed4 =
{p < p}
; >p < p : boolean > : ^^^^^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -156,7 +162,9 @@ var openClosed5 =
{p > p}
; >p > p : boolean > : ^^^^^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -192,9 +200,13 @@ class SomeClass { >[p, ...p, p] : any[] > : ^^^^^ >p : any +> : ^^^ >...p : any +> : ^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -208,6 +220,7 @@ class SomeClass { >{p} : { p: any; } > : ^^^^^^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -239,9 +252,13 @@ class SomeClass { >[p, ...p, p] : any[] > : ^^^^^ >p : any +> : ^^^ >...p : any +> : ^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -257,6 +274,7 @@ class SomeClass { >{p} : { p: any; } > : ^^^^^^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ } @@ -280,6 +298,7 @@ var whitespace2 =
{p}
; >div : any > : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -293,6 +312,7 @@ var whitespace3 =
{p} >p : any +> : ^^^
; >div : any diff --git a/tests/baselines/reference/tsxPreserveEmit3.errors.txt b/tests/baselines/reference/tsxPreserveEmit3.errors.txt new file mode 100644 index 00000000000..2b729491b97 --- /dev/null +++ b/tests/baselines/reference/tsxPreserveEmit3.errors.txt @@ -0,0 +1,20 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== file.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + +==== test.d.ts (0 errors) ==== + export var React; + +==== react-consumer.tsx (0 errors) ==== + // This import should be elided + import {React} from "./test"; + \ No newline at end of file diff --git a/tests/baselines/reference/tsxPreserveEmit3.types b/tests/baselines/reference/tsxPreserveEmit3.types index 2419af27a3e..f708932c216 100644 --- a/tests/baselines/reference/tsxPreserveEmit3.types +++ b/tests/baselines/reference/tsxPreserveEmit3.types @@ -13,6 +13,7 @@ declare module JSX { === test.d.ts === export var React; >React : any +> : ^^^ === react-consumer.tsx === // This import should be elided diff --git a/tests/baselines/reference/tsxReactEmit1.errors.txt b/tests/baselines/reference/tsxReactEmit1.errors.txt new file mode 100644 index 00000000000..1bd4eaeb6b2 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmit1.errors.txt @@ -0,0 +1,47 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== file.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + declare var React: any; + + var p; + var selfClosed1 =
; + var selfClosed2 =
; + var selfClosed3 =
; + var selfClosed4 =
; + var selfClosed5 =
; + var selfClosed6 =
; + var selfClosed7 =
; + + var openClosed1 =
; + var openClosed2 =
foo
; + var openClosed3 =
{p}
; + var openClosed4 =
{p < p}
; + var openClosed5 =
{p > p}
; + + class SomeClass { + f() { + var rewrites1 =
{() => this}
; + var rewrites2 =
{[p, ...p, p]}
; + var rewrites3 =
{{p}}
; + + var rewrites4 =
this}>
; + var rewrites5 =
; + var rewrites6 =
; + } + } + + var whitespace1 =
; + var whitespace2 =
{p}
; + var whitespace3 =
+ {p} +
; + \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactEmit1.types b/tests/baselines/reference/tsxReactEmit1.types index dce76f2538c..2f567886e1f 100644 --- a/tests/baselines/reference/tsxReactEmit1.types +++ b/tests/baselines/reference/tsxReactEmit1.types @@ -11,9 +11,11 @@ declare module JSX { } declare var React: any; >React : any +> : ^^^ var p; >p : any +> : ^^^ var selfClosed1 =
; >selfClosed1 : JSX.Element @@ -91,7 +93,9 @@ var selfClosed7 =
; >div : any > : ^^^ >x : any +> : ^^^ >p : any +> : ^^^ >y : string > : ^^^^^^ >b : true @@ -129,6 +133,7 @@ var openClosed3 =
{p}
; >n : string > : ^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -144,7 +149,9 @@ var openClosed4 =
{p < p}
; >p < p : boolean > : ^^^^^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -162,7 +169,9 @@ var openClosed5 =
{p > p}
; >p > p : boolean > : ^^^^^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -198,9 +207,13 @@ class SomeClass { >[p, ...p, p] : any[] > : ^^^^^ >p : any +> : ^^^ >...p : any +> : ^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -214,6 +227,7 @@ class SomeClass { >{p} : { p: any; } > : ^^^^^^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -245,9 +259,13 @@ class SomeClass { >[p, ...p, p] : any[] > : ^^^^^ >p : any +> : ^^^ >...p : any +> : ^^^ >p : any +> : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -263,6 +281,7 @@ class SomeClass { >{p} : { p: any; } > : ^^^^^^^^^^^ >p : any +> : ^^^ >div : any > : ^^^ } @@ -286,6 +305,7 @@ var whitespace2 =
{p}
; >div : any > : ^^^ >p : any +> : ^^^ >div : any > : ^^^ @@ -299,6 +319,7 @@ var whitespace3 =
{p} >p : any +> : ^^^
; >div : any diff --git a/tests/baselines/reference/tsxReactEmit4.errors.txt b/tests/baselines/reference/tsxReactEmit4.errors.txt index cd634c4a239..ab2e08eb265 100644 --- a/tests/baselines/reference/tsxReactEmit4.errors.txt +++ b/tests/baselines/reference/tsxReactEmit4.errors.txt @@ -1,8 +1,11 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. file.tsx(12,5): error TS2304: Cannot find name 'blah'. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Element { } interface IntrinsicElements { [s: string]: any; diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.errors.txt b/tests/baselines/reference/tsxReactEmitWhitespace2.errors.txt new file mode 100644 index 00000000000..0a4e5bd6784 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.errors.txt @@ -0,0 +1,22 @@ +file.tsx(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== file.tsx (1 errors) ==== + declare module JSX { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + declare var React: any; + + // Emit ' word' in the last string +
word code word
; + // Same here +
code word
; + // And here +
word
; + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.types b/tests/baselines/reference/tsxReactEmitWhitespace2.types index 9462fc05066..100cedd7dcd 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace2.types +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.types @@ -11,6 +11,7 @@ declare module JSX { } declare var React: any; >React : any +> : ^^^ // Emit ' word' in the last string
word code word
; diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index a64ab9200f0..eb175d81362 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -1,12 +1,17 @@ twoGenericInterfacesWithDifferentConstraints.ts(1,11): error TS2428: All declarations of 'A' must have identical type parameters. twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +twoGenericInterfacesWithDifferentConstraints.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. twoGenericInterfacesWithDifferentConstraints.ts(10,15): error TS2428: All declarations of 'B' must have identical type parameters. twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of 'B' must have identical type parameters. +twoGenericInterfacesWithDifferentConstraints.ts(19,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +twoGenericInterfacesWithDifferentConstraints.ts(25,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +twoGenericInterfacesWithDifferentConstraints.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. twoGenericInterfacesWithDifferentConstraints.ts(32,22): error TS2428: All declarations of 'A' must have identical type parameters. +twoGenericInterfacesWithDifferentConstraints.ts(37,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. -==== twoGenericInterfacesWithDifferentConstraints.ts (6 errors) ==== +==== twoGenericInterfacesWithDifferentConstraints.ts (11 errors) ==== interface A { ~ !!! error TS2428: All declarations of 'A' must have identical type parameters. @@ -20,6 +25,8 @@ twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declar } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface B> { ~ !!! error TS2428: All declarations of 'B' must have identical type parameters. @@ -34,18 +41,24 @@ twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declar } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { x: T; } } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface A { // ok, different declaration space from other M2.A y: T; } } module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface A { ~ !!! error TS2428: All declarations of 'A' must have identical type parameters. @@ -54,6 +67,8 @@ twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declar } module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface A { // error ~ !!! error TS2428: All declarations of 'A' must have identical type parameters. diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.errors.txt b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.errors.txt new file mode 100644 index 00000000000..a0b9a7247a0 --- /dev/null +++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.errors.txt @@ -0,0 +1,16 @@ +typeAliasDoesntMakeModuleInstantiated.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== typeAliasDoesntMakeModuleInstantiated.ts (1 errors) ==== + declare module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // type alias declaration here shouldnt make the module declaration instantiated + type Selector = string| string[] |Function; + + export interface IStatic { + (selector: any /* Selector */): IInstance; + } + export interface IInstance { } + } + declare var m: m.IStatic; // Should be ok to have var 'm' as module is non instantiated \ No newline at end of file diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types index 58ff347de90..900ae8480a7 100644 --- a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types +++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types @@ -10,6 +10,7 @@ declare module m { export interface IStatic { (selector: any /* Selector */): IInstance; >selector : any +> : ^^^ } export interface IInstance { } } diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.errors.txt b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.errors.txt new file mode 100644 index 00000000000..fff0610d93f --- /dev/null +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.errors.txt @@ -0,0 +1,97 @@ +typeGuardsInFunctionAndModuleBlock.ts(52,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInFunctionAndModuleBlock.ts(54,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInFunctionAndModuleBlock.ts(66,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInFunctionAndModuleBlock.ts(68,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInFunctionAndModuleBlock.ts(68,15): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== typeGuardsInFunctionAndModuleBlock.ts (5 errors) ==== + // typeguards are scoped in function/module block + + function foo(x: number | string | boolean) { + return typeof x === "string" + ? x + : function f() { + var b = x; // number | boolean + return typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + } (); + } + function foo2(x: number | string | boolean) { + return typeof x === "string" + ? x + : function f(a: number | boolean) { + var b = x; // new scope - number | boolean + return typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + } (x); // x here is narrowed to number | boolean + } + function foo3(x: number | string | boolean) { + return typeof x === "string" + ? x + : (() => { + var b = x; // new scope - number | boolean + return typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + })(); + } + function foo4(x: number | string | boolean) { + return typeof x === "string" + ? x + : ((a: number | boolean) => { + var b = x; // new scope - number | boolean + return typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + })(x); // x here is narrowed to number | boolean + } + // Type guards do not affect nested function declarations + function foo5(x: number | string | boolean) { + if (typeof x === "string") { + var y = x; // string; + function foo() { + var z = x; // string + } + } + } + module m { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x: number | string | boolean; + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var b = x; // new scope - number | boolean | string + var y: string; + if (typeof x === "string") { + y = x // string; + } else { + y = typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + } + } + } + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var x: number | string | boolean; + module m2.m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var b = x; // new scope - number | boolean | string + var y: string; + if (typeof x === "string") { + y = x // string; + } else { + y = typeof x === "boolean" + ? x.toString() // boolean + : x.toString(); // number + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInModule.errors.txt b/tests/baselines/reference/typeGuardsInModule.errors.txt new file mode 100644 index 00000000000..aae108ff2a7 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInModule.errors.txt @@ -0,0 +1,105 @@ +typeGuardsInModule.ts(9,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInModule.ts(32,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInModule.ts(35,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInModule.ts(65,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeGuardsInModule.ts(65,11): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== typeGuardsInModule.ts (5 errors) ==== + // Note that type guards affect types of variables and parameters only and + // have no effect on members of objects such as properties. + + // variables in global + var num: number; + var strOrNum: string | number; + var var1: string | number; + // Inside module + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // global vars in function declaration + num = typeof var1 === "string" && var1.length; // string + + // variables in module declaration + var var2: string | number; + if (typeof var2 === "string") { + num = var2.length; // string + } + else { + num = var2; // number + } + + // exported variable in the module + export var var3: string | number; + if (typeof var3 === "string") { + strOrNum = var3; // string | number + } + else { + strOrNum = var3; // string | number + } + } + // local module + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + var var2: string | number; + export var var3: string | number; + module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // global vars in function declaration + num = typeof var1 === "string" && var1.length; // string + + // local variables from outer module declaration + num = typeof var2 === "string" && var2.length; // string + + // exported variable from outer the module + strOrNum = typeof var3 === "string" && var3; // string | number + + // variables in module declaration + var var4: string | number; + if (typeof var4 === "string") { + num = var4.length; // string + } + else { + num = var4; // number + } + + // exported variable in the module + export var var5: string | number; + if (typeof var5 === "string") { + strOrNum = var5; // string | number + } + else { + strOrNum = var5; // string | number + } + } + } + // Dotted module + module m3.m4 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + ~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // global vars in function declaration + num = typeof var1 === "string" && var1.length; // string + + // variables in module declaration + var var2: string | number; + if (typeof var2 === "string") { + num = var2.length; // string + } + else { + num = var2; // number + } + + // exported variable in the module + export var var3: string | number; + if (typeof var3 === "string") { + strOrNum = var3; // string | number + } + else { + strOrNum = var3; // string | number + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.errors.txt b/tests/baselines/reference/typeResolution.errors.txt new file mode 100644 index 00000000000..23e0d93628d --- /dev/null +++ b/tests/baselines/reference/typeResolution.errors.txt @@ -0,0 +1,137 @@ +typeResolution.ts(1,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(2,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(3,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(76,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(77,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(97,5): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(102,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeResolution.ts(103,12): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== typeResolution.ts (8 errors) ==== + export module TopLevelModule1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module SubModule1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module SubSubModule1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class ClassA { + public AisIn1_1_1() { + // Try all qualified names of this type + var a1: ClassA; a1.AisIn1_1_1(); + var a2: SubSubModule1.ClassA; a2.AisIn1_1_1(); + var a3: SubModule1.SubSubModule1.ClassA; a3.AisIn1_1_1(); + var a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA; a4.AisIn1_1_1(); + + // Two variants of qualifying a peer type + var b1: ClassB; b1.BisIn1_1_1(); + var b2: TopLevelModule1.SubModule1.SubSubModule1.ClassB; b2.BisIn1_1_1(); + + // Type only accessible from the root + var c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA; c1.AisIn1_2_2(); + + // Interface reference + var d1: InterfaceX; d1.XisIn1_1_1(); + var d2: SubSubModule1.InterfaceX; d2.XisIn1_1_1(); + } + } + export class ClassB { + public BisIn1_1_1() { + /** Exactly the same as above in AisIn1_1_1 **/ + + // Try all qualified names of this type + var a1: ClassA; a1.AisIn1_1_1(); + var a2: SubSubModule1.ClassA; a2.AisIn1_1_1(); + var a3: SubModule1.SubSubModule1.ClassA; a3.AisIn1_1_1(); + var a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA; a4.AisIn1_1_1(); + + // Two variants of qualifying a peer type + var b1: ClassB; b1.BisIn1_1_1(); + var b2: TopLevelModule1.SubModule1.SubSubModule1.ClassB; b2.BisIn1_1_1(); + + // Type only accessible from the root + var c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA; c1.AisIn1_2_2(); + var c2: TopLevelModule2.SubModule3.ClassA; c2.AisIn2_3(); + + // Interface reference + var d1: InterfaceX; d1.XisIn1_1_1(); + var d2: SubSubModule1.InterfaceX; d2.XisIn1_1_1(); + } + } + export interface InterfaceX { XisIn1_1_1(); } + class NonExportedClassQ { + constructor() { + function QQ() { + /* Sampling of stuff from AisIn1_1_1 */ + var a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA; a4.AisIn1_1_1(); + var c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA; c1.AisIn1_2_2(); + var d1: InterfaceX; d1.XisIn1_1_1(); + var c2: TopLevelModule2.SubModule3.ClassA; c2.AisIn2_3(); + } + } + } + } + + // Should have no effect on S1.SS1.ClassA above because it is not exported + class ClassA { + constructor() { + function AA() { + var a2: SubSubModule1.ClassA; a2.AisIn1_1_1(); + var a3: SubModule1.SubSubModule1.ClassA; a3.AisIn1_1_1(); + var a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA; a4.AisIn1_1_1(); + + // Interface reference + var d2: SubSubModule1.InterfaceX; d2.XisIn1_1_1(); + } + } + } + } + + export module SubModule2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module SubSubModule2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + // No code here since these are the mirror of the above calls + export class ClassA { public AisIn1_2_2() { } } + export class ClassB { public BisIn1_2_2() { } } + export class ClassC { public CisIn1_2_2() { } } + export interface InterfaceY { YisIn1_2_2(); } + interface NonExportedInterfaceQ { } + } + + export interface InterfaceY { YisIn1_2(); } + } + + class ClassA { + public AisIn1() { } + } + + interface InterfaceY { + YisIn1(); + } + + module NotExportedModule { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class ClassA { } + } + } + + module TopLevelModule2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export module SubModule3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export class ClassA { + public AisIn2_3() { } + } + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.types b/tests/baselines/reference/typeResolution.types index fe3a18ca49a..a70db36c170 100644 --- a/tests/baselines/reference/typeResolution.types +++ b/tests/baselines/reference/typeResolution.types @@ -137,6 +137,7 @@ export module TopLevelModule1 { >d1 : InterfaceX > : ^^^^^^^^^^ >d1.XisIn1_1_1() : any +> : ^^^ >d1.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d1 : InterfaceX @@ -150,6 +151,7 @@ export module TopLevelModule1 { >SubSubModule1 : any > : ^^^ >d2.XisIn1_1_1() : any +> : ^^^ >d2.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d2 : InterfaceX @@ -300,6 +302,7 @@ export module TopLevelModule1 { >d1 : InterfaceX > : ^^^^^^^^^^ >d1.XisIn1_1_1() : any +> : ^^^ >d1.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d1 : InterfaceX @@ -313,6 +316,7 @@ export module TopLevelModule1 { >SubSubModule1 : any > : ^^^ >d2.XisIn1_1_1() : any +> : ^^^ >d2.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d2 : InterfaceX @@ -375,6 +379,7 @@ export module TopLevelModule1 { >d1 : InterfaceX > : ^^^^^^^^^^ >d1.XisIn1_1_1() : any +> : ^^^ >d1.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d1 : InterfaceX @@ -467,6 +472,7 @@ export module TopLevelModule1 { >SubSubModule1 : any > : ^^^ >d2.XisIn1_1_1() : any +> : ^^^ >d2.XisIn1_1_1 : () => any > : ^^^^^^^^^ >d2 : SubSubModule1.InterfaceX diff --git a/tests/baselines/reference/typeValueConflict2.errors.txt b/tests/baselines/reference/typeValueConflict2.errors.txt index 49f677e4a8b..4cd293b20a1 100644 --- a/tests/baselines/reference/typeValueConflict2.errors.txt +++ b/tests/baselines/reference/typeValueConflict2.errors.txt @@ -1,14 +1,21 @@ +typeValueConflict2.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +typeValueConflict2.ts(7,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeValueConflict2.ts(10,24): error TS2339: Property 'A' does not exist on type 'number'. +typeValueConflict2.ts(13,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== typeValueConflict2.ts (1 errors) ==== +==== typeValueConflict2.ts (4 errors) ==== module M1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class A { constructor(a: T) { } } } module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. var M1 = 0; // Should error. M1 should bind to the variable, not to the module. class B extends M1.A { @@ -17,6 +24,8 @@ typeValueConflict2.ts(10,24): error TS2339: Property 'A' does not exist on type } } module M3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. // Shouldn't error class B extends M1.A { } diff --git a/tests/baselines/reference/typeofAnExportedType.errors.txt b/tests/baselines/reference/typeofAnExportedType.errors.txt index f252ad3c963..a499059b036 100644 --- a/tests/baselines/reference/typeofAnExportedType.errors.txt +++ b/tests/baselines/reference/typeofAnExportedType.errors.txt @@ -1,9 +1,11 @@ typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. +typeofAnExportedType.ts(23,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. +typeofAnExportedType.ts(45,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. -==== typeofAnExportedType.ts (3 errors) ==== +==== typeofAnExportedType.ts (5 errors) ==== export var x = 1; export var r1: typeof x; export var y = { foo: '' }; @@ -31,6 +33,8 @@ typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or in !!! error TS2323: Cannot redeclare exported variable 'r5'. export module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var foo = ''; export class C { foo: string; @@ -55,6 +59,8 @@ typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or in export function foo() { } export module foo { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var y = 1; export class C { foo: string; diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt index 25c672a3767..e91c39e4434 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt @@ -1,10 +1,11 @@ +typeofOperatorWithAnyOtherType.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofOperatorWithAnyOtherType.ts(46,32): error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'. typeofOperatorWithAnyOtherType.ts(47,32): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. typeofOperatorWithAnyOtherType.ts(48,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. typeofOperatorWithAnyOtherType.ts(58,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== typeofOperatorWithAnyOtherType.ts (4 errors) ==== +==== typeofOperatorWithAnyOtherType.ts (5 errors) ==== // typeof operator on any type var ANY: any; @@ -25,6 +26,8 @@ typeofOperatorWithAnyOtherType.ts(58,1): error TS2695: Left side of comma operat } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.errors.txt b/tests/baselines/reference/typeofOperatorWithBooleanType.errors.txt index 19daef23334..d8995ad9f36 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.errors.txt @@ -1,7 +1,8 @@ +typeofOperatorWithBooleanType.ts(10,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofOperatorWithBooleanType.ts(36,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== typeofOperatorWithBooleanType.ts (1 errors) ==== +==== typeofOperatorWithBooleanType.ts (2 errors) ==== // typeof operator on boolean type var BOOLEAN: boolean; @@ -12,6 +13,8 @@ typeofOperatorWithBooleanType.ts(36,1): error TS2695: Left side of comma operato static foo() { return false; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: boolean; } diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.errors.txt b/tests/baselines/reference/typeofOperatorWithNumberType.errors.txt index d42260f0f26..514c700c695 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithNumberType.errors.txt @@ -1,7 +1,8 @@ +typeofOperatorWithNumberType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofOperatorWithNumberType.ts(45,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== typeofOperatorWithNumberType.ts (1 errors) ==== +==== typeofOperatorWithNumberType.ts (2 errors) ==== // typeof operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -13,6 +14,8 @@ typeofOperatorWithNumberType.ts(45,1): error TS2695: Left side of comma operator static foo() { return 1; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: number; } diff --git a/tests/baselines/reference/typeofOperatorWithStringType.errors.txt b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt index 8d60a1282ad..8ef13fce109 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithStringType.errors.txt @@ -1,7 +1,8 @@ +typeofOperatorWithStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofOperatorWithStringType.ts(44,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== typeofOperatorWithStringType.ts (1 errors) ==== +==== typeofOperatorWithStringType.ts (2 errors) ==== // typeof operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -13,6 +14,8 @@ typeofOperatorWithStringType.ts(44,1): error TS2695: Left side of comma operator static foo() { return ""; } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: string; } diff --git a/tests/baselines/reference/typeofThis.errors.txt b/tests/baselines/reference/typeofThis.errors.txt index 82ca3ffcf1d..50391909448 100644 --- a/tests/baselines/reference/typeofThis.errors.txt +++ b/tests/baselines/reference/typeofThis.errors.txt @@ -2,13 +2,14 @@ typeofThis.ts(24,19): error TS2683: 'this' implicitly has type 'any' because it typeofThis.ts(32,19): error TS18048: 'this' is possibly 'undefined'. typeofThis.ts(46,23): error TS2331: 'this' cannot be referenced in a module or namespace body. typeofThis.ts(46,23): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +typeofThis.ts(50,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. typeofThis.ts(52,23): error TS2331: 'this' cannot be referenced in a module or namespace body. typeofThis.ts(52,23): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. typeofThis.ts(57,19): error TS7041: The containing arrow function captures the global value of 'this'. typeofThis.ts(57,24): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. -==== typeofThis.ts (8 errors) ==== +==== typeofThis.ts (9 errors) ==== class Test { data = {}; constructor() { @@ -67,6 +68,8 @@ typeofThis.ts(57,24): error TS7017: Element implicitly has an 'any' type because } module Test7 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export let f = () => { let x: typeof this.no = 1; ~~~~ diff --git a/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.errors.txt b/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.errors.txt index 557bdfb4dad..fc2ffba4824 100644 --- a/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.errors.txt +++ b/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.errors.txt @@ -1,3 +1,4 @@ +foo_0.ts(6,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. foo_1.ts(5,5): error TS2741: Property 'M2' is missing in type 'typeof import("foo_0")' but required in type '{ M2: Object; }'. @@ -11,13 +12,15 @@ foo_1.ts(5,5): error TS2741: Property 'M2' is missing in type 'typeof import("fo !!! error TS2741: Property 'M2' is missing in type 'typeof import("foo_0")' but required in type '{ M2: Object; }'. !!! related TS2728 foo_1.ts:5:9: 'M2' is declared here. -==== foo_0.ts (0 errors) ==== +==== foo_0.ts (1 errors) ==== export interface Person { name: string; age: number; } export module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface I2 { x: Person; } diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.errors.txt b/tests/baselines/reference/undefinedIsSubtypeOfEverything.errors.txt new file mode 100644 index 00000000000..d114601b347 --- /dev/null +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.errors.txt @@ -0,0 +1,130 @@ +undefinedIsSubtypeOfEverything.ts(82,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +undefinedIsSubtypeOfEverything.ts(91,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== undefinedIsSubtypeOfEverything.ts (2 errors) ==== + // undefined is a subtype of every other types, no errors expected below + + class Base { + foo: typeof undefined; + } + + class D0 extends Base { + foo: any; + } + + class DA extends Base { + foo: typeof undefined; + } + + class D1 extends Base { + foo: string; + } + + class D1A extends Base { + foo: String; + } + + + class D2 extends Base { + foo: number; + } + + class D2A extends Base { + foo: Number; + } + + + class D3 extends Base { + foo: boolean; + } + + class D3A extends Base { + foo: Boolean; + } + + + class D4 extends Base { + foo: RegExp; + } + + class D5 extends Base { + foo: Date; + } + + + class D6 extends Base { + foo: number[]; + } + + class D7 extends Base { + foo: { bar: number }; + } + + + class D8 extends Base { + foo: D7; + } + + interface I1 { + bar: string; + } + class D9 extends Base { + foo: I1; + } + + + class D10 extends Base { + foo: () => number; + } + + enum E { A } + class D11 extends Base { + foo: E; + } + + function f() { } + module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + class D12 extends Base { + foo: typeof f; + } + + + class c { baz: string } + module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var bar = 1; + } + class D13 extends Base { + foo: typeof c; + } + + + class D14 extends Base { + foo: T; + } + + + class D15 extends Base { + foo: U; + } + + //class D15 extends Base { + // foo: U; + //} + + + class D16 extends Base { + foo: Object; + } + + + class D17 extends Base { + foo: {}; + } + \ No newline at end of file diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.types b/tests/baselines/reference/undefinedIsSubtypeOfEverything.types index 63a9eb50c7b..c0e593504d3 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.types +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.types @@ -9,6 +9,7 @@ class Base { foo: typeof undefined; >foo : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ } @@ -21,6 +22,7 @@ class D0 extends Base { foo: any; >foo : any +> : ^^^ } class DA extends Base { @@ -31,6 +33,7 @@ class DA extends Base { foo: typeof undefined; >foo : any +> : ^^^ >undefined : undefined > : ^^^^^^^^^ } diff --git a/tests/baselines/reference/underscoreMapFirst.errors.txt b/tests/baselines/reference/underscoreMapFirst.errors.txt new file mode 100644 index 00000000000..c33afc079c2 --- /dev/null +++ b/tests/baselines/reference/underscoreMapFirst.errors.txt @@ -0,0 +1,54 @@ +underscoreMapFirst.ts(1,9): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== underscoreMapFirst.ts (1 errors) ==== + declare module _ { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + interface Collection { } + interface List extends Collection { + [index: number]: T; + length: number; + } + + interface ListIterator { + (value: T, index: number, list: T[]): TResult; + } + + interface Dictionary extends Collection { + [index: string]: T; + } + export function pluck( + list: Collection, + propertyName: string): any[]; + + export function map( + list: List, + iterator: ListIterator, + context?: any): TResult[]; + + export function first(array: List): T; + } + + declare class View { + model: any; + } + + interface IData { + series: ISeries[]; + } + + interface ISeries { + items: any[]; + key: string; + } + + class MyView extends View { + public getDataSeries(): ISeries[] { + var data: IData[] = this.model.get("data"); + var allSeries: ISeries[][] = _.pluck(data, "series"); + + return _.map(allSeries, _.first); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/underscoreMapFirst.types b/tests/baselines/reference/underscoreMapFirst.types index ed76e069050..551d2967886 100644 --- a/tests/baselines/reference/underscoreMapFirst.types +++ b/tests/baselines/reference/underscoreMapFirst.types @@ -57,6 +57,7 @@ declare module _ { context?: any): TResult[]; >context : any +> : ^^^ export function first(array: List): T; >first : (array: List) => T @@ -71,6 +72,7 @@ declare class View { model: any; >model : any +> : ^^^ } interface IData { @@ -103,7 +105,9 @@ class MyView extends View { >data : IData[] > : ^^^^^^^ >this.model.get("data") : any +> : ^^^ >this.model.get : any +> : ^^^ >this.model : any > : ^^^ >this : this diff --git a/tests/baselines/reference/underscoreTest1.errors.txt b/tests/baselines/reference/underscoreTest1.errors.txt index f3070567b8d..e49a6d56c28 100644 --- a/tests/baselines/reference/underscoreTest1.errors.txt +++ b/tests/baselines/reference/underscoreTest1.errors.txt @@ -1,3 +1,4 @@ +underscoreTest1_underscore.ts(31,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. underscoreTest1_underscoreTests.ts(26,3): error TS2769: No overload matches this call. Overload 1 of 2, '(list: (string | number | boolean)[], iterator?: Iterator_, context?: any): boolean', gave the following error. Argument of type '(value: T) => T' is not assignable to parameter of type 'Iterator_'. @@ -270,7 +271,7 @@ underscoreTest1_underscoreTests.ts(26,3): error TS2769: No overload matches this var template2 = _.template("Hello {{ name }}!"); template2({ name: "Mustache" }); _.template("Using 'with': <%= data.answer %>", { answer: 'no' }, { variable: 'data' }); -==== underscoreTest1_underscore.ts (0 errors) ==== +==== underscoreTest1_underscore.ts (1 errors) ==== interface Dictionary { [x: string]: T; } @@ -302,6 +303,8 @@ underscoreTest1_underscoreTests.ts(26,3): error TS2769: No overload matches this } module Underscore { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface WrappedObject { keys(): string[]; values(): any[]; diff --git a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt index 1219bb562c9..2d1fbca7f5f 100644 --- a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt +++ b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt @@ -22,15 +22,17 @@ unionSubtypeIfEveryConstituentTypeIsSubtype.ts(85,5): error TS2411: Property 'fo unionSubtypeIfEveryConstituentTypeIsSubtype.ts(91,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to 'string' index type '(x: T) => T'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(92,5): error TS2411: Property 'foo2' of type 'number' is not assignable to 'string' index type '(x: T) => T'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(99,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to 'string' index type 'E2'. +unionSubtypeIfEveryConstituentTypeIsSubtype.ts(105,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(110,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to 'string' index type 'typeof f'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(111,5): error TS2411: Property 'foo2' of type 'number' is not assignable to 'string' index type 'typeof f'. +unionSubtypeIfEveryConstituentTypeIsSubtype.ts(116,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(121,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to 'string' index type 'typeof c'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(122,5): error TS2411: Property 'foo2' of type 'number' is not assignable to 'string' index type 'typeof c'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(128,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to 'string' index type 'T'. unionSubtypeIfEveryConstituentTypeIsSubtype.ts(129,5): error TS2411: Property 'foo2' of type 'number' is not assignable to 'string' index type 'T'. -==== unionSubtypeIfEveryConstituentTypeIsSubtype.ts (30 errors) ==== +==== unionSubtypeIfEveryConstituentTypeIsSubtype.ts (32 errors) ==== enum e { e1, e2 @@ -184,6 +186,8 @@ unionSubtypeIfEveryConstituentTypeIsSubtype.ts(129,5): error TS2411: Property 'f function f() { } module f { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } interface I15 { @@ -199,6 +203,8 @@ unionSubtypeIfEveryConstituentTypeIsSubtype.ts(129,5): error TS2411: Property 'f class c { baz: string } module c { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var bar = 1; } interface I16 { diff --git a/tests/baselines/reference/unspecializedConstraints.errors.txt b/tests/baselines/reference/unspecializedConstraints.errors.txt index 824b8fa2b45..5249a5e1fd1 100644 --- a/tests/baselines/reference/unspecializedConstraints.errors.txt +++ b/tests/baselines/reference/unspecializedConstraints.errors.txt @@ -1,8 +1,11 @@ +unspecializedConstraints.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. unspecializedConstraints.ts(84,44): error TS2552: Cannot find name 'TypeParameter'. Did you mean 'Parameter'? -==== unspecializedConstraints.ts (1 errors) ==== +==== unspecializedConstraints.ts (2 errors) ==== module ts { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. interface Map { [index: string]: T; } diff --git a/tests/baselines/reference/vardecl.errors.txt b/tests/baselines/reference/vardecl.errors.txt new file mode 100644 index 00000000000..97129b61a00 --- /dev/null +++ b/tests/baselines/reference/vardecl.errors.txt @@ -0,0 +1,116 @@ +vardecl.ts(61,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== vardecl.ts (1 errors) ==== + var simpleVar; + + var anotherVar: any; + var varWithSimpleType: number; + var varWithArrayType: number[]; + + var varWithInitialValue = 30; + + var withComplicatedValue = { x: 30, y: 70, desc: "position" }; + + declare var declaredVar; + declare var declareVar2 + + declare var declaredVar3; + declare var deckareVarWithType: number; + + var arrayVar: string[] = ['a', 'b']; + + var complicatedArrayVar: { x: number; y: string; }[] ; + complicatedArrayVar.push({ x: 30, y : 'hello world' }); + + var n1: { [s: string]: number; }; + + var c : { + new? (): any; + } + + var d: { + foo? (): { + x: number; + }; + } + + var d3: { + foo(): { + x: number; + y: number; + }; + } + + var d2: { + foo (): { + x: number; + }; + } + + var n2: { + (): void; + } + var n4: { + (): void; + }[]; + + var d4: { + foo(n: string, x: { x: number; y: number; }): { + x: number; + y: number; + }; + } + + module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export var a, b2: number = 10, b; + var m1; + var a2, b22: number = 10, b222; + var m3; + + class C { + constructor (public b) { + } + } + + export class C2 { + constructor (public b) { + } + } + var m; + declare var d1, d2; + var b23; + declare var v1; + export var mE; + export declare var d1E, d2E; + export var b2E; + export declare var v1E; + } + + var a22, b22 = 10, c22 = 30; + var nn; + + declare var da1, da2; + var normalVar; + declare var dv1; + var xl; + var x; + var z; + + function foo(a2) { + var a = 10; + } + + for (var i = 0, j = 0; i < 10; i++) { + j++; + } + + + for (var k = 0; k < 30; k++) { + k++; + } + var b = 10; + \ No newline at end of file diff --git a/tests/baselines/reference/vardecl.types b/tests/baselines/reference/vardecl.types index e74765d8244..e851313f35a 100644 --- a/tests/baselines/reference/vardecl.types +++ b/tests/baselines/reference/vardecl.types @@ -3,9 +3,11 @@ === vardecl.ts === var simpleVar; >simpleVar : any +> : ^^^ var anotherVar: any; >anotherVar : any +> : ^^^ var varWithSimpleType: number; >varWithSimpleType : number @@ -41,12 +43,15 @@ var withComplicatedValue = { x: 30, y: 70, desc: "position" }; declare var declaredVar; >declaredVar : any +> : ^^^ declare var declareVar2 >declareVar2 : any +> : ^^^ declare var declaredVar3; >declaredVar3 : any +> : ^^^ declare var deckareVarWithType: number; >deckareVarWithType : number @@ -200,25 +205,31 @@ module m2 { export var a, b2: number = 10, b; >a : any +> : ^^^ >b2 : number > : ^^^^^^ >10 : 10 > : ^^ >b : any +> : ^^^ var m1; >m1 : any +> : ^^^ var a2, b22: number = 10, b222; >a2 : any +> : ^^^ >b22 : number > : ^^^^^^ >10 : 10 > : ^^ >b222 : any +> : ^^^ var m3; >m3 : any +> : ^^^ class C { >C : C @@ -226,6 +237,7 @@ module m2 { constructor (public b) { >b : any +> : ^^^ } } @@ -235,37 +247,49 @@ module m2 { constructor (public b) { >b : any +> : ^^^ } } var m; >m : any +> : ^^^ declare var d1, d2; >d1 : any +> : ^^^ >d2 : any +> : ^^^ var b23; >b23 : any +> : ^^^ declare var v1; >v1 : any +> : ^^^ export var mE; >mE : any +> : ^^^ export declare var d1E, d2E; >d1E : any +> : ^^^ >d2E : any +> : ^^^ export var b2E; >b2E : any +> : ^^^ export declare var v1E; >v1E : any +> : ^^^ } var a22, b22 = 10, c22 = 30; >a22 : any +> : ^^^ >b22 : number > : ^^^^^^ >10 : 10 @@ -277,30 +301,39 @@ var a22, b22 = 10, c22 = 30; var nn; >nn : any +> : ^^^ declare var da1, da2; >da1 : any +> : ^^^ >da2 : any +> : ^^^ var normalVar; >normalVar : any +> : ^^^ declare var dv1; >dv1 : any +> : ^^^ var xl; >xl : any +> : ^^^ var x; >x : any +> : ^^^ var z; >z : any +> : ^^^ function foo(a2) { >foo : (a2: any) => void > : ^ ^^^^^^^^^^^^^^ >a2 : any +> : ^^^ var a = 10; >a : number diff --git a/tests/baselines/reference/variableDeclaratorResolvedDuringContextualTyping.errors.txt b/tests/baselines/reference/variableDeclaratorResolvedDuringContextualTyping.errors.txt index 2211c228ad3..fae06ac3595 100644 --- a/tests/baselines/reference/variableDeclaratorResolvedDuringContextualTyping.errors.txt +++ b/tests/baselines/reference/variableDeclaratorResolvedDuringContextualTyping.errors.txt @@ -1,10 +1,16 @@ +variableDeclaratorResolvedDuringContextualTyping.ts(1,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +variableDeclaratorResolvedDuringContextualTyping.ts(66,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +variableDeclaratorResolvedDuringContextualTyping.ts(84,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +variableDeclaratorResolvedDuringContextualTyping.ts(91,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. variableDeclaratorResolvedDuringContextualTyping.ts(115,29): error TS2304: Cannot find name 'IUploadResult'. variableDeclaratorResolvedDuringContextualTyping.ts(116,32): error TS2339: Property 'jsonToStat' does not exist on type 'FileService'. variableDeclaratorResolvedDuringContextualTyping.ts(116,43): error TS2304: Cannot find name 'newFilePath'. -==== variableDeclaratorResolvedDuringContextualTyping.ts (3 errors) ==== +==== variableDeclaratorResolvedDuringContextualTyping.ts (7 errors) ==== module WinJS { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface ValueCallback { (value: any): any; } @@ -70,6 +76,8 @@ variableDeclaratorResolvedDuringContextualTyping.ts(116,43): error TS2304: Canno } module Services { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface IRequestService { /** * Returns the URL that can be used to access the provided service. The optional second argument can @@ -88,6 +96,8 @@ variableDeclaratorResolvedDuringContextualTyping.ts(116,43): error TS2304: Canno } module Errors { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export class ConnectionError /* extends Error */ { constructor(request: XMLHttpRequest) { } @@ -95,6 +105,8 @@ variableDeclaratorResolvedDuringContextualTyping.ts(116,43): error TS2304: Canno } module Files { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export interface IUploadResult { stat: string; isNew: boolean; diff --git a/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt index 93c05ff427a..aa55b908065 100644 --- a/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,10 @@ +voidOperatorWithAnyOtherType.ts(20,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. voidOperatorWithAnyOtherType.ts(46,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'. voidOperatorWithAnyOtherType.ts(47,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. voidOperatorWithAnyOtherType.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -==== voidOperatorWithAnyOtherType.ts (3 errors) ==== +==== voidOperatorWithAnyOtherType.ts (4 errors) ==== // void operator on any type var ANY: any; @@ -24,6 +25,8 @@ voidOperatorWithAnyOtherType.ts(48,27): error TS2365: Operator '+' cannot be app } } module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var n: any; } var objA = new A(); diff --git a/tests/baselines/reference/voidOperatorWithStringType.errors.txt b/tests/baselines/reference/voidOperatorWithStringType.errors.txt new file mode 100644 index 00000000000..d42a25aa3c2 --- /dev/null +++ b/tests/baselines/reference/voidOperatorWithStringType.errors.txt @@ -0,0 +1,50 @@ +voidOperatorWithStringType.ts(11,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== voidOperatorWithStringType.ts (1 errors) ==== + // void operator on string type + var STRING: string; + var STRING1: string[] = ["", "abc"]; + + function foo(): string { return "abc"; } + + class A { + public a: string; + static foo() { return ""; } + } + module M { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export var n: string; + } + + var objA = new A(); + + // string type var + var ResultIsAny1 = void STRING; + var ResultIsAny2 = void STRING1; + + // string type literal + var ResultIsAny3 = void ""; + var ResultIsAny4 = void { x: "", y: "" }; + var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } }; + + // string type expressions + var ResultIsAny6 = void objA.a; + var ResultIsAny7 = void M.n; + var ResultIsAny8 = void STRING1[0]; + var ResultIsAny9 = void foo(); + var ResultIsAny10 = void A.foo(); + var ResultIsAny11 = void (STRING + STRING); + var ResultIsAny12 = void STRING.charAt(0); + + // multiple void operators + var ResultIsAny13 = void void STRING; + var ResultIsAny14 = void void void (STRING + STRING); + + // miss assignment operators + void ""; + void STRING; + void STRING1; + void foo(); + void objA.a,M.n; \ No newline at end of file diff --git a/tests/baselines/reference/voidOperatorWithStringType.types b/tests/baselines/reference/voidOperatorWithStringType.types index cedab63d9e6..ab6afa26c9d 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.types +++ b/tests/baselines/reference/voidOperatorWithStringType.types @@ -56,6 +56,7 @@ var objA = new A(); // string type var var ResultIsAny1 = void STRING; >ResultIsAny1 : any +> : ^^^ >void STRING : undefined > : ^^^^^^^^^ >STRING : string @@ -63,6 +64,7 @@ var ResultIsAny1 = void STRING; var ResultIsAny2 = void STRING1; >ResultIsAny2 : any +> : ^^^ >void STRING1 : undefined > : ^^^^^^^^^ >STRING1 : string[] @@ -71,6 +73,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; >ResultIsAny3 : any +> : ^^^ >void "" : undefined > : ^^^^^^^^^ >"" : "" @@ -78,6 +81,7 @@ var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; >ResultIsAny4 : any +> : ^^^ >void { x: "", y: "" } : undefined > : ^^^^^^^^^ >{ x: "", y: "" } : { x: string; y: string; } @@ -93,6 +97,7 @@ var ResultIsAny4 = void { x: "", y: "" }; var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } }; >ResultIsAny5 : any +> : ^^^ >void { x: "", y: (s: string) => { return s; } } : undefined > : ^^^^^^^^^ >{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; } @@ -113,6 +118,7 @@ var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; >ResultIsAny6 : any +> : ^^^ >void objA.a : undefined > : ^^^^^^^^^ >objA.a : string @@ -124,6 +130,7 @@ var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; >ResultIsAny7 : any +> : ^^^ >void M.n : undefined > : ^^^^^^^^^ >M.n : string @@ -135,6 +142,7 @@ var ResultIsAny7 = void M.n; var ResultIsAny8 = void STRING1[0]; >ResultIsAny8 : any +> : ^^^ >void STRING1[0] : undefined > : ^^^^^^^^^ >STRING1[0] : string @@ -146,6 +154,7 @@ var ResultIsAny8 = void STRING1[0]; var ResultIsAny9 = void foo(); >ResultIsAny9 : any +> : ^^^ >void foo() : undefined > : ^^^^^^^^^ >foo() : string @@ -155,6 +164,7 @@ var ResultIsAny9 = void foo(); var ResultIsAny10 = void A.foo(); >ResultIsAny10 : any +> : ^^^ >void A.foo() : undefined > : ^^^^^^^^^ >A.foo() : string @@ -168,6 +178,7 @@ var ResultIsAny10 = void A.foo(); var ResultIsAny11 = void (STRING + STRING); >ResultIsAny11 : any +> : ^^^ >void (STRING + STRING) : undefined > : ^^^^^^^^^ >(STRING + STRING) : string @@ -181,6 +192,7 @@ var ResultIsAny11 = void (STRING + STRING); var ResultIsAny12 = void STRING.charAt(0); >ResultIsAny12 : any +> : ^^^ >void STRING.charAt(0) : undefined > : ^^^^^^^^^ >STRING.charAt(0) : string @@ -197,6 +209,7 @@ var ResultIsAny12 = void STRING.charAt(0); // multiple void operators var ResultIsAny13 = void void STRING; >ResultIsAny13 : any +> : ^^^ >void void STRING : undefined > : ^^^^^^^^^ >void STRING : undefined @@ -206,6 +219,7 @@ var ResultIsAny13 = void void STRING; var ResultIsAny14 = void void void (STRING + STRING); >ResultIsAny14 : any +> : ^^^ >void void void (STRING + STRING) : undefined > : ^^^^^^^^^ >void void (STRING + STRING) : undefined diff --git a/tests/baselines/reference/withExportDecl.errors.txt b/tests/baselines/reference/withExportDecl.errors.txt new file mode 100644 index 00000000000..fe2fe666dca --- /dev/null +++ b/tests/baselines/reference/withExportDecl.errors.txt @@ -0,0 +1,70 @@ +withExportDecl.ts(38,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +withExportDecl.ts(43,16): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. +withExportDecl.ts(49,8): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + +==== withExportDecl.ts (3 errors) ==== + var simpleVar; + export var exportedSimpleVar; + + var anotherVar: any; + var varWithSimpleType: number; + var varWithArrayType: number[]; + + var varWithInitialValue = 30; + export var exportedVarWithInitialValue = 70; + + var withComplicatedValue = { x: 30, y: 70, desc: "position" }; + export var exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" }; + + declare var declaredVar; + declare var declareVar2 + + declare var declaredVar; + declare var deckareVarWithType: number; + export declare var exportedDeclaredVar: number; + + var arrayVar: string[] = ['a', 'b']; + + export var exportedArrayVar: { x: number; y: string; }[] ; + exportedArrayVar.push({ x: 30, y : 'hello world' }); + + function simpleFunction() { + return { + x: "Hello", + y: "word", + n: 2 + }; + } + + export function exportedFunction() { + return simpleFunction(); + } + + module m1 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + export function foo() { + return "Hello"; + } + } + export declare module m2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export var a: number; + } + + + export module m3 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. + + export function foo() { + return m1.foo(); + } + } + + export var eVar1, eVar2 = 10; + var eVar22; + export var eVar3 = 10, eVar4, eVar5; \ No newline at end of file diff --git a/tests/baselines/reference/withExportDecl.types b/tests/baselines/reference/withExportDecl.types index 1d45b9b0fc6..ea8e810c7e6 100644 --- a/tests/baselines/reference/withExportDecl.types +++ b/tests/baselines/reference/withExportDecl.types @@ -3,12 +3,15 @@ === withExportDecl.ts === var simpleVar; >simpleVar : any +> : ^^^ export var exportedSimpleVar; >exportedSimpleVar : any +> : ^^^ var anotherVar: any; >anotherVar : any +> : ^^^ var varWithSimpleType: number; >varWithSimpleType : number @@ -68,12 +71,15 @@ export var exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" }; declare var declaredVar; >declaredVar : any +> : ^^^ declare var declareVar2 >declareVar2 : any +> : ^^^ declare var declaredVar; >declaredVar : any +> : ^^^ declare var deckareVarWithType: number; >deckareVarWithType : number @@ -206,6 +212,7 @@ export module m3 { export var eVar1, eVar2 = 10; >eVar1 : any +> : ^^^ >eVar2 : number > : ^^^^^^ >10 : 10 @@ -213,6 +220,7 @@ export var eVar1, eVar2 = 10; var eVar22; >eVar22 : any +> : ^^^ export var eVar3 = 10, eVar4, eVar5; >eVar3 : number @@ -220,5 +228,7 @@ export var eVar3 = 10, eVar4, eVar5; >10 : 10 > : ^^ >eVar4 : any +> : ^^^ >eVar5 : any +> : ^^^ diff --git a/tests/baselines/reference/witness.errors.txt b/tests/baselines/reference/witness.errors.txt index 603db90af98..e66f91764c7 100644 --- a/tests/baselines/reference/witness.errors.txt +++ b/tests/baselines/reference/witness.errors.txt @@ -17,11 +17,12 @@ witness.ts(57,5): error TS2403: Subsequent variable declarations must have the s witness.ts(58,12): error TS2873: This kind of expression is always falsy. witness.ts(68,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fnCallResult' must be of type 'never', but here has type 'any'. witness.ts(110,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' must be of type 'any', but here has type '{ m: any; }'. +witness.ts(113,1): error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. witness.ts(121,14): error TS2729: Property 'n' is used before its initialization. witness.ts(128,19): error TS2729: Property 'q' is used before its initialization. -==== witness.ts (21 errors) ==== +==== witness.ts (22 errors) ==== // Initializers var varInit = varInit; // any var pInit: any; @@ -183,6 +184,8 @@ witness.ts(128,19): error TS2729: Property 'q' is used before its initialization // Property access of module member module M2 { + ~~~~~~ +!!! error TS1547: The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead. export var x = M2.x; var y = x; var y: any;