Firestore: in tests, fix SpecWatchFilter type to work on upcoming Typescript 2.7#310
Merged
wilhuff merged 3 commits intofirebase:masterfrom Nov 10, 2017
Merged
Conversation
Previously, the type SpecWatchFilter in spec_test_runner was specified as a tuple, but it was later used with `push` and is actually an array with a first element that is guaranteed to be present, and of type TargetId[]. In Typescript 2.7, tuples will be fixed-length and this usage will fail. This changes the definition of SpecWatchFilter to an interface that extends Array<TargetId[] | string> and whose required '0' property is a TargetId[].
Contributor
Author
|
Looks like CI broke because of incorrect credentials. Not sure what is going on there. |
wilhuff
reviewed
Nov 9, 2017
Contributor
wilhuff
left a comment
There was a problem hiding this comment.
Change LGTM, though we need to get CI sorted out.
@jshcrowthe - what can we do to get travis's credentials sorted?
| */ | ||
| export type SpecWatchFilter = [TargetId[], string]; | ||
| export interface SpecWatchFilter extends Array<TargetId[] | string> { | ||
| '0': TargetId[]; |
Contributor
There was a problem hiding this comment.
This is surprising that this works. Thanks for digging into it.
Contributor
Author
There was a problem hiding this comment.
I found it when I was testing stricter tuples for Typescript 2.7. The new definition is basically equivalent to the old meaning of 'tuple' in Typescript.
Contributor
Contributor
Author
|
All right, looks like CI passed this time. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #309
Previously, the type SpecWatchFilter in spec_test_runner was specified as a tuple, but it was later used with
pushand is actually an array with a first element that is guaranteed to be present, and of type TargetId[].In Typescript 2.7, tuples will be fixed-length and this usage will fail. This changes the definition of SpecWatchFilter to an interface that extends Array<TargetId[] | string> and whose required '0' property is a TargetId[].