Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a08fcf

Browse files
committed
更新到新版 gitbook
1 parent 89f3d36 commit 1a08fcf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

basics/declaration-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ npm install @types/jquery --save-dev
119119
- `declare namespace` 声明(含有子属性的)全局对象
120120
- `interface``type` 声明全局类型
121121

122-
##### `declare var`
122+
#### `declare var`
123123

124124
在所有的声明语句中,`declare var` 是最简单的,如之前所学,它能够用来定义一个全局变量的类型。与其类似的,还有 `declare let``declare const`,使用 `let` 与使用 `var` 没有什么区别,而使用 `const` 定义时,表示此时的全局变量是一个常量,不允许再去修改它的值了[<sup>4</sup>](https://github.com/xcatliu/typescript-tutorial/tree/master/examples/declaration-files/04-declare-const-jquery)
125125

@@ -146,7 +146,7 @@ jQuery = function(selector) {
146146

147147
一般来说,全局变量都是禁止修改的常量,所以大部分情况都应该使用 `const` 而不是 `var``let`
148148

149-
需要注意的是,声明语句中只能定义类型,切勿在声明语句中定义具体的值[<sup>5</sup>](https://github.com/xcatliu/typescript-tutorial/tree/master/examples/declaration-files/05-declare-jquery-value)
149+
需要注意的是,声明语句中只能定义类型,切勿在声明语句中定义具体的实现[<sup>5</sup>](https://github.com/xcatliu/typescript-tutorial/tree/master/examples/declaration-files/05-declare-jquery-value)
150150

151151
```ts
152152
declare const jQuery = function(selector) {
@@ -191,7 +191,7 @@ declare class Animal {
191191
let cat = new Animal('Tom');
192192
```
193193

194-
同样的,`declare class` 语句也只能用来定义类型,不能用来定义具体的值,比如定义 `sayHi` 方法的具体实现则会报错:
194+
同样的,`declare class` 语句也只能用来定义类型,不能用来定义具体的实现,比如定义 `sayHi` 方法的具体实现则会报错:
195195

196196
```ts
197197
declare class Animal {

0 commit comments

Comments
 (0)