Skip to content

Commit d5dfce4

Browse files
hanyujie2002awxiaoxian2020zhongsp
authored
translate release notes (#64)
* Revert "Revert "translate release notes (#61)" (#63)" This reverts commit 724002b. * revert --------- Co-authored-by: Xavi Lee <[email protected]> Co-authored-by: Patrick Zhong <[email protected]>
1 parent 724002b commit d5dfce4

39 files changed

+7191
-7474
lines changed

docs/documentation/zh/release-notes/TypeScript 1.1.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ permalink: /zh/docs/handbook/release-notes/typescript-1-1.html
55
oneline: TypeScript 1.1 Release Notes
66
---
77

8-
## Performance Improvements
8+
## 改进性能
99

10-
The 1.1 compiler is typically around 4x faster than any previous release. See [this blog post for some impressive charts.](https://web.archive.org/web/20141007020020/http://blogs.msdn.com/b/typescript/archive/2014/10/06/announcing-typescript-1-1-ctp.aspx)
10+
1.1版本的编译器速度比所有之前发布的版本快4倍。阅读[这篇博客里的有关图表](http://blogs.msdn.com/b/typescript/archive/2014/10/06/announcing-typescript-1-1-ctp.aspx)
1111

12-
## Better Module Visibility Rules
12+
## 更好的模块可见性规则
1313

14-
TypeScript now only strictly enforces the visibility of types in modules if the [`declaration`](/tsconfig#declaration) flag is provided. This is very useful for Angular scenarios, for example:
14+
TypeScript现在只在使用`--declaration`标记时才严格强制模块里类型的可见性。这在Angular里很有用,例如:
1515

1616
```ts
1717
module MyControllers {
@@ -21,8 +21,8 @@ module MyControllers {
2121
export class ZooController {
2222
// Used to be an error (cannot expose ZooScope), but now is only
2323
// an error when trying to generate .d.ts files
24-
constructor(public $scope: ZooScope) {}
24+
constructor(public $scope: ZooScope) { }
2525
/* more code */
2626
}
2727
}
28-
```
28+
```

docs/documentation/zh/release-notes/TypeScript 1.3.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,50 @@ permalink: /zh/docs/handbook/release-notes/typescript-1-3.html
55
oneline: TypeScript 1.3 Release Notes
66
---
77

8-
## Protected
8+
## 受保护的
99

10-
The new `protected` modifier in classes works like it does in familiar languages like C++, C#, and Java. A `protected` member of a class is visible only inside subclasses of the class in which it is declared:
10+
类里面新的`protected`修饰符作用与其它语言如C++,C\#和Java中的一样。一个类的`protected`成员只在这个类的子类中可见:
1111

1212
```ts
1313
class Thing {
14-
protected doSomething() {
15-
/* ... */
16-
}
14+
protected doSomething() { /* ... */ }
1715
}
1816

1917
class MyThing extends Thing {
2018
public myMethod() {
21-
// OK, can access protected member from subclass
19+
// OK,可以在子类里访问受保护的成员
2220
this.doSomething();
2321
}
2422
}
2523
var t = new MyThing();
26-
t.doSomething(); // Error, cannot call protected member from outside class
24+
t.doSomething(); // Error,不能在类外部访问受保护成员
2725
```
2826

29-
## Tuple types
27+
## 元组类型
3028

31-
Tuple types express an array where the type of certain elements is known, but need not be the same. For example, you may want to represent an array with a `string` at position 0 and a `number` at position 1:
29+
元组类型表示一个数组,其中元素的类型都是已知的,但是不一样是同样的类型。比如,你可能想要表示一个第一个元素是`string`类型第二个元素是`number`类型的数组:
3230

3331
```ts
3432
// Declare a tuple type
3533
var x: [string, number];
36-
// Initialize it
37-
x = ["hello", 10]; // OK
38-
// Initialize it incorrectly
39-
x = [10, "hello"]; // Error
34+
// 初始化
35+
x = ['hello', 10]; // OK
36+
// 错误的初始化
37+
x = [10, 'hello']; // Error
4038
```
4139

42-
When accessing an element with a known index, the correct type is retrieved:
40+
但是访问一个已知的索引,会得到正确的类型:
4341

4442
```ts
4543
console.log(x[0].substr(1)); // OK
46-
console.log(x[1].substr(1)); // Error, 'number' does not have 'substr'
44+
console.log(x[1].substr(1)); // Error, 'number'没有'substr'方法
4745
```
4846

49-
Note that in TypeScript 1.4, when accessing an element outside the set of known indices, a union type is used instead:
47+
注意在TypeScript1.4里,当访问超出已知索引的元素时,会返回联合类型:
5048

5149
```ts
52-
x[3] = "world"; // OK
53-
console.log(x[5].toString()); // OK, 'string' and 'number' both have toString
54-
x[6] = true; // Error, boolean isn't number or string
50+
x[3] = 'world'; // OK
51+
console.log(x[5].toString()); // OK, 'string''number'都有toString
52+
x[6] = true; // Error, boolean不是number或string
5553
```
54+

0 commit comments

Comments
 (0)