Skip to content

Documentation: fix linter errors with TypeScript declarations in Vitest setup instructions#696

Merged
keeganwitt merged 1 commit intojest-community:mainfrom
MaddyGuthridge:patch-1
May 4, 2025
Merged

Documentation: fix linter errors with TypeScript declarations in Vitest setup instructions#696
keeganwitt merged 1 commit intojest-community:mainfrom
MaddyGuthridge:patch-1

Conversation

@MaddyGuthridge
Copy link
Contributor

ESLint (with the typescript-eslint plugin) gives a no-undef error without the <T = any> constraint in the type definitions. This PR adds the constraint to help prevent people from getting linting errors from the configuration. TypeScript doesn't seem to be fussed either way, but this should save people a minor annoyance.

What

Add type variable to TypeScript + Vitest setup instructions in the documentation.

Why

Prevent minor annoyances when linting fails for people who use the definitions.

@changeset-bot
Copy link

changeset-bot bot commented Aug 2, 2024

⚠️ No Changeset found

Latest commit: cfab6a0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented May 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (2483bcc) to head (cfab6a0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #696   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           75        75           
  Lines          829       829           
  Branches       258       258           
=========================================
  Hits           829       829           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@keeganwitt
Copy link
Collaborator

I don't have any Vitest experience. Is this still correct? I couldn't find any examples of folks doing it this way (https://github.com/search?q=%22extends+CustomMatchers%3CT+%3D+any%22&type=code).

@MaddyGuthridge
Copy link
Contributor Author

MaddyGuthridge commented May 4, 2025

@keeganwitt that's how I'm doing it in my projects. Without the <T = any>, the linter yells at me.

The reason the search turns up no results is because you've got a typo in your search query. You're hunting for extends CustomMatchers<T = any> when you should be searching for ExpectStatic<T = any> extends CustomMatchers<T>. With the corrected query, you get plenty of results :P

ESLint gives a `no-undef` error without the `<T = any>` constraint in the type definition. This PR adds the constraint to help prevent people from getting linting errors from the configuration.
@keeganwitt
Copy link
Collaborator

Thanks for the PR! And thanks for clarifying.

@keeganwitt keeganwitt merged commit b426037 into jest-community:main May 4, 2025
20 checks passed
@MaddyGuthridge MaddyGuthridge deleted the patch-1 branch May 4, 2025 13:45
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

Successfully merging this pull request may close these issues.

2 participants