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

Don't worry about empty tuple types in TupleToIntersection. #4502

Merged
merged 2 commits into from
Feb 26, 2019

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented 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.

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.

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 benjamn self-assigned this Feb 26, 2019
@benjamn benjamn merged commit bcaa0b7 into master Feb 26, 2019
@benjamn benjamn deleted the fix-TupleToIntersection branch February 26, 2019 23:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
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 this pull request may close these issues.

A tuple type element list cannot be empty , apollo-utilities error
1 participant