The documentation says:
Supports automatic of jest.mock() calls
However, when it is used, the auto-mocked class' type signature isn't updated with the jest mock extensions, which results in errors like:
error TS2339: Property 'mockClear' does not exist on type 'typeof TokenRepository'.
The only "simple" work around I've found is to typecast the mocked class as a jest.Mock like:
(TokenRepository as jest.Mock<TokenRepository>).mockClear();
Ideally provide some way to update the type definitions of auto-mocked classes.
If that's not possible, then at least update the documentation to call out this limitation and provide samples of how to work around it.
The documentation says:
However, when it is used, the auto-mocked class' type signature isn't updated with the jest mock extensions, which results in errors like:
The only "simple" work around I've found is to typecast the mocked class as a jest.Mock like:
Ideally provide some way to update the type definitions of auto-mocked classes.
If that's not possible, then at least update the documentation to call out this limitation and provide samples of how to work around it.