Skip to content
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

SpecWatchFilter type in Firestore tests will not compile with upcoming Typescript 2.7 #309

Closed
sandersn opened this issue Nov 9, 2017 · 0 comments · Fixed by #310
Closed

Comments

@sandersn
Copy link
Contributor

sandersn commented Nov 9, 2017

[REQUIRED] Describe your environment

  • Operating System version: n/a
  • Firebase SDK version: building from master
  • Firebase Product: firestore

[REQUIRED] Describe the problem

Previously, the type SpecWatchFilter in spec_test_runner was specified as a tuple, but it was later used with push. It's actually an array with a first element that is guaranteed to be present, and of type TargetId[].

In the upcoming Typescript 2.7, tuples will be fixed-length and this usage will fail. The fix is to change the definition of SpecWatchFilter to an interface that extends Array<TargetId[] | string> and whose required '0' property is a TargetId[]. I'll have a PR up shortly that does this.

Steps to reproduce:

Build with typescript@next.

Relevant Code:

// this will be an error in Typescript 2.7, because [targetIds].length === 1 
// but  [SpecFilterId[], string].length: 2
const filter: [SpecFilterId[], string] = [targetIds] as [SpecFilterId[], string];
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants