Skip to content

Commit

Permalink
Use Mock in MockedFunction
Browse files Browse the repository at this point in the history
This change allows `MockedFunction` to be used where `Mock` can be used. I don't think this fundamentally changes `MockedFunction`, just makes it more robust. This would resolve issues where an extended expect method takes a `Mock` type, but the mocking library uses `MockedFunction`.

Related issues:
extend-chrome/jest-chrome#9
jest-community/jest-extended#292
  • Loading branch information
jacksteamdev committed Jan 19, 2021
1 parent 6346151 commit e2ad531
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion types/jest/index.d.ts
Expand Up @@ -1107,7 +1107,7 @@ declare namespace jest {
* const mockMyFunction = myFunction as jest.MockedFunction<typeof myFunction>;
* expect(mockMyFunction.mock.calls[0][0]).toBe(42);
*/
type MockedFunction<T extends (...args: any[]) => any> = MockInstance<ReturnType<T>, ArgsType<T>> & T;
type MockedFunction<T extends (...args: any[]) => any> = Mock<ReturnType<T>, ArgsType<T>> & T;

/**
* Wrap a class with mock definitions
Expand Down

0 comments on commit e2ad531

Please sign in to comment.