Node types are pulled accidentally by importing vite types
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 564
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
See the same issue in different package https://github.com/Anber/wyw-in-js/issues/33
I was investigating why node types are included in my project and came to cause being .wxt/types/imports.d.ts file, which imports for example:
const ContentScriptContext: typeof import('wxt/client')['ContentScriptContext']
And that file uses:
import { ContentScriptDefinition } from '../../types'
Which in turn imports:
import type * as vite from 'vite';
If we look at vite, it uses <reference types="node" /> which means any file importing it also gets the same types.
The fix would be split vite types from client ones, so two are not mixed.
Reproduction
n/a
Steps to reproduce
Try using const timeout: number = setTimeout(() => {})
System Info
"wxt": "^0.19.27"
Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with .wxt/types/imports.d.ts, follow its import of ../../types, and inspect the ContentScriptDefinition declaration and its import type * as vite from 'vite'. Separate the Vite-related types from client types so consuming the generated imports does not pull in Node types; verify that the timeout example no longer receives Node-specific typing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100