Jest mock types
For working with Jest in TS environments.
Main one is jest.Mock<T>
, which is the generic type of any mock function (one from jest.fn()
).
Then there's jest.Mocked<Source>
which is for anything that has been jest.mock()
ed.
ts
// typeof jest.Mock<any, any>
const mockSomeFunction = jest.fn();