Skip to content

Type inference infers wrong type with extra elements of tuples #22563

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

Type inference infers wrong type with extra elements of tuples #22563

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 B<R, S> = [R] | [R, S];
declare function g<T, U>(f: B<T, U>): void;
g([[]] as [void[]]); // U: {}

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

Expected behavior:

h([[]] as [void[]]); // U: {}

Actual behavior:

h([[]] as [void[]]); // U: void[] | ConcatArray<void[]>

Playground Link:

Related Issues:

@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