-
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.
Disallow type annotation on a for-of variable
- Loading branch information
1 parent
147cc20
commit 7cb2a64
Showing
6 changed files
with
26 additions
and
12 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
6 changes: 3 additions & 3 deletions
6
tests/baselines/reference/parserES5ForOfStatement5.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher | ||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== | ||
for (var a: number of X) { | ||
~~~ | ||
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher | ||
~ | ||
!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. | ||
|
||
|
||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== | ||
for (var a: number of X) { | ||
~ | ||
!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. | ||
} |
2 comments
on commit 7cb2a64
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.
For our benefit, would you mind expounding on why type annotation in a for...of statement should be disallowed?
I personally find the type annotation quite helpful.
Thanks!
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.
Same here. should we still keep previous error msg?