# 请简述 typescript 中的 infer
Issue
欢迎在 Gtihub Issue 中回答此问题: Issue 731 (opens new window)
Author
和 returnType 有点关联,做返回值推断的
Author
infer
表示在 extends
条件语句中待推断的类型变量。
例子:
/**
* Obtain the parameters of a function type in a tuple
*/
type Parameters<T extends (...args: any) => any> = T extends (
...args: infer P
) => any
? P
: never;