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

Vitest TypeScript support for InverseAsymmetricMatchers #548

Closed
rluvaton opened this issue Jan 2, 2023 · 6 comments · Fixed by #549
Closed

Vitest TypeScript support for InverseAsymmetricMatchers #548

rluvaton opened this issue Jan 2, 2023 · 6 comments · Fixed by #549

Comments

@rluvaton
Copy link
Contributor

rluvaton commented Jan 2, 2023

  • package version: 3.2.1
  • node version: 18.12.1
  • npm (or yarn) version: 8.19.2

What happened (please provide anything you think will help):

Typescript fail in this

test('InverseAsymmetricMatchers', () => {
	expect({
		data: [1, 2]
	}).toEqual({

		// I get here:
		// Property 'toIncludeSameMembers' does not exist on type 'ExpectStatic'
		data: expect.toIncludeSameMembers([2, 1])
	})
});

the type failed:

Property 'toIncludeSameMembers' does not exist on type 'ExpectStatic'

Reproduction repository (if possible):
https://github.com/rluvaton/jest-extended-bug-548

just run:

npm install
npm start
@SimenB
Copy link
Member

SimenB commented Jan 3, 2023

Happy to take a PR fixing this

@rluvaton
Copy link
Contributor Author

rluvaton commented Jan 3, 2023

I can try but one thing that can help me is how the types for the regular matchers works with vitest in the first place, the types literally have jest in it:

declare namespace jest {

I would expect something related to the expect package...

Great work BTW on all the jest stuff!

@SimenB
Copy link
Member

SimenB commented Jan 4, 2023

Yeah, the types shipped with Jest itself uses expect (https://jestjs.io/docs/expect#expectextendmatchers), but this package enhances types from @types/jest.


How it works with vitest I have no idea - I've never used it.

@rluvaton
Copy link
Contributor Author

rluvaton commented Jan 5, 2023

created a PR #549

@SimenB
Copy link
Member

SimenB commented Jan 6, 2023

@rluvaton
Copy link
Contributor Author

rluvaton commented Jan 6, 2023

Happy to contribute to open source, hope to see you again

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

Successfully merging a pull request may close this issue.

2 participants