Skip to content

Add more information on declare keyword #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,8 @@ npm install --save-dev @types/library-name

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

`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。

### 属性检测和多余属性检测

TypeScript 基于结构类型系统,但过多的属性检查是 TypeScript 的一个属性,它允许它检查对象是否具有类型中指定的确切属性。
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file modified downloads/typescript-book-zh_CN.epub
Binary file not shown.
Binary file modified downloads/typescript-book-zh_CN.pdf
Binary file not shown.
Binary file modified downloads/typescript-book.epub
Binary file not shown.
Binary file modified downloads/typescript-book.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions website/src/content/docs/book/exploring-the-type-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ npm install --save-dev @types/library-name

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

`declare` 关键字可以为现有的 JavaScript 代码启用类型定义,而无需导入它,作为来自另一个文件或全局的类型的占位符。

### 属性检测和多余属性检测

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