Skip to content
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

ReturnType of function with generic type is unknown #38964

Closed
GoodbyeNJN opened this issue Jun 6, 2020 · 2 comments
Closed

ReturnType of function with generic type is unknown #38964

GoodbyeNJN opened this issue Jun 6, 2020 · 2 comments

Comments

@GoodbyeNJN
Copy link

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

@Harpush
Copy link

Harpush commented Jun 7, 2020

I am pretty sure duplicate of #37181

@GoodbyeNJN
Copy link
Author

I am pretty sure duplicate of #37181

Thanks, seems this issue does be duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants