question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`toHaveBeenCalledBefore` and `toHaveBeenCalledAfter` typings require a second argument that's actually optional

See original GitHub issue

This was introduced in v3.

See:

https://github.com/jest-community/jest-extended/blob/4933338668adf30123d7a12a30da4a498f6a9c88/types/index.d.ts#L159-L167

I get error TS2554: Expected 2 arguments, but got 1. in my existing code now.

Would you accept a PR to make the second argument optional in index.d.ts? I was going to create the PR preemptively but I noticed the JSDoc defined the second arg with a default value, so I wasn’t sure if it was actually a build issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
keeganwittcommented, Jul 13, 2022

And I just looked at the PRs and not the issues 😆

Read more comments on GitHub >

github_iconTop Results From Across the Web

[@types/jasmine] Jasmine toHaveBeenCalledWith ... - GitHub
[@types/jasmine] Jasmine toHaveBeenCalledWith matcher treats optional method arguments as required under some conditions #43989.
Read more >
How to use "toHaveBeenCalledAfter" with a function that has ...
I have a function: funtion foo() { Spinner.setVisible(true); await ApiService.doApiCall(); Spinner.setVisible(false); }.
Read more >
Jest-extended: Additional Jest Matchers - Morioh
Use .toHaveBeenCalledAfter when checking if a Mock was called after another Mock . it('calls mock1 after mock2', () => { const mock1 =...
Read more >
Jest assert over single or specific argument/parameters with ...
With Jest it's possible to assert of single or specific arguments/parameters of a mock function call with .toHaveBeenCalled /
Read more >
Expect - Jest
When you're writing tests, you often need to check that values meet certain ... The argument to expect should be the value that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found