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
We can't generate such types into the types folder because they still need to be manually referenced inside service-worker.js, and at the same time it needs to be made sure that those types are not loaded anywhere else, since the no-default-lib instruction effectively removes theses type definitions from the rest of the project, which is undesireable. I think we should instead document this pattern and adjust our generated tsconfig.json to exclude the service worker file, so it doesn't interfere with the rest of the project.
* fix: exclude service worker from tsconfig
Also document how to get types working inside the file
closes#8127
* ws -> sw
Co-authored-by: Rich Harris <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Describe the problem
At present you need to add types for the service worker to clue TypeScript in about the
WebWorker
scope and setself
toServiceWorkerGlobalScope
.Describe the proposed solution
SvelteKit should generate types into the types folder.
Alternatives considered
Writing my own types. It typically involves adding triple-slash directives in my
src/service-worker.js
.And creating
src/service-worker.d.ts
Importance
nice to have
Additional Information
TS Context: microsoft/TypeScript#14877.
The text was updated successfully, but these errors were encountered: