flybywiresim / discord-bot-utils

Utilities Discord Bot created for the FlyByWire Discord server.
https://flybywiresim.com/
GNU Affero General Public License v3.0
5 stars 7 forks source link

[BUG] TypeScript v5.5 breaks build #78

Open ExampleWasTaken opened 1 month ago

ExampleWasTaken commented 1 month ago

Description

A bug fix in TS v5.5 breaks our build.

It happens because discord.js export their own declarations for node:events. This causes TS to use those declarations instead of the ones from @types/node in src/lib/db.ts#L16. These types being incorrect fails the build.

At the moment we use TypeScript v5.3.3 which doesn't have the bug fix and therefore doesn't break our build.

Expected behavior

TypeScript should use the correct types at all times.

Steps to reproduce

  1. Install the latest TypeScript version using
    npm i -D typescript@latest
  2. Run
    npm run dev

[!IMPORTANT] VSCode users, make sure you use the workspace typescript version as VSC uses its bundled TS version by default.

[!NOTE] Once done with testing, make sure to reset your workspace by running

git reset --hard & npm i

References

alepouna commented 1 month ago

Seems like d.js is patching it with this PR https://github.com/discordjs/discord.js/pull/10360, once this is merged we can update d.js and it should be fine (?)

bug that became a feature for some, is now being patched 🤣

ExampleWasTaken commented 1 month ago

Seems like d.js is patching it with this PR discordjs/discord.js#10360, once this is merged we can update d.js and it should be fine (?)

bug that became a feature for some, is now being patched 🤣

Good spot! I'll subscribe to the PR and update our dependency once it's merged. (I hope it's that simple lol)

Feel free to assign me this issue :)

ExampleWasTaken commented 3 weeks ago

discordjs/discord.js#10360 has been merged, currently waiting on a new release from them

ExampleWasTaken commented 1 week ago

discord.js v14.16.0 has been released which includes the fix that's supposed to fix our issue.

I probably won't be able to work on it till the weekend though.