Skip to content

ReturnType of function with generic type is unknown #38964

Closed

Description

@GoodbyeNJN

TypeScript Version: 3.9.5

Search Terms: return type of function with generic type unknown

Code

type Func = <T = string>() => T;

type R = ReturnType<Func>;

Expected behavior: type R = string

Actual behavior: type R = unknown

Playground Link: https://www.typescriptlang.org/play/index.html#code/C4TwDgpgBAYgrgOwMZQLxQDwBU1QM7ABOAlggOYB8AFAJRoVRYBQTokUASrhxMHIQizgIGeMgpMgA
P.S. the typescript version of playground is 3.9.1, but this bug still exists in 3.9.5.

Related Issues: #26856

Activity

  1. Harpush commented on Jun 7, 2020

    @Harpush

    I am pretty sure duplicate of #37181

  2. GoodbyeNJN commented on Jun 7, 2020

    @GoodbyeNJN
    Author

    I am pretty sure duplicate of #37181

    Thanks, seems this issue does be duplicated.

  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

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions