Skip to content

Commit b7712b2

Browse files
fix(utils): MaybeMockedConstructor returns T (#1976)
At this point, `MaybeMockedConstructor` can return an empty object, causing the source type to be lost. This PR fixes this.
1 parent 3080302 commit b7712b2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils/testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<Ret
1111

1212
type MaybeMockedConstructor<T> = T extends new (...args: any[]) => infer R
1313
? jest.MockInstance<R, ConstructorArgumentsOf<T>>
14-
: {} // eslint-disable-line @typescript-eslint/ban-types
14+
: T
1515
type MockedFunction<T extends MockableFunction> = MockWithArgs<T> & { [K in keyof T]: T[K] }
1616
type MockedFunctionDeep<T extends MockableFunction> = MockWithArgs<T> & MockedObjectDeep<T>
1717
type MockedObject<T> = MaybeMockedConstructor<T> &

0 commit comments

Comments
 (0)