Skip to content

Generic gets lost in 3.8.2 #37110

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
mikearnaldi opened this issue Feb 28, 2020 · 1 comment · Fixed by #37811
Closed

Generic gets lost in 3.8.2 #37110

mikearnaldi opened this issue Feb 28, 2020 · 1 comment · Fixed by #37811
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@mikearnaldi
Copy link

mikearnaldi commented Feb 28, 2020

const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _

const a = f(<K extends string>(_: K) => _ => ({}))

/*
in 3.8.2

(_: K) => <G>(_: G) => {};
*/

/*
in 3.7.5

<K extends string>(_: K) => <G>(_: G) => {};
*/

Expected behavior:
To be like in 3.7.5

Actual behavior:
K is lost

Buggy:
Playground Link

Working:
Playground Link

Note:
reproduce on next too

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Feb 29, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.9.0 milestone Feb 29, 2020
@mikearnaldi
Copy link
Author

Interesting enough if you specify the full signature the generic is preserved:

const f = <F extends (...args: any[]) => <G>(x: G) => void>(_: F): F => _
                                         .......
const a = f(<K extends string>(_: K) => <G>(_: G) => ({}))
                                         .......
a("ok")

Playground Link

@ahejlsberg ahejlsberg added Bug A bug in TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels Apr 6, 2020
@ahejlsberg ahejlsberg added the Fix Available A PR has been opened for this issue label Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants