-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support an optional type annotation on export default statement
- Loading branch information
Showing
24 changed files
with
172 additions
and
22 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/exportDefaultTypeAnnoation.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,8 @@ | ||
tests/cases/compiler/exportDefaultTypeAnnoation.ts(2,18): error TS1200: Type annotation on export statements are only allowed in ambient module declarations. | ||
|
||
|
||
==== tests/cases/compiler/exportDefaultTypeAnnoation.ts (1 errors) ==== | ||
|
||
export default : number; | ||
~~~~~~ | ||
!!! error TS1200: Type annotation on export statements are only allowed in ambient module declarations. |
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,6 @@ | ||
//// [exportDefaultTypeAnnoation.ts] | ||
|
||
export default : number; | ||
|
||
//// [exportDefaultTypeAnnoation.js] | ||
module.exports = ; |
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,7 @@ | ||
//// [exportDefaultTypeAnnoation2.ts] | ||
|
||
declare module "mod" { | ||
export default : number; | ||
} | ||
|
||
//// [exportDefaultTypeAnnoation2.js] |
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,6 @@ | ||
=== tests/cases/compiler/exportDefaultTypeAnnoation2.ts === | ||
|
||
No type information for this code.declare module "mod" { | ||
No type information for this code. export default : number; | ||
No type information for this code.} | ||
No type information for this code. |
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/exportDefaultTypeAnnoation3.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,21 @@ | ||
tests/cases/compiler/reference1.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'. | ||
tests/cases/compiler/reference2.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'. | ||
|
||
|
||
==== tests/cases/compiler/mod.d.ts (0 errors) ==== | ||
|
||
declare module "mod" { | ||
export default : number; | ||
} | ||
|
||
==== tests/cases/compiler/reference1.ts (1 errors) ==== | ||
import d from "mod"; | ||
var s: string = d; // Error | ||
~ | ||
!!! error TS2322: Type 'number' is not assignable to type 'string'. | ||
|
||
==== tests/cases/compiler/reference2.ts (1 errors) ==== | ||
import { default as d } from "mod"; | ||
var s: string = d; // Error | ||
~ | ||
!!! error TS2322: Type 'number' is not assignable to type 'string'. |
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,22 @@ | ||
//// [tests/cases/compiler/exportDefaultTypeAnnoation3.ts] //// | ||
|
||
//// [mod.d.ts] | ||
|
||
declare module "mod" { | ||
export default : number; | ||
} | ||
|
||
//// [reference1.ts] | ||
import d from "mod"; | ||
var s: string = d; // Error | ||
|
||
//// [reference2.ts] | ||
import { default as d } from "mod"; | ||
var s: string = d; // Error | ||
|
||
//// [reference1.js] | ||
var d = require("mod"); | ||
var s = d; // Error | ||
//// [reference2.js] | ||
var _mod = require("mod"); | ||
var s = _mod.default; // Error |
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,4 @@ | ||
// @target: es5 | ||
// @module: commonjs | ||
|
||
export default : number; |
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,6 @@ | ||
// @target: es5 | ||
// @module: commonjs | ||
|
||
declare module "mod" { | ||
export default : number; | ||
} |
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 @@ | ||
// @target: es5 | ||
// @module: commonjs | ||
|
||
// @fileName: mod.d.ts | ||
declare module "mod" { | ||
export default : number; | ||
} | ||
|
||
// @fileName: reference1.ts | ||
import d from "mod"; | ||
var s: string = d; // Error | ||
|
||
// @fileName: reference2.ts | ||
import { default as d } from "mod"; | ||
var s: string = d; // Error |
What function are we in? Github doesn't show it.