Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required to use calledWith when using TypeScript #114

Open
dan2kx opened this issue Mar 29, 2023 · 2 comments
Open

Required to use calledWith when using TypeScript #114

dan2kx opened this issue Mar 29, 2023 · 2 comments

Comments

@dan2kx
Copy link

dan2kx commented Mar 29, 2023

When using typescript i am required to use calledWith on a deep mocked function instead of not providing this, or i have to ts-ignore it, if there is no way to avoid this, can calledWIth be called without passing a matcher as the default if i want to mock in all cases?

Works:

// @ts-ignore
prismaMock.model.create.mockResolvedValue()

Should work without ts-ignore?

prismaMock.model.create.mockResolvedValue()

Or

prismaMock.model.create.calledWith().mockResolvedValue()

instead of

prismaMock.model.create.calledWith(any()).mockResolvedValue()
@dan2kx
Copy link
Author

dan2kx commented Mar 29, 2023

it seems this problem goes away when adding the @types/jest@27.5.0 so i think issue #115 is the problem here, i think maybe the types need to be updated for the package

@theMogget
Copy link

it seems this problem goes away when adding the @types/jest@27.5.0 so i think issue #115 is the problem here, i think maybe the types need to be updated for the package

This worked for me, thank you so much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants