Skip to content
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

i18n(zh-cn): Update integrations-reference.mdx #9396

Merged
merged 2 commits into from
Sep 14, 2024
Merged
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
12 changes: 12 additions & 0 deletions src/content/docs/zh-cn/reference/integrations-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,18 @@ declare global {

Astro 为未来的内置钩子保留了 `astro:` 前缀。请在命名时,为自定义钩子选择不同的前缀。

### `HookParameters`

你可以通过将钩子的名称传递给 `HookParameters` 实用工具类型来获取钩子参数的类型。在以下示例中,输入了函数的 `options` 参数后,匹配到了 `astro:config:setup` 挂钩的参数:

```ts /HookParameters(?:<.+>)?/
import type { HookParameters } from 'astro';

function mySetup(options: HookParameters<'astro:config:setup'>) {
options.updateConfig({ /* ... */ });
}
```

## 使用 `astro add` 安装

用户可以使用 [`astro add` 命令](/zh-cn/reference/cli-reference/#astro-add) 轻松地在他们的项目中添加集成和适配器。如果你想让别人可以使用这个工具安装你的集成,**在你的 `package.json` 中的 `keywords` 字段中添加 `astro-integration`**:
Expand Down
Loading