timotejroiko / discord.js-light

All the power of discord.js, zero caching. This library modifies discord.js's internal classes and functions in order to give you full control over its caching behaviour.
Apache License 2.0
292 stars 29 forks source link

TypeScript support? #10

Closed KevinNovak closed 4 years ago

KevinNovak commented 4 years ago

When using TypeScript, the editor is unable to find the type declarations file (I'm guessing since it is included in discord.js but not in discord.js-light?):

Missing TypeScript

Is there a way to include or redirect typescript definitions to make discord.js-light usable with typescript?

timotejroiko commented 4 years ago

i'll look into it

timotejroiko commented 4 years ago

i've added some basic typings in 8763310, feel free to test them out. (i hope they work, im not a ts dev) I'll try to add the rest of the missing typings soon.

KevinNovak commented 4 years ago

Thanks for getting to this so quickly. However when I do a build, the typescript compiler gives back the following error:

Exports and export assignments are not permitted in module augmentations.

image

12 should fix this issue.

However this requires typescript projects to use both imports from discord.js and discord.js-light:

image

Which is not necessarily a bad thing, but something to be aware of, discord.js will still need to be installed in order to get the discord.js types that you haven't extended. I'm not sure if there's a way around that (like re-exporting all types somehow)

timotejroiko commented 4 years ago

added the rest of the typings and released in 3.2.7 closing this for now, let me know if anything goes wrong 👍

KevinNovak commented 4 years ago

Thank you, will do!!