-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Tuples in rest parameters and spread expressions #24897
Merged
Merged
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
8cd8edb
Allow generic rest parameters and infer tuples when possible
ahejlsberg 43bfccf
Accept new baselines
ahejlsberg 2e04322
Optional elements in tuple types + empty tuple types + other fixes.
ahejlsberg 346276c
Accept new baselines
ahejlsberg c69e4e7
Expand rest parameter with tuple types when emitting signatures
ahejlsberg 73e008d
Accept new baselines
ahejlsberg 7aee647
Record parameter names in inferred tuple types
ahejlsberg 9ae9371
Fix lint errors
ahejlsberg e239f86
Flatten spread expressions of tuple types
ahejlsberg 0b0a91a
Accept new baselines
ahejlsberg 5245642
Accept baseline API changes
ahejlsberg 39099a0
Merge branch 'master' into restTuples
ahejlsberg dee51ed
Accept baseline changes in APIs
ahejlsberg f93f6ec
Better algorithm for combined co- and contra-variant inferences.
ahejlsberg 6bdedad
Accept new baselines
ahejlsberg 58d5583
Minor fixes
ahejlsberg cee75aa
Properly widen type element types in inferred rest parameter types
ahejlsberg 0cc0fad
Add tests
ahejlsberg 09f17bc
Accept new baselines
ahejlsberg f1efd1d
Parsing and rudimentary checking of tuples with rest elements
ahejlsberg 4f99bc1
Merge branch 'master' into restTuples
ahejlsberg 64aabf2
Accept new baselines
ahejlsberg 82448af
Merge branch 'master' into restTuples
ahejlsberg 3f03a37
Infer union types for rest elements in tuples
ahejlsberg 43bac20
Array literals contextually typed by tuple types with rest elements
ahejlsberg ae859d6
Update destructuring to support optional and rest elements in tuples
ahejlsberg c231000
Update tests
ahejlsberg 4037d07
Accept new baselines
ahejlsberg cffa1dd
Accept new baselines
ahejlsberg 0a94f77
Accept new baselines
ahejlsberg b0d8c65
Merge branch 'master' into restTuples
ahejlsberg b650d7d
Fix issue
ahejlsberg 88444fe
Accept new baselines
ahejlsberg 28c9f59
Complete support for rest elements in tuples
ahejlsberg 9cd8ead
Update tests
ahejlsberg 3cc3b49
Accept new baselines
ahejlsberg d7443f0
Contextual typing by tuple rest elements
ahejlsberg d869e56
Add tests
ahejlsberg 5ef7e9f
Accept new baselines
ahejlsberg 656ccd8
Revert package.json change
ahejlsberg 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 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
Large diffs are not rendered by default.
Oops, 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
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 was deleted.
Oops, something went wrong.
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/anyIndexedAccessArrayNoException.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,11 +1,8 @@ | ||
tests/cases/compiler/anyIndexedAccessArrayNoException.ts(1,12): error TS1122: A tuple type element list cannot be empty. | ||
tests/cases/compiler/anyIndexedAccessArrayNoException.ts(1,12): error TS2538: Type '[]' cannot be used as an index type. | ||
|
||
|
||
==== tests/cases/compiler/anyIndexedAccessArrayNoException.ts (2 errors) ==== | ||
==== tests/cases/compiler/anyIndexedAccessArrayNoException.ts (1 errors) ==== | ||
var x: any[[]]; | ||
~~ | ||
!!! error TS1122: A tuple type element list cannot be empty. | ||
~~ | ||
!!! error TS2538: Type '[]' cannot be used as an index type. | ||
|
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.
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.
any specific reason for this change?
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.
Nope, I don't know where that came from.