Skip to content

Tuple union types incorrectly infer never type #22562

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

Closed
falsandtru opened this issue Mar 14, 2018 · 0 comments
Closed

Tuple union types incorrectly infer never type #22562

falsandtru opened this issue Mar 14, 2018 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@falsandtru
Copy link
Contributor

separated from #22432

TypeScript Version: 2.7.0-dev.20180307

Search Terms:

Code

type C<R> = [R[]] | [R[], void];
declare function h<T>(f: C<T>): void;
h([[]] as [never[]]); // T: never[]
h([[]] as [void[]]); // T: void

Expected behavior:

h([[]] as [never[]]); // T: never
h([[]] as [void[]]); // T: void

Actual behavior:

h([[]] as [never[]]); // T: never[]
h([[]] as [void[]]); // T: void

Playground Link:

Related Issues:

@falsandtru falsandtru changed the title never type is incorrectly inferred from tuple union types Tuple union types incorrectly infer never type Mar 14, 2018
@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Mar 14, 2018
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 2.9 milestone Mar 14, 2018
@ahejlsberg ahejlsberg assigned ahejlsberg and unassigned sandersn Mar 23, 2018
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Mar 24, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants