Skip to content
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
10 changes: 10 additions & 0 deletions website/docs/en/api/runtime-api/test-api/expect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,13 @@ expect.extend({

expect(10).toBeDivisibleBy(2);
```

If you want to add TypeScript typings for your custom matchers, you can extend the `Assertion` interface in the `@rstest/core` module:

```ts
declare module '@rstest/core' {
interface Assertion<T> {
toBeDivisibleBy(argument: number): void;
}
}
```
10 changes: 10 additions & 0 deletions website/docs/zh/api/runtime-api/test-api/expect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,13 @@ expect.extend({

expect(10).toBeDivisibleBy(2);
```

如果你想为自定义匹配器添加 TypeScript 类型定义,可以扩展 `@rstest/core` 模块中的 `Assertion` 接口声明:

```ts
declare module '@rstest/core' {
interface Assertion<T> {
toBeDivisibleBy(argument: number): void;
}
}
```
Loading