yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.23k stars 1.07k forks source link

[Bug?]: vite.config.ts 'test' entry typing are not working with Yarn PnP #6293

Open unrealsolver opened 1 month ago

unrealsolver commented 1 month ago

Self-service

Describe the bug

TS stops recognizing vite.config.ts test entry once PnP is enabled. https://github.com/unrealsolver/yarn-pnp-vitest-types/blob/main/apps/nxtest/vite.config.ts#L35 The only difference here is npm vs yarn pnp. No other lines of code has changed.

To reproduce

(NOTE this link is broken https://yarnpkg.com/advanced/sherlock)

  1. To observe: just check out this repo and open the vite.config.ts in editor, that supports LSP.

To replicate from scratch (optional):

  1. Create sampe TS project that uses vite (by using @nx/react, for example)
  2. corepack enable
  3. corepack prepare yarn@4 --activate
  4. yarn set version 4
  5. yarn dlx @yarnpkg/sdks vim
  6. yarn
  7. open an editor and go to vite.config.ts

Environment

System:
  OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
  CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Binaries:
  Node: 18.16.0 - /tmp/xfs-a293c1f8/node
  Yarn: 4.2.2 - /tmp/xfs-a293c1f8/yarn
  npm: 9.5.1 - ~/.local/share/nvm/v18.16.0/bin/npm

Additional context

Error:

apps/nxtest/vite.config.ts:35:3 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Object literal may only specify known properties, and 'test' does not exist in type 'UserConfigExport'