-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript for ServiceWorkers #7153
Comments
Despite his use of Angular, this article by Sebastien Dubois may be relevant: I found this StackOverflow interesting, Jake Archibald is a Chrome dev (nice to know we're not the only ones struggling with Typescript...) https://stackoverflow.com/questions/56356655/structuring-a-typescript-project-with-workers/56374158#56374158 But ultimately I struggled to get the parent-child tsconfig working. Moreover, it wasn't clear to me the benefit of that linkage would be (or is). So I actively exlucde src-pwa from parent (project) tsconfig.json. I did point my eslintrc.js file to the new "project" to get VSCode working. (extracted from my setup):
|
Thank you! Modes still doesn't have TS support, but we can discuss how to add them in a coherent way (adding a |
Hi, I tried this solution but it fails when I run |
Is it a 'duplicate' of: #8102 ? |
@StazriN creating a script like Otherwise you'll need to search how Quasar does this and PR it's support into the core @sluedecke doesn't seem so, what do you mean? |
@rfox12 PWA, Electron and SSR folders now supports TS files now in Qv2! We also plan to automatically generate TS files when adding a mode to TS codebase, you can keep track of that effort here: #8572 Closing as it's already into official roadmap: https://roadmap.quasar.dev/ |
Opening for reference and discussion per @IlCallo
In my app I had a need for a customized ServiceWorker (beyond a few Workbox calls--I'm using sockets, indexeddb, etc.). So I'm using the InjectManifest option and I'm off to the races. When the code gets over a hundred lines it's nice to have Typescript coverage.
TL;DR: I made the
src-pwa
folder into it's own mini Typescript project, then Quasar picks up the *.js files as normal.This is my
tsconfig.json
insidesrc-pwa
;Then
register-service-worker
can be made into a .ts file with just a few changes (for example):and my
custom-service-worker
has this at the top:and now we get the benefit of Typescript below in the service worker code... e.g.:
The text was updated successfully, but these errors were encountered: