forked from microsoft/TypeScript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
throw an error when no default export present (microsoft#35815)
- Loading branch information
1 parent
91ffa1c
commit daf786e
Showing
44 changed files
with
548 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/reexportMissingDefault.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const b = null; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault.ts] //// | ||
|
||
//// [b.ts] | ||
export const b = null; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.b = null; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var b_1 = require("./b"); | ||
exports.b = b_1.b; | ||
var b_2 = require("./b"); | ||
exports["default"] = b_2["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : Symbol(b, Decl(b.ts, 0, 12)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default } from "./b"; | ||
>default : Symbol(default, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : any | ||
>null : null | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : any | ||
|
||
export { default } from "./b"; | ||
>default : any | ||
|
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/reexportMissingDefault1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const b = null; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault1.ts] //// | ||
|
||
//// [b.ts] | ||
export const b = null; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
|
||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.b = null; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var b_1 = require("./b"); | ||
exports.b = b_1.b; | ||
var b_2 = require("./b"); | ||
exports["default"] = b_2["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : Symbol(b, Decl(b.ts, 0, 12)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default } from "./b"; | ||
>default : Symbol(default, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : any | ||
>null : null | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : any | ||
|
||
export { default } from "./b"; | ||
>default : any | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/reexportMissingDefault2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const b = null; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault2.ts] //// | ||
|
||
//// [b.ts] | ||
export const b = null; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.b = null; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var b_1 = require("./b"); | ||
exports.b = b_1.b; | ||
var b_2 = require("./b"); | ||
exports["default"] = b_2["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : Symbol(b, Decl(b.ts, 0, 12)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default } from "./b"; | ||
>default : Symbol(default, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : any | ||
>null : null | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : any | ||
|
||
export { default } from "./b"; | ||
>default : any | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/reexportMissingDefault3.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const b = null; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default as a } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault3.ts] //// | ||
|
||
//// [b.ts] | ||
export const b = null; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default as a } from "./b"; | ||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.b = null; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var b_1 = require("./b"); | ||
exports.b = b_1.b; | ||
var b_2 = require("./b"); | ||
exports.a = b_2["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : Symbol(b, Decl(b.ts, 0, 12)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default as a } from "./b"; | ||
>a : Symbol(a, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export const b = null; | ||
>b : any | ||
>null : null | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : any | ||
|
||
export { default as a } from "./b"; | ||
>default : any | ||
>a : any | ||
|
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/reexportMissingDefault4.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.d.ts (0 errors) ==== | ||
declare var b: number; | ||
export { b }; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault4.ts] //// | ||
|
||
//// [b.d.ts] | ||
declare var b: number; | ||
export { b }; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var b_1 = require("./b"); | ||
exports.b = b_1.b; | ||
var b_2 = require("./b"); | ||
exports["default"] = b_2["default"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/compiler/b.d.ts === | ||
declare var b: number; | ||
>b : Symbol(b, Decl(b.d.ts, 0, 11)) | ||
|
||
export { b }; | ||
>b : Symbol(b, Decl(b.d.ts, 1, 8)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default } from "./b"; | ||
>default : Symbol(default, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/compiler/b.d.ts === | ||
declare var b: number; | ||
>b : number | ||
|
||
export { b }; | ||
>b : number | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : number | ||
|
||
export { default } from "./b"; | ||
>default : any | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [tests/cases/compiler/reexportMissingDefault5.ts] //// | ||
|
||
//// [b.d.ts] | ||
declare var b: number; | ||
export { b }; | ||
|
||
//// [a.ts] | ||
export { b } from "./b"; | ||
export { default as Foo } from "./b"; | ||
|
||
//// [a.js] | ||
System.register(["./b"], function (exports_1, context_1) { | ||
"use strict"; | ||
var __moduleName = context_1 && context_1.id; | ||
return { | ||
setters: [ | ||
function (b_1_1) { | ||
exports_1({ | ||
"b": b_1_1["b"] | ||
}); | ||
exports_1({ | ||
"Foo": b_1_1["default"] | ||
}); | ||
} | ||
], | ||
execute: function () { | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=== tests/cases/compiler/b.d.ts === | ||
declare var b: number; | ||
>b : Symbol(b, Decl(b.d.ts, 0, 11)) | ||
|
||
export { b }; | ||
>b : Symbol(b, Decl(b.d.ts, 1, 8)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : Symbol(b, Decl(a.ts, 0, 8)) | ||
|
||
export { default as Foo } from "./b"; | ||
>default : Symbol("tests/cases/compiler/b", Decl(b.d.ts, 0, 0)) | ||
>Foo : Symbol(Foo, Decl(a.ts, 1, 8)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=== tests/cases/compiler/b.d.ts === | ||
declare var b: number; | ||
>b : number | ||
|
||
export { b }; | ||
>b : number | ||
|
||
=== tests/cases/compiler/a.ts === | ||
export { b } from "./b"; | ||
>b : number | ||
|
||
export { default as Foo } from "./b"; | ||
>default : typeof import("tests/cases/compiler/b") | ||
>Foo : typeof import("tests/cases/compiler/b") | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/reexportMissingDefault6.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
tests/cases/compiler/a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. | ||
|
||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
export const b = null; | ||
|
||
==== tests/cases/compiler/a.ts (1 errors) ==== | ||
export { b } from "./b"; | ||
export { default } from "./b"; | ||
~~~~~~~ | ||
!!! error TS2305: Module '"./b"' has no exported member 'default'. |
Oops, something went wrong.