diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bc37e2524f8..311f60792e0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15741,13 +15741,6 @@ namespace ts { grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; case SyntaxKind.ImportEqualsDeclaration: - if ((node).moduleReference.kind !== SyntaxKind.StringLiteral) { - if (!isGlobalAugmentation) { - error((node).name, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); - } - break; - } - // fallthrough case SyntaxKind.ImportDeclaration: grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; @@ -15782,9 +15775,6 @@ namespace ts { // symbol should not originate in augmentation reportError = isExternalModuleAugmentation(symbol.parent.declarations[0]); } - if (reportError) { - error(node, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); - } } break; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 765b5de4f3e..0c9dd6aaf1b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1843,10 +1843,6 @@ "category": "Error", "code": 2664 }, - "Module augmentation cannot introduce new names in the top level scope.": { - "category": "Error", - "code": 2665 - }, "Exports and export assignments are not permitted in module augmentations.": { "category": "Error", "code": 2666 diff --git a/tests/baselines/reference/augmentExportEquals3.errors.txt b/tests/baselines/reference/augmentExportEquals3.errors.txt deleted file mode 100644 index 9fe63d84fb6..00000000000 --- a/tests/baselines/reference/augmentExportEquals3.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -tests/cases/compiler/file2.ts(6,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/file2.ts(7,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/file1.ts (0 errors) ==== - - function foo() {} - namespace foo { - export var v = 1; - } - export = foo; - -==== tests/cases/compiler/file2.ts (2 errors) ==== - import x = require("./file1"); - x.b = 1; - - // OK - './file1' is a namespace - declare module "./file1" { - interface A { a } - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let b: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/file3.ts (0 errors) ==== - import * as x from "./file1"; - import "./file2"; - let a: x.A; - let b = x.b; \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals3.symbols b/tests/baselines/reference/augmentExportEquals3.symbols new file mode 100644 index 00000000000..c7338867021 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3.symbols @@ -0,0 +1,49 @@ +=== tests/cases/compiler/file1.ts === + +function foo() {} +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17), Decl(file2.ts, 1, 8)) + +namespace foo { +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17), Decl(file2.ts, 1, 8)) + + export var v = 1; +>v : Symbol(v, Decl(file1.ts, 3, 14)) +} +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 17)) + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 4, 26)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 6, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "./file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 4, 26)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals3.types b/tests/baselines/reference/augmentExportEquals3.types new file mode 100644 index 00000000000..4df7bbc60fa --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.ts === + +function foo() {} +>foo : typeof + +namespace foo { +>foo : typeof + + export var v = 1; +>v : number +>1 : number +} +export = foo; +>foo : typeof foo + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : typeof x + +import "./file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals3_1.errors.txt b/tests/baselines/reference/augmentExportEquals3_1.errors.txt deleted file mode 100644 index 9fb0ce5f169..00000000000 --- a/tests/baselines/reference/augmentExportEquals3_1.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/compiler/file2.ts(7,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/file2.ts(8,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/file1.d.ts (0 errors) ==== - declare module "file1" { - function foo(): void; - namespace foo { - export var v: number; - } - export = foo; - } - - -==== tests/cases/compiler/file2.ts (2 errors) ==== - /// - import x = require("file1"); - x.b = 1; - - // OK - './file1' is a namespace - declare module "file1" { - interface A { a } - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let b: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/file3.ts (0 errors) ==== - import * as x from "file1"; - import "file2"; - let a: x.A; - let b = x.b; \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals3_1.symbols b/tests/baselines/reference/augmentExportEquals3_1.symbols new file mode 100644 index 00000000000..09827aaa094 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3_1.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.d.ts === +declare module "file1" { + function foo(): void; +>foo : Symbol(, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8)) + + namespace foo { +>foo : Symbol(, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8)) + + export var v: number; +>v : Symbol(v, Decl(file1.d.ts, 3, 18)) + } + export = foo; +>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25)) +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 5, 24)) +>a : Symbol(A.a, Decl(file2.ts, 6, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 7, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 5, 24)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals3_1.types b/tests/baselines/reference/augmentExportEquals3_1.types new file mode 100644 index 00000000000..8a70a6ec0a6 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals3_1.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/file1.d.ts === +declare module "file1" { + function foo(): void; +>foo : typeof + + namespace foo { +>foo : typeof + + export var v: number; +>v : number + } + export = foo; +>foo : typeof foo +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : typeof x + +import "file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals4.errors.txt b/tests/baselines/reference/augmentExportEquals4.errors.txt deleted file mode 100644 index 20f7cc32d9f..00000000000 --- a/tests/baselines/reference/augmentExportEquals4.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -tests/cases/compiler/file2.ts(6,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/file2.ts(7,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/file1.ts (0 errors) ==== - - class foo {} - namespace foo { - export var v = 1; - } - export = foo; - -==== tests/cases/compiler/file2.ts (2 errors) ==== - import x = require("./file1"); - x.b = 1; - - // OK - './file1' is a namespace - declare module "./file1" { - interface A { a } - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let b: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/file3.ts (0 errors) ==== - import * as x from "./file1"; - import "./file2"; - let a: x.A; - let b = x.b; \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals4.symbols b/tests/baselines/reference/augmentExportEquals4.symbols new file mode 100644 index 00000000000..94941693bae --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4.symbols @@ -0,0 +1,49 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 8)) + +namespace foo { +>foo : Symbol(, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12), Decl(file2.ts, 1, 8)) + + export var v = 1; +>v : Symbol(v, Decl(file1.ts, 3, 14)) +} +export = foo; +>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 1, 12)) + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 4, 26)) +>a : Symbol(A.a, Decl(file2.ts, 5, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 6, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "./file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 4, 26)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 6, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 6, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals4.types b/tests/baselines/reference/augmentExportEquals4.types new file mode 100644 index 00000000000..3d25ae2decb --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4.types @@ -0,0 +1,52 @@ +=== tests/cases/compiler/file1.ts === + +class foo {} +>foo : + +namespace foo { +>foo : typeof + + export var v = 1; +>v : number +>1 : number +} +export = foo; +>foo : foo + +=== tests/cases/compiler/file2.ts === +import x = require("./file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "./file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "./file1"; +>x : typeof x + +import "./file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/augmentExportEquals4_1.errors.txt b/tests/baselines/reference/augmentExportEquals4_1.errors.txt deleted file mode 100644 index a401f7a24cf..00000000000 --- a/tests/baselines/reference/augmentExportEquals4_1.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -tests/cases/compiler/file2.ts(7,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/file2.ts(8,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/file1.d.ts (0 errors) ==== - - declare module "file1" { - class foo {} - namespace foo { - export var v: number; - } - export = foo; - } - - -==== tests/cases/compiler/file2.ts (2 errors) ==== - /// - import x = require("file1"); - x.b = 1; - - // OK - './file1' is a namespace - declare module "file1" { - interface A { a } - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let b: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/file3.ts (0 errors) ==== - import * as x from "file1"; - import "file2"; - let a: x.A; - let b = x.b; \ No newline at end of file diff --git a/tests/baselines/reference/augmentExportEquals4_1.symbols b/tests/baselines/reference/augmentExportEquals4_1.symbols new file mode 100644 index 00000000000..5c4aadbdf83 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4_1.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 2, 8)) + + namespace foo { +>foo : Symbol(, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16), Decl(file2.ts, 2, 8)) + + export var v: number; +>v : Symbol(v, Decl(file1.d.ts, 4, 18)) + } + export = foo; +>foo : Symbol(foo, Decl(file1.d.ts, 1, 24), Decl(file1.d.ts, 2, 16)) +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : Symbol(x, Decl(file2.ts, 0, 0)) + +x.b = 1; +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file2.ts, 0, 0)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : Symbol(A, Decl(file2.ts, 5, 24)) +>a : Symbol(A.a, Decl(file2.ts, 6, 17)) + + let b: number; +>b : Symbol(b, Decl(file2.ts, 7, 7)) +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : Symbol(x, Decl(file3.ts, 0, 6)) + +import "file2"; +let a: x.A; +>a : Symbol(a, Decl(file3.ts, 2, 3)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>A : Symbol(x.A, Decl(file2.ts, 5, 24)) + +let b = x.b; +>b : Symbol(b, Decl(file3.ts, 3, 3)) +>x.b : Symbol(x.b, Decl(file2.ts, 7, 7)) +>x : Symbol(x, Decl(file3.ts, 0, 6)) +>b : Symbol(x.b, Decl(file2.ts, 7, 7)) + diff --git a/tests/baselines/reference/augmentExportEquals4_1.types b/tests/baselines/reference/augmentExportEquals4_1.types new file mode 100644 index 00000000000..9f219286000 --- /dev/null +++ b/tests/baselines/reference/augmentExportEquals4_1.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/file1.d.ts === + +declare module "file1" { + class foo {} +>foo : + + namespace foo { +>foo : typeof + + export var v: number; +>v : number + } + export = foo; +>foo : foo +} + + +=== tests/cases/compiler/file2.ts === +/// +import x = require("file1"); +>x : typeof x + +x.b = 1; +>x.b = 1 : number +>x.b : number +>x : typeof x +>b : number +>1 : number + +// OK - './file1' is a namespace +declare module "file1" { + interface A { a } +>A : A +>a : any + + let b: number; +>b : number +} + +=== tests/cases/compiler/file3.ts === +import * as x from "file1"; +>x : typeof x + +import "file2"; +let a: x.A; +>a : x.A +>x : any +>A : x.A + +let b = x.b; +>b : number +>x.b : number +>x : typeof x +>b : number + diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.errors.txt b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.errors.txt deleted file mode 100644 index 8e1bc337b39..00000000000 --- a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -tests/cases/compiler/map1.ts(7,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map2.ts(6,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/map1.ts (1 errors) ==== - - import { Observable } from "./observable" - - (Observable.prototype).map = function() { } - - declare module "./observable" { - interface I {x0} - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/map2.ts (1 errors) ==== - import { Observable } from "./observable" - - (Observable.prototype).map = function() { } - - declare module "./observable" { - interface I {x1} - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - - -==== tests/cases/compiler/observable.ts (0 errors) ==== - export declare class Observable { - filter(pred: (e:T) => boolean): Observable; - } - -==== tests/cases/compiler/main.ts (0 errors) ==== - import { Observable } from "./observable" - import "./map1"; - import "./map2"; - - let x: Observable; - \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols new file mode 100644 index 00000000000..ce701a7c59d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.symbols @@ -0,0 +1,57 @@ +=== tests/cases/compiler/map1.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map1.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map1.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface I {x0} +>I : Symbol(I, Decl(map1.ts, 5, 31), Decl(map2.ts, 4, 31)) +>x0 : Symbol(I.x0, Decl(map1.ts, 6, 17)) +} + +=== tests/cases/compiler/map2.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map2.ts, 0, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map2.ts, 0, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface I {x1} +>I : Symbol(I, Decl(map1.ts, 5, 31), Decl(map2.ts, 4, 31)) +>x1 : Symbol(I.x1, Decl(map2.ts, 5, 17)) +} + + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0)) +>T : Symbol(T, Decl(observable.ts, 0, 32)) +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map1"; +import "./map2"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 4, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + diff --git a/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types new file mode 100644 index 00000000000..e87560c6a3d --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationCollidingNamesInAugmentation1.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/map1.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface I {x0} +>I : I +>x0 : any +} + +=== tests/cases/compiler/map2.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface I {x1} +>I : I +>x1 : any +} + + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map1"; +import "./map2"; + +let x: Observable; +>x : Observable +>Observable : Observable + diff --git a/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt index 571b288c04a..25577578ceb 100644 --- a/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt +++ b/tests/baselines/reference/moduleAugmentationDisallowedExtensions.errors.txt @@ -1,17 +1,3 @@ -tests/cases/compiler/x.ts(7,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(8,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(9,11): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,10): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,14): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,23): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,38): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,43): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(10,48): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(11,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(12,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(15,11): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(16,14): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/x.ts(17,10): error TS2665: Module augmentation cannot introduce new names in the top level scope. tests/cases/compiler/x.ts(18,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/x.ts(18,26): error TS2307: Cannot find module './x0'. tests/cases/compiler/x.ts(19,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. @@ -27,7 +13,7 @@ tests/cases/compiler/x.ts(25,5): error TS2666: Exports and export assignments ar export let a = 1; -==== tests/cases/compiler/x.ts (23 errors) ==== +==== tests/cases/compiler/x.ts (9 errors) ==== namespace N1 { export let x = 1; @@ -35,44 +21,16 @@ tests/cases/compiler/x.ts(25,5): error TS2666: Exports and export assignments ar declare module "./observable" { var x: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. let y: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. const z: number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. let {x1, y1, z0: {n}, z1: {arr: [el1, el2, el3]}}: {x1: number, y1: string, z0: {n: number}, z1: {arr: number[]} } - ~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. interface A { x } - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. namespace N { - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. export class C {} } class Cls {} - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. function foo(): number; - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. type T = number; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. import * as all from "./x0"; ~~~~~~ !!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt b/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt index deb3881e209..9c49d38572b 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports2.errors.txt @@ -3,11 +3,10 @@ tests/cases/compiler/f3.ts(11,5): error TS2667: Imports are not permitted in mod tests/cases/compiler/f3.ts(11,21): error TS2307: Cannot find module './f2'. tests/cases/compiler/f3.ts(12,5): error TS2666: Exports and export assignments are not permitted in module augmentations. tests/cases/compiler/f3.ts(12,21): error TS2307: Cannot find module './f2'. -tests/cases/compiler/f3.ts(13,12): error TS2665: Module augmentation cannot introduce new names in the top level scope. +tests/cases/compiler/f3.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/f3.ts(13,16): error TS4000: Import declaration 'I' is using private name 'N'. -tests/cases/compiler/f3.ts(14,12): error TS2665: Module augmentation cannot introduce new names in the top level scope. +tests/cases/compiler/f3.ts(14,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/f3.ts(14,16): error TS4000: Import declaration 'C' is using private name 'N'. -tests/cases/compiler/f3.ts(16,15): error TS2665: Module augmentation cannot introduce new names in the top level scope. tests/cases/compiler/f4.ts(5,11): error TS2339: Property 'foo' does not exist on type 'A'. @@ -20,7 +19,7 @@ tests/cases/compiler/f4.ts(5,11): error TS2339: Property 'foo' does not exist on n: number; } -==== tests/cases/compiler/f3.ts (10 errors) ==== +==== tests/cases/compiler/f3.ts (9 errors) ==== import {A} from "./f1"; A.prototype.foo = function () { return undefined; } @@ -44,19 +43,17 @@ tests/cases/compiler/f4.ts(5,11): error TS2339: Property 'foo' does not exist on ~~~~~~ !!! error TS2307: Cannot find module './f2'. import I = N.Ifc; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. ~ !!! error TS4000: Import declaration 'I' is using private name 'N'. import C = N.Cls; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. ~ !!! error TS4000: Import declaration 'C' is using private name 'N'. // should have explicit export interface A { - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. foo(): B; bar(): I; baz(): C; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt b/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt index a7c8fa2cff2..c2c43c85af3 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports3.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/f3.ts(11,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/f3.ts(11,21): error TS2307: Cannot find module './f2'. -tests/cases/compiler/f3.ts(12,12): error TS2665: Module augmentation cannot introduce new names in the top level scope. +tests/cases/compiler/f3.ts(12,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/f3.ts(12,16): error TS4000: Import declaration 'I' is using private name 'N'. -tests/cases/compiler/f3.ts(13,12): error TS2665: Module augmentation cannot introduce new names in the top level scope. +tests/cases/compiler/f3.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. tests/cases/compiler/f3.ts(13,16): error TS4000: Import declaration 'C' is using private name 'N'. @@ -32,13 +32,13 @@ tests/cases/compiler/f3.ts(13,16): error TS4000: Import declaration 'C' is using ~~~~~~ !!! error TS2307: Cannot find module './f2'. import I = N.Ifc; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. ~ !!! error TS4000: Import declaration 'I' is using private name 'N'. import C = N.Cls; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. ~ !!! error TS4000: Import declaration 'C' is using private name 'N'. interface A { diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.errors.txt b/tests/baselines/reference/moduleAugmentationNoNewNames.errors.txt deleted file mode 100644 index 7c7f17cd641..00000000000 --- a/tests/baselines/reference/moduleAugmentationNoNewNames.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -tests/cases/compiler/map.ts(10,11): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map.ts(11,9): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map.ts(11,20): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map.ts(12,13): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map.ts(12,19): error TS2665: Module augmentation cannot introduce new names in the top level scope. -tests/cases/compiler/map.ts(13,12): error TS2665: Module augmentation cannot introduce new names in the top level scope. - - -==== tests/cases/compiler/map.ts (6 errors) ==== - - import { Observable } from "./observable" - - (Observable.prototype).map = function() { } - - declare module "./observable" { - interface Observable { - map(proj: (e:T) => U): Observable - } - class Bar {} - ~~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let y: number, z: string; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - let {a: x, b: x1}: {a: number, b: number}; - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - ~~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - module Z {} - ~ -!!! error TS2665: Module augmentation cannot introduce new names in the top level scope. - } - -==== tests/cases/compiler/observable.ts (0 errors) ==== - export declare class Observable { - filter(pred: (e:T) => boolean): Observable; - } - -==== tests/cases/compiler/main.ts (0 errors) ==== - import { Observable } from "./observable" - import "./map"; - - let x: Observable; - let y = x.map(x => x + 1); \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.symbols b/tests/baselines/reference/moduleAugmentationNoNewNames.symbols new file mode 100644 index 00000000000..a340d3820a2 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationNoNewNames.symbols @@ -0,0 +1,76 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) + +(Observable.prototype).map = function() { } +>Observable.prototype : Symbol(Observable.prototype) +>Observable : Symbol(Observable, Decl(map.ts, 1, 8)) +>prototype : Symbol(Observable.prototype) + +declare module "./observable" { + interface Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + map(proj: (e:T) => U): Observable +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>proj : Symbol(proj, Decl(map.ts, 7, 15)) +>e : Symbol(e, Decl(map.ts, 7, 22)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>U : Symbol(U, Decl(map.ts, 7, 12)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>U : Symbol(U, Decl(map.ts, 7, 12)) + } + class Bar {} +>Bar : Symbol(Bar, Decl(map.ts, 8, 5)) + + let y: number, z: string; +>y : Symbol(y, Decl(map.ts, 10, 7)) +>z : Symbol(z, Decl(map.ts, 10, 18)) + + let {a: x, b: x1}: {a: number, b: number}; +>a : Symbol(a, Decl(map.ts, 11, 24)) +>x : Symbol(x, Decl(map.ts, 11, 9)) +>b : Symbol(b, Decl(map.ts, 11, 34)) +>x1 : Symbol(x1, Decl(map.ts, 11, 14)) +>a : Symbol(a, Decl(map.ts, 11, 24)) +>b : Symbol(b, Decl(map.ts, 11, 34)) + + module Z {} +>Z : Symbol(Z, Decl(map.ts, 11, 46)) +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) + + filter(pred: (e:T) => boolean): Observable; +>filter : Symbol(Observable.filter, Decl(observable.ts, 0, 36)) +>pred : Symbol(pred, Decl(observable.ts, 1, 11)) +>e : Symbol(e, Decl(observable.ts, 1, 18)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +>Observable : Symbol(Observable, Decl(observable.ts, 0, 0), Decl(map.ts, 5, 31)) +>T : Symbol(T, Decl(observable.ts, 0, 32), Decl(map.ts, 6, 25)) +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +import "./map"; + +let x: Observable; +>x : Symbol(x, Decl(main.ts, 3, 3)) +>Observable : Symbol(Observable, Decl(main.ts, 0, 8)) + +let y = x.map(x => x + 1); +>y : Symbol(y, Decl(main.ts, 4, 3)) +>x.map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 3, 3)) +>map : Symbol(Observable.map, Decl(map.ts, 6, 29)) +>x : Symbol(x, Decl(main.ts, 4, 14)) +>x : Symbol(x, Decl(main.ts, 4, 14)) + diff --git a/tests/baselines/reference/moduleAugmentationNoNewNames.types b/tests/baselines/reference/moduleAugmentationNoNewNames.types new file mode 100644 index 00000000000..37dc54b6663 --- /dev/null +++ b/tests/baselines/reference/moduleAugmentationNoNewNames.types @@ -0,0 +1,86 @@ +=== tests/cases/compiler/map.ts === + +import { Observable } from "./observable" +>Observable : typeof Observable + +(Observable.prototype).map = function() { } +>(Observable.prototype).map = function() { } : () => void +>(Observable.prototype).map : any +>(Observable.prototype) : any +>Observable.prototype : any +>Observable.prototype : Observable +>Observable : typeof Observable +>prototype : Observable +>map : any +>function() { } : () => void + +declare module "./observable" { + interface Observable { +>Observable : Observable +>T : T + + map(proj: (e:T) => U): Observable +>map : (proj: (e: T) => U) => Observable +>U : U +>proj : (e: T) => U +>e : T +>T : T +>U : U +>Observable : Observable +>U : U + } + class Bar {} +>Bar : Bar + + let y: number, z: string; +>y : number +>z : string + + let {a: x, b: x1}: {a: number, b: number}; +>a : any +>x : number +>b : any +>x1 : number +>a : number +>b : number + + module Z {} +>Z : any +} + +=== tests/cases/compiler/observable.ts === +export declare class Observable { +>Observable : Observable +>T : T + + filter(pred: (e:T) => boolean): Observable; +>filter : (pred: (e: T) => boolean) => Observable +>pred : (e: T) => boolean +>e : T +>T : T +>Observable : Observable +>T : T +} + +=== tests/cases/compiler/main.ts === +import { Observable } from "./observable" +>Observable : typeof Observable + +import "./map"; + +let x: Observable; +>x : Observable +>Observable : Observable + +let y = x.map(x => x + 1); +>y : Observable +>x.map(x => x + 1) : Observable +>x.map : (proj: (e: number) => U) => Observable +>x : Observable +>map : (proj: (e: number) => U) => Observable +>x => x + 1 : (x: number) => number +>x : number +>x + 1 : number +>x : number +>1 : number + diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt new file mode 100644 index 00000000000..f469885e405 --- /dev/null +++ b/tests/baselines/reference/newNamesInGlobalAugmentations1.errors.txt @@ -0,0 +1,26 @@ +tests/cases/compiler/f1.d.ts(13,5): error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + + +==== tests/cases/compiler/f1.d.ts (1 errors) ==== + + export {}; + + declare module M.M1 { + export let x: number; + } + declare global { + interface SymbolConstructor { + observable: symbol; + } + class Cls {x} + let [a, b]: number[]; + export import X = M.M1.x; + ~~~~~~ +!!! error TS2667: Imports are not permitted in module augmentations. Consider moving them to the enclosing external module. + } + +==== tests/cases/compiler/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.symbols b/tests/baselines/reference/newNamesInGlobalAugmentations1.symbols deleted file mode 100644 index 955061ee116..00000000000 --- a/tests/baselines/reference/newNamesInGlobalAugmentations1.symbols +++ /dev/null @@ -1,53 +0,0 @@ -=== tests/cases/compiler/f1.d.ts === - -export {}; - -declare module M.M1 { ->M : Symbol(M, Decl(f1.d.ts, 1, 10)) ->M1 : Symbol(M1, Decl(f1.d.ts, 3, 17)) - - export let x: number; ->x : Symbol(x, Decl(f1.d.ts, 4, 14)) -} -declare global { ->global : Symbol(, Decl(f1.d.ts, 5, 1)) - - interface SymbolConstructor { ->SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(f1.d.ts, 6, 16)) - - observable: symbol; ->observable : Symbol(SymbolConstructor.observable, Decl(f1.d.ts, 7, 33)) - } - class Cls {x} ->Cls : Symbol(Cls, Decl(f1.d.ts, 9, 5)) ->x : Symbol(Cls.x, Decl(f1.d.ts, 10, 15)) - - let [a, b]: number[]; ->a : Symbol(a, Decl(f1.d.ts, 11, 9)) ->b : Symbol(b, Decl(f1.d.ts, 11, 11)) - - export import X = M.M1.x; ->X : Symbol(X, Decl(f1.d.ts, 11, 25)) ->M : Symbol(M, Decl(f1.d.ts, 1, 10)) ->M1 : Symbol(M.M1, Decl(f1.d.ts, 3, 17)) ->x : Symbol(X, Decl(f1.d.ts, 4, 14)) -} - -=== tests/cases/compiler/main.ts === - -Symbol.observable; ->Symbol.observable : Symbol(SymbolConstructor.observable, Decl(f1.d.ts, 7, 33)) ->Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) ->observable : Symbol(SymbolConstructor.observable, Decl(f1.d.ts, 7, 33)) - -new Cls().x ->new Cls().x : Symbol(Cls.x, Decl(f1.d.ts, 10, 15)) ->Cls : Symbol(Cls, Decl(f1.d.ts, 9, 5)) ->x : Symbol(Cls.x, Decl(f1.d.ts, 10, 15)) - -let c = a + b + X; ->c : Symbol(c, Decl(main.ts, 3, 3)) ->a : Symbol(a, Decl(f1.d.ts, 11, 9)) ->b : Symbol(b, Decl(f1.d.ts, 11, 11)) ->X : Symbol(X, Decl(f1.d.ts, 11, 25)) - diff --git a/tests/baselines/reference/newNamesInGlobalAugmentations1.types b/tests/baselines/reference/newNamesInGlobalAugmentations1.types deleted file mode 100644 index a9b879fb4c5..00000000000 --- a/tests/baselines/reference/newNamesInGlobalAugmentations1.types +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/compiler/f1.d.ts === - -export {}; - -declare module M.M1 { ->M : typeof M ->M1 : typeof M1 - - export let x: number; ->x : number -} -declare global { ->global : any - - interface SymbolConstructor { ->SymbolConstructor : SymbolConstructor - - observable: symbol; ->observable : symbol - } - class Cls {x} ->Cls : Cls ->x : any - - let [a, b]: number[]; ->a : number ->b : number - - export import X = M.M1.x; ->X : number ->M : typeof M ->M1 : typeof M.M1 ->x : number -} - -=== tests/cases/compiler/main.ts === - -Symbol.observable; ->Symbol.observable : symbol ->Symbol : SymbolConstructor ->observable : symbol - -new Cls().x ->new Cls().x : any ->new Cls() : Cls ->Cls : typeof Cls ->x : any - -let c = a + b + X; ->c : number ->a + b + X : number ->a + b : number ->a : number ->b : number ->X : number -