Open amw opened 6 months ago
Some type declarations are importing types from vite
. There's /// <reference types="node" />
in vite/dist/node/index.d.ts
.
Some type declarations are importing types from
vite
. There's/// <reference types="node" />
invite/dist/node/index.d.ts
.
Yep, and there should be no import of vite
in importMeta
or vitest
Describe the bug
Projects for web applications need to be careful not to include Node types that could overshadow web browser APIs. For example
setTimeout
in browser types returnsnumber
while in Node it returnsTimeout
which causes errors like:I was able to use Vitest to test my web library, because
*.test.ts
files were excluded from mytsconfig.json
, but I am not able to useimport.meta.vitest
for inline tests asvitest/importMeta
causes the Node types to be added to my project.Below is link to minimal reproduction, but here's also a screenshot:
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-joykgq?file=src%2Fbasic.ts&view=editor
System Info
Used Package Manager
npm
Validations