Skip to content

Commit 24d47c9

Browse files
committed
fix(types): augument global jest
1 parent 85de2a2 commit 24d47c9

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

src/globals.d.ts

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

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const getAllSpies = () => {
3535
return spies;
3636
};
3737

38-
export class MockProp<T> implements MockProp<T> {
38+
export class MockProp<T> {
3939
private initialPropDescriptor: PropertyDescriptor;
4040
private initialPropValue: T;
4141
private object: Obj<T>;

src/types.d.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export type Obj<T> = Record<string, T>;
2-
32
// eslint-disable-next-line @typescript-eslint/no-explicit-any
43
export type Spyable = Obj<any>;
5-
64
// eslint-disable-next-line @typescript-eslint/no-explicit-any
75
export type ValueOf<O> = O extends Record<infer _, infer T> ? T : any;
86

@@ -19,3 +17,10 @@ export type SpyOnProp = (
1917
object: Spyable,
2018
propName: string,
2119
) => MockProp<ValueOf<typeof object>>;
20+
21+
declare global {
22+
namespace jest {
23+
const isMockProp: IsMockProp;
24+
const spyOnProp: SpyOnProp;
25+
}
26+
}

webpack.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const configuration: Configuration = {
4343
stageMessages: null,
4444
}),
4545
new CopyWebpackPlugin({
46-
patterns: ["types", "globals"].map((t) => ({
46+
patterns: ["types"].map((t) => ({
4747
from: `./src/${t}.d.ts`,
4848
to: outputPath,
4949
})),

0 commit comments

Comments
 (0)