TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

`@types/webworker` is not being published to npm

Open StenAL opened this issue 3 years ago • 4 comments

I'd like to override the webworker lib in my project's TypeScript installation. With other libraries, e.g. dom, this is possible because the dom.generated.d.ts file is being published to npm as @types/web.

However, I can't see webworker.generated.d.ts being published to any npm packages. In the deploy folder there is some infrastrucutre for publishing it as @types/webworker (e.g. this README), but https://www.npmjs.com/package/@types/webworker doesn't exist and returns a 404.

All the other packages published from this repo are in the packages array in deploy/createTypesPackages.

StenAL avatar Jan 21 '23 10:01 StenAL

it gets shipped with typescript, but you can use https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#supporting-lib-from-node_modules to set it yourself

orta avatar Jan 21 '23 14:01 orta

Yeah, but there's no npm package for overriding the WebWorker lib.

For the DOM lib, there's @types/web. For service workers, there's @types/serviceworker. For shared workers, there's @types/sharedworker. For audio worklets, there's @types/audioworklet. For dedicated workers, there's no package because @types/webworker is not being published.

StenAL avatar Jan 21 '23 15:01 StenAL

Ish, you'd need to ship your own - you could use a locally resolved folder for example

I'd recommend re-reading how that TypeScript feature works

orta avatar Jan 21 '23 20:01 orta

I see, though that's a lot more friction than writing npm i --save-dev @typescreipt/lib-webworker:@types/webworker. I'd have to basically make a tiny local package containing just webworker.generated.d.ts and update it manually by copying over changes from this repo whenever the types change.

Is there a reason these types aren't published? It seems like they're meant to be published considering there's even a README for the package.

StenAL avatar Jan 22 '23 11:01 StenAL