Cannot import from a type-only package #6791
-
Describe the bugI have a type-only package. We are importing from it and building successfully. ReproductionHere is a small reproduction using https://stackblitz.com/edit/vitest-dev-vitest-tcivys?file=test%2Fbasic.test.ts System InfoSystem:
OS: Windows 11 10.0.22631
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
Memory: 10.15 GB / 31.67 GB
Binaries:
Node: 18.20.2 - C:\Program Files\nodejs\node.EXE
npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.12.1 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.22621.3527
npmPackages:
@vitest/coverage-istanbul: 2.1.2
vitest: 2.1.2 Used Package Managerpnpm Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure the intent but probably it shouldn't be necessary to import Btw, node also throws for |
Beta Was this translation helpful? Give feedback.
I'm not sure the intent but probably it shouldn't be necessary to import
@types/...
package. Either usingcompilerOptions.types
in tsconfig or tsc should already pick that typing automatically.Btw, node also throws for
import '@types/base64-js'
and it's not a Vitest issue. This is more like a typescript question, so probably it's better to be asked elsewhere.