vitest icon indicating copy to clipboard operation
vitest copied to clipboard

docs: global type recommendation

Open privatenumber opened this issue 1 year ago • 1 comments

Description

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [ ] ~It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.~ Sorry, no prior Issue.
  • [x] Ideally, include a test that fails without this PR but passes with it.
  • [x] Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • [x] Run the tests with pnpm test:ci.

Documentation

  • [x] If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • [x] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Problem

Currently, users are encouraged to use the types property in tsconfig.json, which disables type auto detection.

This can be dangerous as if their project relies on it, it will no longer auto import types and break it. And even if not, it sets a precedent for users to manually manage types from packages that would otherwise be auto imported.

Changes

Recommend importing vitest/globals from a TS file

privatenumber avatar Oct 10 '24 03:10 privatenumber

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
Latest commit 67dce54720f729e54452400aec75bbca68c95fe3
Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/67077882ce54780008dca6dc
Deploy Preview https://deploy-preview-6676--vitest-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Oct 10 '24 04:10 netlify[bot]

We are going to align with Vite here: https://github.com/vitejs/vite/pull/20132 (so, keep what we have already)

TypeScript also plans to set types to [] by default, so it seems like TS team is moving into that direction: https://github.com/microsoft/TypeScript/issues/62195

sheremet-va avatar Sep 05 '25 05:09 sheremet-va