Skip to content

CustomMatchers #43

@jwayr

Description

@jwayr

Hi there,

I'm using vitest with typescript and somehow the custom matchers toHaveReceivedMessages and toReceiveMessage cannot be resolved correctly: Property 'toReceiveMessage' does not exist on type 'Assertion'.ts(2339)

If I replace 'vitest' by '@vitest/expect' in the module declaration (src/extend-expect.ts), everything works as expected and the types can be resolved.

declare module '@vitest/expect' {
  // eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any
  interface Assertion<T = any> extends CustomMatchers<T> {}
...

If that makes any sense, I'm happy to provide a PR :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions