Skip to content

Commit 888ce47

Browse files
committed
NPM: Use exact version. PR833
1 parent c25ca41 commit 888ce47

3 files changed

Lines changed: 23 additions & 18 deletions

File tree

doc/breaking-changes/TypeScript 1.8.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export { localPromise as Promise };
3232
TypeScript 1.8里,我们添加了一些[可达性检查](https://github.com/Microsoft/TypeScript/pull/4788)来阻止一些种类的错误。特别是:
3333

3434
1. 检查代码的可达性(默认启用,可以通过`allowUnreachableCode`编译器选项禁用)
35+
3536
```ts
3637
function test1() {
3738
return 1;
@@ -48,14 +49,17 @@ TypeScript 1.8里,我们添加了一些[可达性检查](https://github.com/Mi
4849
var y = 1; // error here
4950
}
5051
```
52+
5153
2. 检查标签是否被使用(默认启用,可以通过`allowUnusedLabels`编译器选项禁用)
54+
5255
```ts
5356
l: // error will be reported - label `l` is unused
5457
while (true) {
5558
}
5659

5760
(x) => { x:x } // error will be reported - label `x` is unused
5861
```
62+
5963
3. 检查是否函数里所有带有返回值类型注解的代码路径都返回了值(默认启用,可以通过`noImplicitReturns`编译器选项禁用)
6064

6165
```ts
@@ -64,6 +68,7 @@ TypeScript 1.8里,我们添加了一些[可达性检查](https://github.com/Mi
6468
if (x) return 10;
6569
}
6670
```
71+
6772
4. 检查控制流是否能进到switch语句的case里(默认禁用,可以通过`noFallthroughCasesInSwitch`编译器选项启用)。注意没有语句的case不会被检查。
6873

6974
```ts

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"homepage": "https://github.com/zhongsp/TypeScript",
2828
"devDependencies": {
29-
"glob": "^7.1.3",
30-
"markdownlint": "^0.3.1"
29+
"glob": "7.1.3",
30+
"markdownlint": "0.11.0"
3131
}
3232
}

0 commit comments

Comments
 (0)