Skip to content

Generic gets lost in 3.8.2 #37110

Closed

Description

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

Activity

  1. mikearnaldi commented on Feb 29, 2020

    @mikearnaldi
    ContributorAuthor

    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

  2. added
    BugA bug in TypeScript
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Apr 6, 2020
  3. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions