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

Type 'ExpectStatic' has no call signatures #5670

Closed
6 tasks done
aryzing opened this issue May 5, 2024 · 6 comments
Closed
6 tasks done

Type 'ExpectStatic' has no call signatures #5670

aryzing opened this issue May 5, 2024 · 6 comments

Comments

@aryzing
Copy link

aryzing commented May 5, 2024

Describe the bug

Tests using the global expect function have the following type error,

This expression is not callable.
  Type 'ExpectStatic' has no call signatures. ts(2349)

Reproduction

Install latest version of vitest and write a test containing a call to expect().

See repro repo.

System Info

System:
    OS: Linux 6.5
    CPU: (8) x64 AMD
    Memory: 15 GB / 16 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v18.19.1/bin/npm
    bun: 1.1.5 - ~/.bun/bin/bun
  npmPackages:
    vite: 5.2.11 => 5.2.11 
    vitest: 1.6.0 => 1.6.0

Used Package Manager

bun

^ please add bun to this section of the issue template, I had to manually edit it.

Validations

Copy link

github-actions bot commented May 5, 2024

Hello @aryzing. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@aryzing
Copy link
Author

aryzing commented May 5, 2024

Inside the vitest dist folder there's a reporters-yx5ZTtEV.d.ts file overriding the @vitest/expect module on line 2834,

declare module '@vitest/expect' {
    interface MatcherState {
        environment: VitestEnvironment;
        snapshotState: SnapshotState;
    }
    interface ExpectStatic {
        addSnapshotSerializer: (plugin: Plugin_2) => void;
    }

Other files inside dist don't have a hash/id in their name, so this one stands out -- is it meant to be there?

@sheremet-va
Copy link
Member

Other files inside dist don't have a hash/id in their name, so this one stands out -- is it meant to be there?

Yes.

@aryzing
Copy link
Author

aryzing commented May 5, 2024

Added a repro, thanks

@sheremet-va
Copy link
Member

I don' see any type errors in your reproduction. Try reinstalling your dependencies.

@aryzing
Copy link
Author

aryzing commented May 7, 2024

Reinstalling only worked after clearing bun's cache, bun pm cache rm. Thanks for the suggestion!

@aryzing aryzing closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants