-
Notifications
You must be signed in to change notification settings - Fork 13.1k
fix issue where duplicate default exports aren't detected #46871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f33c0fa
fix issue where duplicate default exports aren't detected when there'…
DetachHead fdfdfd8
accept baseline change
DetachHead 3213d10
add `exportDefaultInterfaceClassAndValue` test
DetachHead d478401
add more tests for multiple default exports
DetachHead 9f7ba44
add two interfaces test
DetachHead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/exportDefaultClassAndValue.errors.txt
This file contains hidden or 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/exportDefaultClassAndValue.ts(2,1): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultClassAndValue.ts(3,22): error TS2323: Cannot redeclare exported variable 'default'. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/exportDefaultClassAndValue.ts (2 errors) ==== | ||
| const foo = 1 | ||
| export default foo | ||
| ~~~~~~~~~~~~~~~~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| export default class Foo {} | ||
| ~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
|
|
This file contains hidden or 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 @@ | ||
| //// [exportDefaultClassAndValue.ts] | ||
| const foo = 1 | ||
| export default foo | ||
| export default class Foo {} | ||
|
|
||
|
|
||
| //// [exportDefaultClassAndValue.js] | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| var foo = 1; | ||
| exports["default"] = foo; | ||
| var Foo = /** @class */ (function () { | ||
| function Foo() { | ||
| } | ||
| return Foo; | ||
| }()); | ||
| exports["default"] = Foo; |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/exportDefaultClassAndValue.symbols
This file contains hidden or 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,10 @@ | ||
| === tests/cases/compiler/exportDefaultClassAndValue.ts === | ||
| const foo = 1 | ||
| >foo : Symbol(foo, Decl(exportDefaultClassAndValue.ts, 0, 5)) | ||
|
|
||
| export default foo | ||
| >foo : Symbol(foo, Decl(exportDefaultClassAndValue.ts, 0, 5)) | ||
|
|
||
| export default class Foo {} | ||
| >Foo : Symbol(foo, Decl(exportDefaultClassAndValue.ts, 0, 13), Decl(exportDefaultClassAndValue.ts, 1, 18)) | ||
|
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/exportDefaultClassAndValue.types
This file contains hidden or 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/exportDefaultClassAndValue.ts === | ||
| const foo = 1 | ||
| >foo : 1 | ||
| >1 : 1 | ||
|
|
||
| export default foo | ||
| >foo : 1 | ||
|
|
||
| export default class Foo {} | ||
| >Foo : foo | ||
|
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/exportDefaultInterfaceAndFunctionOverloads.js
This file contains hidden or 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,16 @@ | ||
| //// [exportDefaultInterfaceAndFunctionOverloads.ts] | ||
| export default function foo(value: number): number | ||
| export default function foo(value: string): string | ||
| export default function foo(value: string | number): string | number { | ||
| return 1 | ||
| } | ||
| export default interface Foo {} | ||
|
|
||
|
|
||
| //// [exportDefaultInterfaceAndFunctionOverloads.js] | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| function foo(value) { | ||
| return 1; | ||
| } | ||
| exports["default"] = foo; |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/exportDefaultInterfaceAndFunctionOverloads.symbols
This file contains hidden or 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,18 @@ | ||
| === tests/cases/compiler/exportDefaultInterfaceAndFunctionOverloads.ts === | ||
| export default function foo(value: number): number | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 4, 1)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 28)) | ||
|
|
||
| export default function foo(value: string): string | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 4, 1)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 1, 28)) | ||
|
|
||
| export default function foo(value: string | number): string | number { | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 4, 1)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 2, 28)) | ||
|
|
||
| return 1 | ||
| } | ||
| export default interface Foo {} | ||
| >Foo : Symbol(foo, Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceAndFunctionOverloads.ts, 4, 1)) | ||
|
|
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/exportDefaultInterfaceAndFunctionOverloads.types
This file contains hidden or 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,18 @@ | ||
| === tests/cases/compiler/exportDefaultInterfaceAndFunctionOverloads.ts === | ||
| export default function foo(value: number): number | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : number | ||
|
|
||
| export default function foo(value: string): string | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : string | ||
|
|
||
| export default function foo(value: string | number): string | number { | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : string | number | ||
|
|
||
| return 1 | ||
| >1 : 1 | ||
| } | ||
| export default interface Foo {} | ||
|
|
11 changes: 10 additions & 1 deletion
11
tests/baselines/reference/exportDefaultInterfaceAndTwoFunctions.errors.txt
This file contains hidden or 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 |
|---|---|---|
| @@ -1,13 +1,22 @@ | ||
| tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts(1,26): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts(2,1): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts(2,1): error TS2393: Duplicate function implementation. | ||
| tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts(3,1): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts(3,1): error TS2393: Duplicate function implementation. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts (2 errors) ==== | ||
| ==== tests/cases/compiler/exportDefaultInterfaceAndTwoFunctions.ts (5 errors) ==== | ||
| export default interface A { a: string; } | ||
| ~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| export default function() { return 1; } | ||
| ~~~~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| ~~~~~~ | ||
| !!! error TS2393: Duplicate function implementation. | ||
| export default function() { return 2; } | ||
| ~~~~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| ~~~~~~ | ||
| !!! error TS2393: Duplicate function implementation. | ||
|
|
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/exportDefaultInterfaceClassAndFunctionOverloads.errors.txt
This file contains hidden or 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,30 @@ | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts(1,25): error TS2528: A module cannot have multiple default exports. | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts(2,25): error TS2528: A module cannot have multiple default exports. | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts(3,25): error TS2528: A module cannot have multiple default exports. | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts(7,16): error TS2528: A module cannot have multiple default exports. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts (4 errors) ==== | ||
| export default function foo(value: number): number | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS2753 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:7:16: Another export default is here. | ||
| export default function foo(value: string): string | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS6204 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:7:16: and here. | ||
| export default function foo(value: string | number): string | number { | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS6204 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:7:16: and here. | ||
| return 1 | ||
| } | ||
| declare class Foo {} | ||
| export default Foo | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS2752 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:1:25: The first export default is here. | ||
| !!! related TS2752 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:2:25: The first export default is here. | ||
| !!! related TS2752 tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts:3:25: The first export default is here. | ||
| export default interface Bar {} | ||
|
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/exportDefaultInterfaceClassAndFunctionOverloads.js
This file contains hidden or 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,19 @@ | ||
| //// [exportDefaultInterfaceClassAndFunctionOverloads.ts] | ||
| export default function foo(value: number): number | ||
| export default function foo(value: string): string | ||
| export default function foo(value: string | number): string | number { | ||
| return 1 | ||
| } | ||
| declare class Foo {} | ||
| export default Foo | ||
| export default interface Bar {} | ||
|
|
||
|
|
||
| //// [exportDefaultInterfaceClassAndFunctionOverloads.js] | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| function foo(value) { | ||
| return 1; | ||
| } | ||
| exports["default"] = foo; | ||
| exports["default"] = Foo; |
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/exportDefaultInterfaceClassAndFunctionOverloads.symbols
This file contains hidden or 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,24 @@ | ||
| === tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts === | ||
| export default function foo(value: number): number | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 6, 18)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 28)) | ||
|
|
||
| export default function foo(value: string): string | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 6, 18)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 1, 28)) | ||
|
|
||
| export default function foo(value: string | number): string | number { | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 6, 18)) | ||
| >value : Symbol(value, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 2, 28)) | ||
|
|
||
| return 1 | ||
| } | ||
| declare class Foo {} | ||
| >Foo : Symbol(Foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 4, 1)) | ||
|
|
||
| export default Foo | ||
| >Foo : Symbol(Foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 4, 1)) | ||
|
|
||
| export default interface Bar {} | ||
| >Bar : Symbol(foo, Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 0), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 0, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 1, 50), Decl(exportDefaultInterfaceClassAndFunctionOverloads.ts, 6, 18)) | ||
|
|
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/exportDefaultInterfaceClassAndFunctionOverloads.types
This file contains hidden or 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,24 @@ | ||
| === tests/cases/compiler/exportDefaultInterfaceClassAndFunctionOverloads.ts === | ||
| export default function foo(value: number): number | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : number | ||
|
|
||
| export default function foo(value: string): string | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : string | ||
|
|
||
| export default function foo(value: string | number): string | number { | ||
| >foo : { (value: number): number; (value: string): string; } | ||
| >value : string | number | ||
|
|
||
| return 1 | ||
| >1 : 1 | ||
| } | ||
| declare class Foo {} | ||
| >Foo : Foo | ||
|
|
||
| export default Foo | ||
| >Foo : Foo | ||
|
|
||
| export default interface Bar {} | ||
|
|
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/exportDefaultInterfaceClassAndValue.errors.txt
This file contains hidden or 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/exportDefaultInterfaceClassAndValue.ts(2,1): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndValue.ts(3,22): error TS2323: Cannot redeclare exported variable 'default'. | ||
| tests/cases/compiler/exportDefaultInterfaceClassAndValue.ts(4,26): error TS2323: Cannot redeclare exported variable 'default'. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/exportDefaultInterfaceClassAndValue.ts (3 errors) ==== | ||
| const foo = 1 | ||
| export default foo | ||
| ~~~~~~~~~~~~~~~~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| export default class Foo {} | ||
| ~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
| export default interface Foo {} | ||
| ~~~ | ||
| !!! error TS2323: Cannot redeclare exported variable 'default'. | ||
|
|
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/exportDefaultInterfaceClassAndValue.js
This file contains hidden or 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,18 @@ | ||
| //// [exportDefaultInterfaceClassAndValue.ts] | ||
| const foo = 1 | ||
| export default foo | ||
| export default class Foo {} | ||
| export default interface Foo {} | ||
|
|
||
|
|
||
| //// [exportDefaultInterfaceClassAndValue.js] | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| var foo = 1; | ||
| exports["default"] = foo; | ||
| var Foo = /** @class */ (function () { | ||
| function Foo() { | ||
| } | ||
| return Foo; | ||
| }()); | ||
| exports["default"] = Foo; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/exportDefaultInterfaceClassAndValue.symbols
This file contains hidden or 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/exportDefaultInterfaceClassAndValue.ts === | ||
| const foo = 1 | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndValue.ts, 0, 5)) | ||
|
|
||
| export default foo | ||
| >foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndValue.ts, 0, 5)) | ||
|
|
||
| export default class Foo {} | ||
| >Foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndValue.ts, 0, 13), Decl(exportDefaultInterfaceClassAndValue.ts, 1, 18), Decl(exportDefaultInterfaceClassAndValue.ts, 2, 27)) | ||
|
|
||
| export default interface Foo {} | ||
| >Foo : Symbol(foo, Decl(exportDefaultInterfaceClassAndValue.ts, 0, 13), Decl(exportDefaultInterfaceClassAndValue.ts, 1, 18), Decl(exportDefaultInterfaceClassAndValue.ts, 2, 27)) | ||
|
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/exportDefaultInterfaceClassAndValue.types
This file contains hidden or 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/exportDefaultInterfaceClassAndValue.ts === | ||
| const foo = 1 | ||
| >foo : 1 | ||
| >1 : 1 | ||
|
|
||
| export default foo | ||
| >foo : 1 | ||
|
|
||
| export default class Foo {} | ||
| >Foo : foo | ||
|
|
||
| export default interface Foo {} | ||
|
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/exportDefaultTypeAndClass.errors.txt
This file contains hidden or 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/exportDefaultTypeAndClass.ts(1,22): error TS2528: A module cannot have multiple default exports. | ||
| tests/cases/compiler/exportDefaultTypeAndClass.ts(3,16): error TS2528: A module cannot have multiple default exports. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/exportDefaultTypeAndClass.ts (2 errors) ==== | ||
| export default class Foo {} | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS2753 tests/cases/compiler/exportDefaultTypeAndClass.ts:3:16: Another export default is here. | ||
| type Bar = {} | ||
| export default Bar | ||
| ~~~ | ||
| !!! error TS2528: A module cannot have multiple default exports. | ||
| !!! related TS2752 tests/cases/compiler/exportDefaultTypeAndClass.ts:1:22: The first export default is here. | ||
|
|
This file contains hidden or 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 @@ | ||
| //// [exportDefaultTypeAndClass.ts] | ||
| export default class Foo {} | ||
| type Bar = {} | ||
| export default Bar | ||
|
|
||
|
|
||
| //// [exportDefaultTypeAndClass.js] | ||
| "use strict"; | ||
| exports.__esModule = true; | ||
| var Foo = /** @class */ (function () { | ||
| function Foo() { | ||
| } | ||
| return Foo; | ||
| }()); | ||
| exports["default"] = Foo; |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/exportDefaultTypeAndClass.symbols
This file contains hidden or 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,10 @@ | ||
| === tests/cases/compiler/exportDefaultTypeAndClass.ts === | ||
| export default class Foo {} | ||
| >Foo : Symbol(Foo, Decl(exportDefaultTypeAndClass.ts, 0, 0)) | ||
|
|
||
| type Bar = {} | ||
| >Bar : Symbol(Bar, Decl(exportDefaultTypeAndClass.ts, 0, 27)) | ||
|
|
||
| export default Bar | ||
| >Bar : Symbol(Bar, Decl(exportDefaultTypeAndClass.ts, 0, 27)) | ||
|
|
This file contains hidden or 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,10 @@ | ||
| === tests/cases/compiler/exportDefaultTypeAndClass.ts === | ||
| export default class Foo {} | ||
| >Foo : Foo | ||
|
|
||
| type Bar = {} | ||
| >Bar : Bar | ||
|
|
||
| export default Bar | ||
| >Bar : Bar | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.