Skip to content

Commit 5763655

Browse files
committed
more cleanup
1 parent e4df47e commit 5763655

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
dist/
23
.yarn/*
34
!.yarn/patches
45
!.yarn/plugins

src/jest/index.d.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/jest/index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
import { expect } from "@jest/globals";
22
import { toRerender, toRenderExactlyTimes } from "./ProfiledComponent.js";
3+
import type {
4+
NextRenderOptions,
5+
Profiler,
6+
ProfiledComponent,
7+
ProfiledHook,
8+
} from "../profile/index.js";
39

410
expect.extend({
511
toRerender,
612
toRenderExactlyTimes,
713
});
14+
interface ApolloCustomMatchers<R = void, T = {}> {
15+
toRerender: T extends
16+
| Profiler<any>
17+
| ProfiledComponent<any, any>
18+
| ProfiledHook<any, any>
19+
? (options?: NextRenderOptions) => Promise<R>
20+
: { error: "matcher needs to be called on a ProfiledComponent instance" };
21+
22+
toRenderExactlyTimes: T extends
23+
| Profiler<any>
24+
| ProfiledComponent<any, any>
25+
| ProfiledHook<any, any>
26+
? (count: number, options?: NextRenderOptions) => Promise<R>
27+
: { error: "matcher needs to be called on a ProfiledComponent instance" };
28+
}
29+
30+
declare global {
31+
namespace jest {
32+
interface Matchers<R = void, T = {}> extends ApolloCustomMatchers<R, T> {}
33+
}
34+
}

0 commit comments

Comments
 (0)