Skip to content

Commit b7712b2

Browse files
authoredSep 21, 2020
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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/utils/testing.ts

+1-1
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)
Please sign in to comment.