You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
并不是所有的合并都被允许。现在,类不能与类合并,变量与类型不能合并,接口与类不能合并。想要模仿类的合并,请参考[Mixins in TypeScript](https://typescript.codeplex.com/wikipage?title=Mixins%20in%20TypeScript&referringTitle=Declaration%20Merging)。
2386
2386
2387
-
## <a name="10"></a>类型推断
2387
+
## <a name="10"></a>类型推论
2388
2388
2389
-
这节介绍TypeScript里的类型推断。即,类型是在哪里如何被推断的。
2389
+
这节介绍TypeScript里的类型推论。即,类型是在哪里如何被推断的。
2390
2390
2391
2391
### <a name="10.1"></a>基础
2392
2392
2393
-
TypeScript里,在有此没有明确指出类型的地方,类型推断会帮助提供类型。如下面的例子
2393
+
TypeScript里,在有此没有明确指出类型的地方,类型推论会帮助提供类型。如下面的例子
2394
2394
2395
2395
```typescript
2396
2396
var x =3;
2397
2397
```
2398
2398
2399
2399
变量x的类型被推断为数字。这种推断发生在初始化变量和成员,设置默认参数值和决定函数返回值时。
2400
2400
2401
-
大多数情况下,类型推断是直截了当地。后面的小节,我们会浏览类型推断时的细微差别。
2401
+
大多数情况下,类型推论是直截了当地。后面的小节,我们会浏览类型推论时的细微差别。
2402
2402
2403
2403
### <a name="10.2"></a>最佳通用类型
2404
2404
@@ -2422,11 +2422,11 @@ var zoo = [new Rhino(), new Elephant(), new Snake()];
2422
2422
var zoo: Animal[] = [newRhino(), newElephant(), newSnake()];
0 commit comments