> For the complete documentation index, see [llms.txt](https://yes-1-am.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yes-1-am.gitbook.io/blog/typescript-yu-fa/lei-xing-tui-lun.md).

# 类型推论

TypeScript 里，在没有明确指出类型的地方，类型推论会帮助提供类型：

```
let x = 3;
```

以上x会自动推断为数字，这种推断发生在初始化变量和成员，设置函数的默认参数值，以及决定函数返回值时。
