Skip to content

Commit edd5b68

Browse files
authored
Add more information on declare keyword (#117)
* add defition for declare * update books * update website
1 parent ac90c7f commit edd5b68

8 files changed

+8
-0
lines changed

README-zh_CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,8 @@ npm install --save-dev @types/library-name
11401140

11411141
即使在 JavaScript 文件中,您也可以通过 `// @ts-check` 使用环境声明。
11421142

1143+
`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。
1144+
11431145
### 属性检测和多余属性检测
11441146

11451147
TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,8 @@ For your defined Ambient Declarations, you can import using the "triple-slash" r
11451145

11461146
You can use Ambient Declarations even within JavaScript files using `// @ts-check`.
11471147

1148+
The `declare` keyword enables type definitions for existing JavaScript code without importing it, serving as a placeholder for types from another file or globally.
1149+
11481150
### Property Checking and Excess Property Checking
11491151

11501152
TypeScript is based on a structural type system but excess property checking is a property of TypeScript which allows it to check whether an object has the exact properties specified in the type.

downloads/typescript-book-zh_CN.epub

65 Bytes
Binary file not shown.

downloads/typescript-book-zh_CN.pdf

332 Bytes
Binary file not shown.

downloads/typescript-book.epub

67 Bytes
Binary file not shown.

downloads/typescript-book.pdf

-361 Bytes
Binary file not shown.

website/src/content/docs/book/exploring-the-type-system.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ For your defined Ambient Declarations, you can import using the "triple-slash" r
503503

504504
You can use Ambient Declarations even within JavaScript files using `// @ts-check`.
505505

506+
The `declare` keyword enables type definitions for existing JavaScript code without importing it, serving as a placeholder for types from another file or globally.
507+
506508
### Property Checking and Excess Property Checking
507509

508510
TypeScript is based on a structural type system but excess property checking is a property of TypeScript which allows it to check whether an object has the exact properties specified in the type.

website/src/content/docs/zh-cn/book/exploring-the-type-system.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ npm install --save-dev @types/library-name
506506

507507
即使在 JavaScript 文件中,您也可以通过 `// @ts-check` 使用环境声明。
508508

509+
`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。
510+
509511
### 属性检测和多余属性检测
510512

511513
TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。

0 commit comments

Comments
 (0)