Skip to content

Commit 2c5f8ca

Browse files
authored
Merge pull request ascoders#347 from feikerwu/patch-2
typo: fix typo in 207.精读《Typescript infer 关键字》.md
2 parents cd543b1 + 88560b6 commit 2c5f8ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

前沿技术/207.精读《Typescript infer 关键字》.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Typescript 官网也拿 `ReturnType` 这一经典例子说明它的作用:
66
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : any;
77
```
88

9-
理解为:如果 `T` 继承了 `extends (...args: any[]) => any` 类型,则返回类型 `R`,否则返回 `any`。其中 `R` 是什么呢?`R` 被定义在 `extends (...args: any[]) => infer R` 中,即 R 是从传入参数类型中推导出来的。
9+
理解为:如果 `T` 继承了 `(...args: any[]) => any` 类型,则返回类型 `R`,否则返回 `any`。其中 `R` 是什么呢?`R` 被定义在 `extends (...args: any[]) => infer R` 中,即 R 是从传入参数类型中推导出来的。
1010

1111
## 精读
1212

0 commit comments

Comments
 (0)