Skip to content

Commit

Permalink
fix(utils): MaybeMockedConstructor returns T (#1976)
Browse files Browse the repository at this point in the history
At this point, `MaybeMockedConstructor` can return an empty object, causing the source type to be lost. This PR fixes this.
  • Loading branch information
KostyaTretyak committed Sep 21, 2020
1 parent 3080302 commit b7712b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/testing.ts
Expand Up @@ -11,7 +11,7 @@ interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<Ret

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

0 comments on commit b7712b2

Please sign in to comment.