I have a standard Vue 3/Vite application scaffolded using
npm create vue
I am using eslint in the project and I want to add a SharedWorker to my app. I have created worker.js file inside the project, where onconnect handler is defined. With that setup I get eslint error message:
'onconnect' is not defined. eslint(no-undef)
How can I avoid this error without silencing it and make sure worker.js is linted properly?
My workaround is:
tsconfig.app.jsonadd tocompilerOptions.libworker.ts|.jsadddeclare const self: SharedWorkerGlobalScope;at the top of your fileonconnectaddselfbefore like this