Compiling from TypeScript throws this error:
node_modules/discord.js/typings/index.d.ts:18:30 - error TS7016: Could not find a declaration file for module 'ws'. '/.../node_modules/ws/index.js' implicitly has an 'any' type.
Try `npm install @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`
Seems like the type definitions for ws need to be included with the distribution.
Or... install @types/ws as a dev dependency
Dependencies you need to develop your bot should be installed on your own.
I can get rid of the error message by installing @types/ws myself, like @ItsPapaia suggested, but I'm not using the ws package at all. I'd only be installing it because the compiler is complaining; it's not a dependency that I, myself, am using.
The error points to it being a package that Discord.js is using.
node_modules/discord.js/typings/index.d.ts:18:30
Am I reading that wrong?
@iCrawl
Yes, if you are using Typescript its your responsibility to install the needed dependencies.
A library should never depend on any kind of typings and directly "ship" or install them.
This is a pretty established standard in the Typescript community.
Just skip lib check (skipLibCheck in tsconfig)
I understand the need to install type definitions for libraries a project is using directly, but if a project is also responsible for the definitions used by all sub-packages, that seems like it could be unwieldy.
Since Discord.js is using (and more importantly, exporting) WebSocket definitions, would it be appropriate to include those same definitions?
I can work around the issue, @ItsPapaia, so this is not a blocker by any means. But I would prefer to have a complete package, if sensible.
It is private, not a parameter, and should not be touched by the user anyway.
This was, again, already discussed previously and decided against.