-
Notifications
You must be signed in to change notification settings - Fork 13k
Apply --checkjs to bind diagnostics as well as check diagnostics #16210
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
9d0bbc4
Apply --checkJs to bind diagnostics as well as check diagnostics
amcasey 01d6d48
Add regression tests
amcasey cd84d2a
Use emptyArray, rather than []
amcasey 87b00fd
Add `@checkJs: true` to JS bind error tests
amcasey 549485d
Add some new bind errors to a couple of the JS baselines
amcasey 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
10 changes: 8 additions & 2 deletions
10
tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.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,15 +1,21 @@ | ||
tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports. | ||
tests/cases/compiler/a.js(1,22): error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. | ||
tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports. | ||
tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. | ||
tests/cases/compiler/a.js(3,20): error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. | ||
|
||
|
||
==== tests/cases/compiler/a.js (3 errors) ==== | ||
==== tests/cases/compiler/a.js (5 errors) ==== | ||
export default class a { | ||
~ | ||
!!! error TS2528: A module cannot have multiple default exports. | ||
~ | ||
!!! error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. | ||
} | ||
export default var a = 10; | ||
~~~~~~~~~~~~~~ | ||
!!! error TS2528: A module cannot have multiple default exports. | ||
~~~ | ||
!!! error TS1109: Expression expected. | ||
!!! error TS1109: Expression expected. | ||
~ | ||
!!! error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. |
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
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/unreachableJavascriptChecked.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,10 @@ | ||
tests/cases/compiler/unreachable.js(3,5): error TS7027: Unreachable code detected. | ||
|
||
|
||
==== tests/cases/compiler/unreachable.js (1 errors) ==== | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
~~~~~~ | ||
!!! error TS7027: Unreachable code detected. | ||
} |
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 @@ | ||
//// [unreachable.js] | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} | ||
|
||
//// [unreachable.js] | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/unreachableJavascriptUnchecked.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,11 @@ | ||
//// [unreachable.js] | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} | ||
|
||
//// [unreachable.js] | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/baselines/reference/unreachableJavascriptUnchecked.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,7 @@ | ||
=== tests/cases/compiler/unreachable.js === | ||
function unreachable() { | ||
>unreachable : Symbol(unreachable, Decl(unreachable.js, 0, 0)) | ||
|
||
return 1; | ||
return 2; | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/unreachableJavascriptUnchecked.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,10 @@ | ||
=== tests/cases/compiler/unreachable.js === | ||
function unreachable() { | ||
>unreachable : () => 1 | 2 | ||
|
||
return 1; | ||
>1 : 1 | ||
|
||
return 2; | ||
>2 : 2 | ||
} |
1 change: 1 addition & 0 deletions
1
tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts
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,4 +1,5 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @filename: a.js | ||
var a = 10; | ||
|
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,4 +1,5 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @filename: a.js | ||
let C = "sss"; | ||
|
1 change: 1 addition & 0 deletions
1
tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts
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,4 +1,5 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @filename: a.js | ||
// @target: es6 | ||
|
1 change: 1 addition & 0 deletions
1
tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts
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,4 +1,5 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @filename: a.js | ||
// @noFallthroughCasesInSwitch: true | ||
|
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,4 +1,5 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @filename: a.js | ||
// @target: es6 | ||
|
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,8 @@ | ||
// @Filename: unreachable.js | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @outDir: out | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} |
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,8 @@ | ||
// @Filename: unreachable.js | ||
// @allowJs: true | ||
// @checkJs: false | ||
// @outDir: out | ||
function unreachable() { | ||
return 1; | ||
return 2; | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emptyArray
instead of[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. What's the difference? Fewer allocations?