Skip to content

During type checking, the type files in vitest and vite cannot find the type they use #4921

@yingpengsha

Description

@yingpengsha

Describe the bug

My type checking use case passed without a hitch, but there was a problem with the type inside the library itself

⎯⎯⎯⎯⎯⎯ Typecheck Error ⎯⎯⎯⎯⎯⎯⎯
Error: Error: node_modules/.pnpm/@vitest+utils@1.1.3/node_modules/@vitest/utils/dist/error.d.ts(4,58): error TS2304: Cannot find name 'WeakKey'.
Error: node_modules/.pnpm/@vitest+utils@1.1.3/node_modules/@vitest/utils/dist/error.d.ts(6,96): error TS2304: Cannot find name 'WeakKey'.
Error: node_modules/.pnpm/@vitest+utils@1.1.3/node_modules/@vitest/utils/dist/error.d.ts(6,133): error TS2304: Cannot find name 'WeakKey'.
Error: node_modules/.pnpm/vite@5.0.11_@types+node@20.10.6/node_modules/vite/dist/node/index.d.ts(6,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations

Reproduction

System Info

> This is my local environment configuration, of course, can also reproduce the previous problem

  System:
    OS: macOS 13.4
    CPU: (12) arm64 Apple M2 Pro
    Memory: 122.00 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.1 - ~/.nvm/versions/node/v16.20.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.1/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.1/bin/npm
    pnpm: 7.33.6 - ~/.nvm/versions/node/v16.20.1/bin/pnpm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 120.0.6099.199
    Edge: 120.0.2210.121
    Safari: 16.5

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions