mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 14:34:35 -06:00
Merge pull request #8485 from RyanCavanaugh/fix8478
Allow module augmentations to add new top-level names.
This commit is contained in:
commit
85ab935a70
@ -15741,13 +15741,6 @@ namespace ts {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
|
||||
break;
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
if ((<ImportEqualsDeclaration>node).moduleReference.kind !== SyntaxKind.StringLiteral) {
|
||||
if (!isGlobalAugmentation) {
|
||||
error((<ImportEqualsDeclaration>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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
49
tests/baselines/reference/augmentExportEquals3.symbols
Normal file
49
tests/baselines/reference/augmentExportEquals3.symbols
Normal file
@ -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))
|
||||
|
||||
52
tests/baselines/reference/augmentExportEquals3.types
Normal file
52
tests/baselines/reference/augmentExportEquals3.types
Normal file
@ -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
|
||||
|
||||
@ -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) ====
|
||||
/// <reference path="file1.d.ts"/>
|
||||
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;
|
||||
52
tests/baselines/reference/augmentExportEquals3_1.symbols
Normal file
52
tests/baselines/reference/augmentExportEquals3_1.symbols
Normal file
@ -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 ===
|
||||
/// <reference path="file1.d.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))
|
||||
|
||||
54
tests/baselines/reference/augmentExportEquals3_1.types
Normal file
54
tests/baselines/reference/augmentExportEquals3_1.types
Normal file
@ -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 ===
|
||||
/// <reference path="file1.d.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
|
||||
|
||||
@ -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;
|
||||
49
tests/baselines/reference/augmentExportEquals4.symbols
Normal file
49
tests/baselines/reference/augmentExportEquals4.symbols
Normal file
@ -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))
|
||||
|
||||
52
tests/baselines/reference/augmentExportEquals4.types
Normal file
52
tests/baselines/reference/augmentExportEquals4.types
Normal file
@ -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
|
||||
|
||||
@ -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) ====
|
||||
/// <reference path="file1.d.ts"/>
|
||||
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;
|
||||
53
tests/baselines/reference/augmentExportEquals4_1.symbols
Normal file
53
tests/baselines/reference/augmentExportEquals4_1.symbols
Normal file
@ -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 ===
|
||||
/// <reference path="file1.d.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))
|
||||
|
||||
55
tests/baselines/reference/augmentExportEquals4_1.types
Normal file
55
tests/baselines/reference/augmentExportEquals4_1.types
Normal file
@ -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 ===
|
||||
/// <reference path="file1.d.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
|
||||
|
||||
@ -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"
|
||||
|
||||
(<any>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"
|
||||
|
||||
(<any>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<T> {
|
||||
filter(pred: (e:T) => boolean): Observable<T>;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/main.ts (0 errors) ====
|
||||
import { Observable } from "./observable"
|
||||
import "./map1";
|
||||
import "./map2";
|
||||
|
||||
let x: Observable<number>;
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
=== tests/cases/compiler/map1.ts ===
|
||||
|
||||
import { Observable } from "./observable"
|
||||
>Observable : Symbol(Observable, Decl(map1.ts, 1, 8))
|
||||
|
||||
(<any>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))
|
||||
|
||||
(<any>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<T> {
|
||||
>Observable : Symbol(Observable, Decl(observable.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(observable.ts, 0, 32))
|
||||
|
||||
filter(pred: (e:T) => boolean): Observable<T>;
|
||||
>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<number>;
|
||||
>x : Symbol(x, Decl(main.ts, 4, 3))
|
||||
>Observable : Symbol(Observable, Decl(main.ts, 0, 8))
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
=== tests/cases/compiler/map1.ts ===
|
||||
|
||||
import { Observable } from "./observable"
|
||||
>Observable : typeof Observable
|
||||
|
||||
(<any>Observable.prototype).map = function() { }
|
||||
>(<any>Observable.prototype).map = function() { } : () => void
|
||||
>(<any>Observable.prototype).map : any
|
||||
>(<any>Observable.prototype) : any
|
||||
><any>Observable.prototype : any
|
||||
>Observable.prototype : Observable<any>
|
||||
>Observable : typeof Observable
|
||||
>prototype : Observable<any>
|
||||
>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
|
||||
|
||||
(<any>Observable.prototype).map = function() { }
|
||||
>(<any>Observable.prototype).map = function() { } : () => void
|
||||
>(<any>Observable.prototype).map : any
|
||||
>(<any>Observable.prototype) : any
|
||||
><any>Observable.prototype : any
|
||||
>Observable.prototype : Observable<any>
|
||||
>Observable : typeof Observable
|
||||
>prototype : Observable<any>
|
||||
>map : any
|
||||
>function() { } : () => void
|
||||
|
||||
declare module "./observable" {
|
||||
interface I {x1}
|
||||
>I : I
|
||||
>x1 : any
|
||||
}
|
||||
|
||||
|
||||
=== tests/cases/compiler/observable.ts ===
|
||||
export declare class Observable<T> {
|
||||
>Observable : Observable<T>
|
||||
>T : T
|
||||
|
||||
filter(pred: (e:T) => boolean): Observable<T>;
|
||||
>filter : (pred: (e: T) => boolean) => Observable<T>
|
||||
>pred : (e: T) => boolean
|
||||
>e : T
|
||||
>T : T
|
||||
>Observable : Observable<T>
|
||||
>T : T
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Observable } from "./observable"
|
||||
>Observable : typeof Observable
|
||||
|
||||
import "./map1";
|
||||
import "./map2";
|
||||
|
||||
let x: Observable<number>;
|
||||
>x : Observable<number>
|
||||
>Observable : Observable<T>
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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"
|
||||
|
||||
(<any>Observable.prototype).map = function() { }
|
||||
|
||||
declare module "./observable" {
|
||||
interface Observable<T> {
|
||||
map<U>(proj: (e:T) => U): Observable<U>
|
||||
}
|
||||
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<T> {
|
||||
filter(pred: (e:T) => boolean): Observable<T>;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/main.ts (0 errors) ====
|
||||
import { Observable } from "./observable"
|
||||
import "./map";
|
||||
|
||||
let x: Observable<number>;
|
||||
let y = x.map(x => x + 1);
|
||||
@ -0,0 +1,76 @@
|
||||
=== tests/cases/compiler/map.ts ===
|
||||
|
||||
import { Observable } from "./observable"
|
||||
>Observable : Symbol(Observable, Decl(map.ts, 1, 8))
|
||||
|
||||
(<any>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<T> {
|
||||
>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<U>(proj: (e:T) => U): Observable<U>
|
||||
>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<T> {
|
||||
>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<T>;
|
||||
>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<number>;
|
||||
>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))
|
||||
|
||||
86
tests/baselines/reference/moduleAugmentationNoNewNames.types
Normal file
86
tests/baselines/reference/moduleAugmentationNoNewNames.types
Normal file
@ -0,0 +1,86 @@
|
||||
=== tests/cases/compiler/map.ts ===
|
||||
|
||||
import { Observable } from "./observable"
|
||||
>Observable : typeof Observable
|
||||
|
||||
(<any>Observable.prototype).map = function() { }
|
||||
>(<any>Observable.prototype).map = function() { } : () => void
|
||||
>(<any>Observable.prototype).map : any
|
||||
>(<any>Observable.prototype) : any
|
||||
><any>Observable.prototype : any
|
||||
>Observable.prototype : Observable<any>
|
||||
>Observable : typeof Observable
|
||||
>prototype : Observable<any>
|
||||
>map : any
|
||||
>function() { } : () => void
|
||||
|
||||
declare module "./observable" {
|
||||
interface Observable<T> {
|
||||
>Observable : Observable<T>
|
||||
>T : T
|
||||
|
||||
map<U>(proj: (e:T) => U): Observable<U>
|
||||
>map : <U>(proj: (e: T) => U) => Observable<U>
|
||||
>U : U
|
||||
>proj : (e: T) => U
|
||||
>e : T
|
||||
>T : T
|
||||
>U : U
|
||||
>Observable : Observable<T>
|
||||
>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<T> {
|
||||
>Observable : Observable<T>
|
||||
>T : T
|
||||
|
||||
filter(pred: (e:T) => boolean): Observable<T>;
|
||||
>filter : (pred: (e: T) => boolean) => Observable<T>
|
||||
>pred : (e: T) => boolean
|
||||
>e : T
|
||||
>T : T
|
||||
>Observable : Observable<T>
|
||||
>T : T
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/main.ts ===
|
||||
import { Observable } from "./observable"
|
||||
>Observable : typeof Observable
|
||||
|
||||
import "./map";
|
||||
|
||||
let x: Observable<number>;
|
||||
>x : Observable<number>
|
||||
>Observable : Observable<T>
|
||||
|
||||
let y = x.map(x => x + 1);
|
||||
>y : Observable<number>
|
||||
>x.map(x => x + 1) : Observable<number>
|
||||
>x.map : <U>(proj: (e: number) => U) => Observable<U>
|
||||
>x : Observable<number>
|
||||
>map : <U>(proj: (e: number) => U) => Observable<U>
|
||||
>x => x + 1 : (x: number) => number
|
||||
>x : number
|
||||
>x + 1 : number
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
@ -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;
|
||||
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user