Skip to content

Compile error in vitest typescript project #729

Description

@NicoleRauch
  • @testing-library/jest-dom version: 6.6.3
  • node version: 22.4.1
  • jest (or vitest) version: vitest 4.1.6
  • npm (or yarn) version: npm 10.8.1

Relevant code or config:

tsconfig.json

    "types": ["node", "vitest/globals", "@testing-library/jest-dom"]

What you did:

When running tsc --noemit

What happened:

Image

Reproduction:

Create a file with just the line

import "@testing-library/jest-dom";

and compile it with npx tsc --noemit [filename].

Problem description:

jest-dom references jest types in the type definitions, but I am not using jest, so I don't have these types.
Adding them gives different errors because they conflict with the vitest types.

Suggested solution:

When I remove the line in question from jest.d.ts, it compiles.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions