IssueRaiser

2 - Return Type

<details> <summary>✍️ Answers</summary> Name your title starting with the question no you are trying to answer. For example: `#12 - my one-line solution` </details> ```ts type MyReturnType<T extends Function> = T extends (...args: any) => infer R ? R : never ``` Extend readings: - [Type inference in conditional types (Original PR)](https://github.com/Microsoft/TypeScript/pull/21496) - [TypeScript Tutorial - 'infer' keyword](https://dev.to/aexol/typescript-tutorial-infer-keyword-2cn) - 🇨🇳 [深入理解 TypeScript - Infer](https://jkchao.github.io/typescript-book-chinese/tips/infer.html)

Posted by antfu on Jul 25, 2020, 10:05 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (Software)

2 - Return Type

antfuJul 25, 2020, 10:05 AM

<details> <summary>✍️ Answers</summary> Name your title starting with the question no you are trying to answer. For example: `#12 - my one-line solution` </details> ```ts type MyReturnType<T extends Function> = T extends (...args: any) => infer R ? R : never ``` Extend readings: - [Type inference in conditional types (Original PR)](https://github.com/Microsoft/TypeScript/pull/21496) - [TypeScript Tutorial - 'infer' keyword](https://dev.to/aexol/typescript-tutorial-infer-keyword-2cn) - 🇨🇳 [深入理解 TypeScript - Infer](https://jkchao.github.io/typescript-book-chinese/tips/infer.html)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue