You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vite/client types result in type errors when used in sources where lib was declared to be webworker. It runs fine in vite but throws errors when validating via tsc.
The issue is that vite/client is referencing DOM (see vite/client.d.ts) which is a superset of what workers can do. However, AFAICT vite/client doesn't need that superset.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Provide a description in this issue that describes the bug.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
For those interested in a workaround: If you don't need support for *?worker, *?worker&inline and *?sharedworker (which can be replaced easily by *?raw and *?url), copy vite/client.d.ts and reference that copy. Remove the declarations of the above mentioned module types.
IIUC /// <reference lib="dom" /> in vite/client is interfering with typechecking as it conflicts with webworker? I think that could be breaking. Perhaps we can expose another vite/worker instead? Feel free to send a PR if you have ideas to solve this, and we can discuss there onwards too.
Describe the bug
The
vite/client
types result in type errors when used in sources wherelib
was declared to bewebworker
. It runs fine in vite but throws errors when validating viatsc
.Reproduction
Analysis
The issue is that vite/client is referencing DOM (see vite/client.d.ts) which is a superset of what workers can do. However, AFAICT vite/client doesn't need that superset.
Related: microsoft/TypeScript#20595
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: