js-dos icon indicating copy to clipboard operation
js-dos copied to clipboard

`types` field not added to `package.json`

Open Robbie-Cook opened this issue 7 months ago • 4 comments
trafficstars

Apologies if this is intended behaviour or is a known change

With version 8.3.14, there is no types field in package.json. This means vscode and webpack are unable to link the types correctly (e.g. for DosPlayer).

This is changed from 7.x.x: (link)

Robbie-Cook avatar Apr 22 '25 05:04 Robbie-Cook

Hi! Yes, that’s correct. Instead of using a package, you can simply copy the type definitions directly into your project — I found that more convenient. Here's the file with the types:

https://github.com/caiiiycuk/js-dos/blob/8.xx/src/public/types.ts

I chose this approach because js-dos is an old-school library — you include it via a

caiiiycuk avatar Apr 22 '25 06:04 caiiiycuk

Add this file, and then do:

declare const Dos: DosFn;

caiiiycuk avatar Apr 22 '25 06:04 caiiiycuk

Thanks @caiiiycuk that makes sense! Will use v7 types for now, and pull down these types above when have time 🙏 ^

For typescript projects, it's a little bit tricky to get at these types out of the box, would you consider allowing packaging the types again, or bundling types into an @types/js-dos package? Happy to raise PR If not, feel free to close with won't do

Thanks!

Robbie-Cook avatar Apr 23 '25 05:04 Robbie-Cook

@Robbie-Cook I am totally fine, please make PR. Thank you!

caiiiycuk avatar Apr 23 '25 06:04 caiiiycuk