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

A tuple type element list cannot be empty , apollo-utilities error #4501

Closed
chennas opened this issue Feb 26, 2019 · 7 comments · Fixed by #4502
Closed

A tuple type element list cannot be empty , apollo-utilities error #4501

chennas opened this issue Feb 26, 2019 · 7 comments · Fixed by #4502
Assignees

Comments

@chennas
Copy link

chennas commented Feb 26, 2019

Hello Team

We are getting the build issue in Jenkins, please see the screen shot below.

image

We are using the following apollo utilities as shown below.
image

@benjamn benjamn self-assigned this Feb 26, 2019
benjamn added a commit that referenced this issue Feb 26, 2019
Although a zero-argument call to `mergeDeep` was always pretty pointless,
it seemed worth handling that case for the sake of completeness.

Well, apparently empty tuple types are forbidden by section 3.8.5 of the
TypeScript spec, so (some versions of) the compiler complain about the
`[]` in the `T extends []` case of `TupleToIntersection`:
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#385-tuple-type-literals

Since we never really needed this case in the first place, the easy
solution is to remove it.

Note that the final cases in `TupleToIntersection` continue to cover the
zero-argument case, for whatever it may be worth:

  T extends (infer U)[] ? U : any

Should fix #4501.
@benjamn
Copy link
Member

benjamn commented Feb 26, 2019

Out of curiosity, what version of the typescript npm package are you using? It's surprising that this got past our type-checking, since mergeDeep has a bunch of tests.

@chennas
Copy link
Author

chennas commented Feb 26, 2019

Hi Benjamn , Thanks for your quick reply

we are using 2.8.4

Please see the below screen shot

image

image

benjamn added a commit that referenced this issue Feb 26, 2019
Although a zero-argument call to `mergeDeep` was always pretty pointless,
it seemed worth handling that case for the sake of completeness.

Well, apparently empty tuple types are forbidden by section 3.8.5 of the
TypeScript spec, so (some versions of) the compiler complain about the
`[]` in the `T extends []` case of `TupleToIntersection`:
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#385-tuple-type-literals

Since we never really needed this case in the first place, the easy
solution is to remove it.

Note that the final cases in `TupleToIntersection` continue to cover the
zero-argument case, for whatever it may be worth:

  T extends (infer U)[] ? U : any

Should fix #4501.
@chennas
Copy link
Author

chennas commented Feb 27, 2019

Hello Team,

Now we are getting this error.

image

@benjamn
Copy link
Member

benjamn commented Feb 27, 2019

Do you have the ability to update to typescript@3.x? Support for tuple-typed rest parameters was added in TypeScript 3.0: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#rest-elements-in-tuple-types

@benjamn
Copy link
Member

benjamn commented Feb 27, 2019

You might also try updating the Angular CLI, since they updated to TypeScript 3.0.1 in version 7.0.0: angular/angular-cli@88804b6

@chennas
Copy link
Author

chennas commented Feb 28, 2019

Hello Benjamn,

I got fixed by upgrading the below.

Typescript upgraded to 3.1.1 and angular-compiler-cli upgraded to 7.2.7

Thanks for the help

@benjamn
Copy link
Member

benjamn commented Feb 28, 2019

@chennas Awesome, I'm very glad to hear you had the option to upgrade, and that it solved the problem!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants