mirror of
https://github.com/gibbok/typescript-book
synced 2024-11-16 19:47:27 +01:00
Add more information on declare
keyword (#117)
* add defition for declare * update books * update website
This commit is contained in:
parent
ac90c7f27a
commit
edd5b68688
8 changed files with 8 additions and 0 deletions
|
@ -1140,6 +1140,8 @@ npm install --save-dev @types/library-name
|
|||
|
||||
即使在 JavaScript 文件中,您也可以通过 `// @ts-check` 使用环境声明。
|
||||
|
||||
`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。
|
||||
|
||||
### 属性检测和多余属性检测
|
||||
|
||||
TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。
|
||||
|
|
|
@ -1145,6 +1145,8 @@ For your defined Ambient Declarations, you can import using the "triple-slash" r
|
|||
|
||||
You can use Ambient Declarations even within JavaScript files using `// @ts-check`.
|
||||
|
||||
The `declare` keyword enables type definitions for existing JavaScript code without importing it, serving as a placeholder for types from another file or globally.
|
||||
|
||||
### Property Checking and Excess Property Checking
|
||||
|
||||
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.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -503,6 +503,8 @@ For your defined Ambient Declarations, you can import using the "triple-slash" r
|
|||
|
||||
You can use Ambient Declarations even within JavaScript files using `// @ts-check`.
|
||||
|
||||
The `declare` keyword enables type definitions for existing JavaScript code without importing it, serving as a placeholder for types from another file or globally.
|
||||
|
||||
### Property Checking and Excess Property Checking
|
||||
|
||||
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.
|
||||
|
|
|
@ -506,6 +506,8 @@ npm install --save-dev @types/library-name
|
|||
|
||||
即使在 JavaScript 文件中,您也可以通过 `// @ts-check` 使用环境声明。
|
||||
|
||||
`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。
|
||||
|
||||
### 属性检测和多余属性检测
|
||||
|
||||
TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。
|
||||
|
|
Loading…
Reference in a new issue