They used to exist in this project/repository, but no longer exist in master.
According to Microsoft/TypeScript#11781, they haven't made it into TypeScript (itself) yet.
This StackOverflow answer directs people to the no longer existent typings that were in here.
The NPM package still exists, but when you install it, you get this message:
warning @types/[email protected]: ServiceWorker types are now provided by '--lib dom'
That warning says to me that it should be available in TypeScript (itself) if you are using the "dom" library (which is the case if your target is ES5), but TypeScript throws errors when you try to use the typings.
So I guess we can still using the "service_worker_api" NPM package (even though the source for it has disappeared), but I'm not sure if there is a more appropriate solution.
Scratch that, it seems as if we can't even use the "@types/service_worker_api" NPM package, because it depends on the "@types/whatwg-fetch" and "@types/whatwg-streams" packages, both of which do not compile under TypeScript 2.3.x.
What errors are you getting when trying to use --lib dom?
error TS2304: Cannot find name 'InstallEvent'
That was the name of an interface in the "service_worker_api" typings (which were in this repo).
Can we look at re-introducing updated Service Worker typings into this repo, until they make it into TypeScript?
Hi @begincalendar, sorry for the delay. If you can figure out service worker typings that will work in ts2.3 that would be great.
It seems it's not going to be as straight forward of a task that I was hoping for.
TypeScript >2.3 appears to contain partially completed types for service workers and that's going to cause headaches trying to get things working in this repo, right?
Couple that with the fact that the standard for service workers is still in a working draft state (i.e. the standard could change).
Its been a while since someone updated this, is there any change? I am currently facing the same problem.
Is the standard out of working draft yet? If so, you could try fixing it directly at https://github.com/Microsoft/TSJS-lib-generator .
@andy-ms given this is shipping in Edge, Firefox, Safari and Chrome, the spec type shouldn't really matter.
Sounds like it should be ready for TSJS-lib-generator then.
Connecting the dots: The request in TSJS-lib-generator is https://github.com/Microsoft/TSJS-lib-generator/issues/505
Most helpful comment
@andy-ms given this is shipping in Edge, Firefox, Safari and Chrome, the spec type shouldn't really matter.