mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge branch 'master' into duplicate-export-behavior
This commit is contained in:
24
tests/baselines/reference/allowSyntheticDefaultImports1.js
Normal file
24
tests/baselines/reference/allowSyntheticDefaultImports1.js
Normal file
@@ -0,0 +1,24 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports.Foo = Foo;
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"].Foo();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
|
||||
42
tests/baselines/reference/allowSyntheticDefaultImports2.js
Normal file
42
tests/baselines/reference/allowSyntheticDefaultImports2.js
Normal file
@@ -0,0 +1,42 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Namespace from "./b";
|
||||
~~~~~~~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
==== tests/cases/compiler/b.ts (0 errors) ====
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
43
tests/baselines/reference/allowSyntheticDefaultImports3.js
Normal file
43
tests/baselines/reference/allowSyntheticDefaultImports3.js
Normal file
@@ -0,0 +1,43 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports3.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
||||
17
tests/baselines/reference/allowSyntheticDefaultImports4.js
Normal file
17
tests/baselines/reference/allowSyntheticDefaultImports4.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports4.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"]();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
28
tests/baselines/reference/allowSyntheticDefaultImports5.js
Normal file
28
tests/baselines/reference/allowSyntheticDefaultImports5.js
Normal file
@@ -0,0 +1,28 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports5.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/b.d.ts (0 errors) ====
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Foo from "./b";
|
||||
~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Foo();
|
||||
|
||||
28
tests/baselines/reference/allowSyntheticDefaultImports6.js
Normal file
28
tests/baselines/reference/allowSyntheticDefaultImports6.js
Normal file
@@ -0,0 +1,28 @@
|
||||
//// [tests/cases/compiler/allowSyntheticDefaultImports6.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
||||
10
tests/cases/compiler/allowSyntheticDefaultImports1.ts
Normal file
10
tests/cases/compiler/allowSyntheticDefaultImports1.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @allowSyntheticDefaultImports: true
|
||||
// @module: commonjs
|
||||
// @Filename: a.ts
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
// @Filename: b.ts
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
9
tests/cases/compiler/allowSyntheticDefaultImports2.ts
Normal file
9
tests/cases/compiler/allowSyntheticDefaultImports2.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// @module: system
|
||||
// @Filename: a.ts
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
// @Filename: b.ts
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
10
tests/cases/compiler/allowSyntheticDefaultImports3.ts
Normal file
10
tests/cases/compiler/allowSyntheticDefaultImports3.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @allowSyntheticDefaultImports: false
|
||||
// @module: system
|
||||
// @Filename: a.ts
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
// @Filename: b.ts
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
11
tests/cases/compiler/allowSyntheticDefaultImports4.ts
Normal file
11
tests/cases/compiler/allowSyntheticDefaultImports4.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @allowSyntheticDefaultImports: true
|
||||
// @module: commonjs
|
||||
// @Filename: b.d.ts
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
// @Filename: a.ts
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
10
tests/cases/compiler/allowSyntheticDefaultImports5.ts
Normal file
10
tests/cases/compiler/allowSyntheticDefaultImports5.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @module: system
|
||||
// @Filename: b.d.ts
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
// @Filename: a.ts
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
11
tests/cases/compiler/allowSyntheticDefaultImports6.ts
Normal file
11
tests/cases/compiler/allowSyntheticDefaultImports6.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @allowSyntheticDefaultImports: false
|
||||
// @module: system
|
||||
// @Filename: b.d.ts
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
// @Filename: a.ts
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
Reference in New Issue
Block a user