mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #3973 from Microsoft/disallowDefaultExportDeclMerging
Disallow merging for default export declarations
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m1.ts(11,18): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m2.ts(5,8): error TS2304: Cannot find name 'Entity'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(8,8): error TS2339: Property 'x' does not exist on type '() => number'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(9,8): error TS2339: Property 'y' does not exist on type '() => number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
|
||||
|
||||
export default function Decl() {
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
return 0;
|
||||
}
|
||||
|
||||
export interface Decl {
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
export namespace Decl {
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
export var x = 10;
|
||||
export var y = 20;
|
||||
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ====
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
var x: Entity;
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Entity'.
|
||||
var y: Entity.I;
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'Entity'.
|
||||
|
||||
Entity.x;
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type '() => number'.
|
||||
Entity.y;
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type '() => number'.
|
||||
50
tests/baselines/reference/defaultExportsCannotMerge01.js
Normal file
50
tests/baselines/reference/defaultExportsCannotMerge01.js
Normal file
@@ -0,0 +1,50 @@
|
||||
//// [tests/cases/conformance/es6/modules/defaultExportsCannotMerge01.ts] ////
|
||||
|
||||
//// [m1.ts]
|
||||
|
||||
export default function Decl() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
export interface Decl {
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
export namespace Decl {
|
||||
export var x = 10;
|
||||
export var y = 20;
|
||||
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
//// [m2.ts]
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
var x: Entity;
|
||||
var y: Entity.I;
|
||||
|
||||
Entity.x;
|
||||
Entity.y;
|
||||
|
||||
//// [m1.js]
|
||||
function Decl() {
|
||||
return 0;
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Decl;
|
||||
var Decl;
|
||||
(function (Decl) {
|
||||
Decl.x = 10;
|
||||
Decl.y = 20;
|
||||
})(Decl = exports.Decl || (exports.Decl = {}));
|
||||
//// [m2.js]
|
||||
var m1_1 = require("m1");
|
||||
m1_1.default();
|
||||
var x;
|
||||
var y;
|
||||
m1_1.default.x;
|
||||
m1_1.default.y;
|
||||
@@ -0,0 +1,44 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m1.ts(5,18): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'?
|
||||
tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(8,13): error TS2339: Property 'p1' does not exist on type 'Decl'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' does not exist on type 'Decl'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
|
||||
|
||||
export default class Decl {
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
}
|
||||
|
||||
export interface Decl {
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
export namespace Decl {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ====
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
~~~~~~~~
|
||||
!!! error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'?
|
||||
|
||||
var x: Entity;
|
||||
var y: Entity.I;
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'Entity'.
|
||||
var z = new Entity();
|
||||
var sum = z.p1 + z.p2
|
||||
~~
|
||||
!!! error TS2339: Property 'p1' does not exist on type 'Decl'.
|
||||
~~
|
||||
!!! error TS2339: Property 'p2' does not exist on type 'Decl'.
|
||||
42
tests/baselines/reference/defaultExportsCannotMerge02.js
Normal file
42
tests/baselines/reference/defaultExportsCannotMerge02.js
Normal file
@@ -0,0 +1,42 @@
|
||||
//// [tests/cases/conformance/es6/modules/defaultExportsCannotMerge02.ts] ////
|
||||
|
||||
//// [m1.ts]
|
||||
|
||||
export default class Decl {
|
||||
}
|
||||
|
||||
export interface Decl {
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
export namespace Decl {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
//// [m2.ts]
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
var x: Entity;
|
||||
var y: Entity.I;
|
||||
var z = new Entity();
|
||||
var sum = z.p1 + z.p2
|
||||
|
||||
//// [m1.js]
|
||||
var Decl = (function () {
|
||||
function Decl() {
|
||||
}
|
||||
return Decl;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Decl;
|
||||
//// [m2.js]
|
||||
var m1_1 = require("m1");
|
||||
m1_1.default();
|
||||
var x;
|
||||
var y;
|
||||
var z = new m1_1.default();
|
||||
var sum = z.p1 + z.p2;
|
||||
@@ -0,0 +1,47 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'?
|
||||
tests/cases/conformance/es6/modules/m2.ts(6,8): error TS2503: Cannot find namespace 'Entity'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(8,13): error TS2339: Property 'p1' does not exist on type 'Decl'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(8,20): error TS2339: Property 'p2' does not exist on type 'Decl'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ====
|
||||
|
||||
export default class Decl {
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
}
|
||||
|
||||
interface Decl {
|
||||
~~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
~~~~
|
||||
!!! error TS2651: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
namespace Decl {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (4 errors) ====
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
~~~~~~~~
|
||||
!!! error TS2348: Value of type 'typeof Decl' is not callable. Did you mean to include 'new'?
|
||||
|
||||
var x: Entity;
|
||||
var y: Entity.I;
|
||||
~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'Entity'.
|
||||
var z = new Entity();
|
||||
var sum = z.p1 + z.p2
|
||||
~~
|
||||
!!! error TS2339: Property 'p1' does not exist on type 'Decl'.
|
||||
~~
|
||||
!!! error TS2339: Property 'p2' does not exist on type 'Decl'.
|
||||
42
tests/baselines/reference/defaultExportsCannotMerge03.js
Normal file
42
tests/baselines/reference/defaultExportsCannotMerge03.js
Normal file
@@ -0,0 +1,42 @@
|
||||
//// [tests/cases/conformance/es6/modules/defaultExportsCannotMerge03.ts] ////
|
||||
|
||||
//// [m1.ts]
|
||||
|
||||
export default class Decl {
|
||||
}
|
||||
|
||||
interface Decl {
|
||||
p1: number;
|
||||
p2: number;
|
||||
}
|
||||
|
||||
namespace Decl {
|
||||
interface I {
|
||||
}
|
||||
}
|
||||
|
||||
//// [m2.ts]
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
var x: Entity;
|
||||
var y: Entity.I;
|
||||
var z = new Entity();
|
||||
var sum = z.p1 + z.p2
|
||||
|
||||
//// [m1.js]
|
||||
var Decl = (function () {
|
||||
function Decl() {
|
||||
}
|
||||
return Decl;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Decl;
|
||||
//// [m2.js]
|
||||
var m1_1 = require("m1");
|
||||
m1_1.default();
|
||||
var x;
|
||||
var y;
|
||||
var z = new m1_1.default();
|
||||
var sum = z.p1 + z.p2;
|
||||
@@ -0,0 +1,28 @@
|
||||
tests/cases/conformance/es6/modules/defaultExportsCannotMerge04.ts(2,25): error TS2651: Merged declaration 'Foo' cannot include a default export declaration. Consider adding a separate 'export default Foo' declaration instead.
|
||||
tests/cases/conformance/es6/modules/defaultExportsCannotMerge04.ts(5,11): error TS2651: Merged declaration 'Foo' cannot include a default export declaration. Consider adding a separate 'export default Foo' declaration instead.
|
||||
tests/cases/conformance/es6/modules/defaultExportsCannotMerge04.ts(9,11): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local.
|
||||
tests/cases/conformance/es6/modules/defaultExportsCannotMerge04.ts(12,18): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/defaultExportsCannotMerge04.ts (4 errors) ====
|
||||
|
||||
export default function Foo() {
|
||||
~~~
|
||||
!!! error TS2651: Merged declaration 'Foo' cannot include a default export declaration. Consider adding a separate 'export default Foo' declaration instead.
|
||||
}
|
||||
|
||||
namespace Foo {
|
||||
~~~
|
||||
!!! error TS2651: Merged declaration 'Foo' cannot include a default export declaration. Consider adding a separate 'export default Foo' declaration instead.
|
||||
export var x;
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local.
|
||||
}
|
||||
|
||||
export interface Foo {
|
||||
~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local.
|
||||
}
|
||||
23
tests/baselines/reference/defaultExportsCannotMerge04.js
Normal file
23
tests/baselines/reference/defaultExportsCannotMerge04.js
Normal file
@@ -0,0 +1,23 @@
|
||||
//// [defaultExportsCannotMerge04.ts]
|
||||
|
||||
export default function Foo() {
|
||||
}
|
||||
|
||||
namespace Foo {
|
||||
export var x;
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
}
|
||||
|
||||
export interface Foo {
|
||||
}
|
||||
|
||||
//// [defaultExportsCannotMerge04.js]
|
||||
function Foo() {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
})(Foo || (Foo = {}));
|
||||
@@ -1,21 +1,21 @@
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(24,15): error TS2395: Individual declarations in merged declaration I must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(25,22): error TS2395: Individual declarations in merged declaration I must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(26,22): error TS2395: Individual declarations in merged declaration E must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(27,15): error TS2395: Individual declarations in merged declaration E must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(32,12): error TS2395: Individual declarations in merged declaration inst must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(35,19): error TS2395: Individual declarations in merged declaration inst must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(42,9): error TS2395: Individual declarations in merged declaration v must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(43,16): error TS2395: Individual declarations in merged declaration v must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration w must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration w must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration F must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(24,15): error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(25,22): error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(26,22): error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(27,15): error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(32,12): error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(35,19): error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(42,9): error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(43,16): error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration F must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(58,19): error TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(64,11): error TS2395: Individual declarations in merged declaration D must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations in merged declaration D must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(58,19): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(64,11): error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local.
|
||||
tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateSymbolsExportMatching.ts (18 errors) ====
|
||||
@@ -44,28 +44,28 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Ind
|
||||
module N2 {
|
||||
interface I { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration I must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local.
|
||||
export interface I { } // error
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration I must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'I' must be all exported or all local.
|
||||
export interface E { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration E must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local.
|
||||
interface E { } // error
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration E must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'E' must be all exported or all local.
|
||||
}
|
||||
|
||||
// Should report error only once for instantiated module
|
||||
module M {
|
||||
module inst {
|
||||
~~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration inst must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
export module inst { // one error
|
||||
~~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration inst must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'inst' must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
}
|
||||
@@ -74,41 +74,41 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Ind
|
||||
module M2 {
|
||||
var v: string;
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration v must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local.
|
||||
export var v: string; // one error (visibility)
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration v must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'v' must be all exported or all local.
|
||||
var w: number;
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration w must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local.
|
||||
export var w: string; // two errors (visibility and type mismatch)
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration w must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local.
|
||||
}
|
||||
|
||||
module M {
|
||||
module F {
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration F must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local.
|
||||
~
|
||||
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
var t;
|
||||
}
|
||||
export function F() { } // Only one error for duplicate identifier (don't consider visibility)
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration F must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local.
|
||||
}
|
||||
|
||||
module M {
|
||||
class C { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local.
|
||||
module C { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
!!! 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 TS2395: Individual declarations in merged declaration C must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local.
|
||||
var t;
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Ind
|
||||
// Top level
|
||||
interface D { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration D must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local.
|
||||
export interface D { }
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration D must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'D' must be all exported or all local.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/innerModExport2.ts(5,12): error TS1005: ';' expected.
|
||||
tests/cases/compiler/innerModExport2.ts(7,20): error TS2395: Individual declarations in merged declaration export_var must be all exported or all local.
|
||||
tests/cases/compiler/innerModExport2.ts(13,9): error TS2395: Individual declarations in merged declaration export_var must be all exported or all local.
|
||||
tests/cases/compiler/innerModExport2.ts(7,20): error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local.
|
||||
tests/cases/compiler/innerModExport2.ts(13,9): error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local.
|
||||
tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExport
|
||||
var non_export_var = 0;
|
||||
export var export_var = 1;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration export_var must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local.
|
||||
|
||||
function NonExportFunc() { return 0; }
|
||||
|
||||
@@ -26,7 +26,7 @@ tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExport
|
||||
}
|
||||
var export_var: number;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2395: Individual declarations in merged declaration export_var must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local.
|
||||
|
||||
export var outer_var_export = 0;
|
||||
export function outerFuncExport() { return 0; }
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2300: Duplicate identifier 'bar'.
|
||||
tests/cases/conformance/es6/modules/m1.ts(11,1): error TS2300: Duplicate identifier 'default'.
|
||||
tests/cases/conformance/es6/modules/m2.ts(3,1): error TS2348: Value of type 'typeof foo' is not callable. Did you mean to include 'new'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ====
|
||||
|
||||
export default class foo {
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
}
|
||||
|
||||
export default function bar() {
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'bar'.
|
||||
|
||||
}
|
||||
|
||||
var x = 10;
|
||||
export default x;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'default'.
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (1 errors) ====
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
~~~~~~~~
|
||||
!!! error TS2348: Value of type 'typeof foo' is not callable. Did you mean to include 'new'?
|
||||
38
tests/baselines/reference/multipleDefaultExports01.js
Normal file
38
tests/baselines/reference/multipleDefaultExports01.js
Normal file
@@ -0,0 +1,38 @@
|
||||
//// [tests/cases/conformance/es6/modules/multipleDefaultExports01.ts] ////
|
||||
|
||||
//// [m1.ts]
|
||||
|
||||
export default class foo {
|
||||
|
||||
}
|
||||
|
||||
export default function bar() {
|
||||
|
||||
}
|
||||
|
||||
var x = 10;
|
||||
export default x;
|
||||
|
||||
//// [m2.ts]
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
//// [m1.js]
|
||||
var foo = (function () {
|
||||
function foo() {
|
||||
}
|
||||
return foo;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
function bar() {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = bar;
|
||||
var x = 10;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = x;
|
||||
//// [m2.js]
|
||||
var m1_1 = require("m1");
|
||||
m1_1.default();
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2393: Duplicate function implementation.
|
||||
tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2393: Duplicate function implementation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
|
||||
|
||||
export default function foo() {
|
||||
~~~
|
||||
!!! error TS2393: Duplicate function implementation.
|
||||
|
||||
}
|
||||
|
||||
export default function bar() {
|
||||
~~~
|
||||
!!! error TS2393: Duplicate function implementation.
|
||||
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m2.ts (0 errors) ====
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
29
tests/baselines/reference/multipleDefaultExports02.js
Normal file
29
tests/baselines/reference/multipleDefaultExports02.js
Normal file
@@ -0,0 +1,29 @@
|
||||
//// [tests/cases/conformance/es6/modules/multipleDefaultExports02.ts] ////
|
||||
|
||||
//// [m1.ts]
|
||||
|
||||
export default function foo() {
|
||||
|
||||
}
|
||||
|
||||
export default function bar() {
|
||||
|
||||
}
|
||||
|
||||
//// [m2.ts]
|
||||
import Entity from "m1"
|
||||
|
||||
Entity();
|
||||
|
||||
//// [m1.js]
|
||||
function foo() {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
function bar() {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = bar;
|
||||
//// [m2.js]
|
||||
var m1_1 = require("m1");
|
||||
m1_1.default();
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/multivar.ts(6,19): error TS2395: Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
tests/cases/compiler/multivar.ts(22,9): error TS2395: Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
tests/cases/compiler/multivar.ts(6,19): error TS2395: Individual declarations in merged declaration 'b2' must be all exported or all local.
|
||||
tests/cases/compiler/multivar.ts(22,9): error TS2395: Individual declarations in merged declaration 'b2' must be all exported or all local.
|
||||
|
||||
|
||||
==== tests/cases/compiler/multivar.ts (2 errors) ====
|
||||
@@ -10,7 +10,7 @@ tests/cases/compiler/multivar.ts(22,9): error TS2395: Individual declarations in
|
||||
|
||||
export var a, b2: number = 10, b;
|
||||
~~
|
||||
!!! error TS2395: Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'b2' must be all exported or all local.
|
||||
var m1;
|
||||
var a2, b22: number = 10, b222;
|
||||
var m3;
|
||||
@@ -28,7 +28,7 @@ tests/cases/compiler/multivar.ts(22,9): error TS2395: Individual declarations in
|
||||
declare var d1, d2;
|
||||
var b2;
|
||||
~~
|
||||
!!! error TS2395: Individual declarations in merged declaration b2 must be all exported or all local.
|
||||
!!! error TS2395: Individual declarations in merged declaration 'b2' must be all exported or all local.
|
||||
|
||||
declare var v1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user