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

expect.toIncludeSameMembers output is not an array #486

Open
AudunWA opened this issue Aug 8, 2022 · 0 comments
Open

expect.toIncludeSameMembers output is not an array #486

AudunWA opened this issue Aug 8, 2022 · 0 comments

Comments

@AudunWA
Copy link

AudunWA commented Aug 8, 2022

Bug

  • package version: 3.0.2
  • node version: v16.13.0
  • npm (or yarn) version: npm 8.5.0

Relevant code or config

type WithArray = {
    strings: string[];
};
it("example", () => {
    expect({}).toEqual(
        expect.objectContaining<WithArray>({
            strings: expect.toIncludeSameMembers(["foo", "bar"]),
        })
    );
});

What you did:
I have tests where I use the type parameter of objectContaining, which previously worked fine when the object contained toIncludeSameMembers on properties.

What happened (please provide anything you think will help):
Now, as the output type of toIncludeSameMembers was changed from any to Result (see #477), the following TypeScript error is shown:
TS2740: Type 'Result' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more.

Reproduction repository (if possible):
Copy the test case shown above and attempt to compile with TypeScript.

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

1 participant