discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.38k stars 3.97k forks source link

Synchronize required version of discord-api-types across packages #10533

Closed kevinlul closed 3 weeks ago

kevinlul commented 3 weeks ago

Which package is this bug report for?

ws

Issue description

  1. Install the latest version of discord.js (currently 14.16.3)
  2. Observe that three separate versions of discord-api-types are installed:
    • 0.37.100 via discord.js
    • 0.37.97 via @discordjs/builders, @discordjs/formatters, @discordjs/rest
    • 0.37.83 via @discordjs/ws
  3. This causes incompatible typings for RESTPostAPIApplicationCommandsJSONBody between the import from discord.js and the one from discord-api-types/v10 because multiple versions of discord-api-types are in use

Code sample

No response

Versions

Issue priority

Low (slightly annoying)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

kevinlul commented 3 weeks ago

Sample TypeScript compiler error:

Type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord.js/node_modules/discord-api-types/rest/v10/interactions").RESTPostAPIApplicationCommandsJSONBody' is not assignable to type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord-api-types/rest/v10/interactions").RESTPostAPIApplicationCommandsJSONBody'.
      Type 'RESTPostAPIChatInputApplicationCommandsJSONBody' is not assignable to type 'RESTPostAPIApplicationCommandsJSONBody'.
        Type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord.js/node_modules/discord-api-types/rest/v10/interactions").RESTPostAPIChatInputApplicationCommandsJSONBody' is not assignable to type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord-api-types/rest/v10/interactions").RESTPostAPIChatInputApplicationCommandsJSONBody'.
          Types of property 'type' are incompatible.
            Type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord.js/node_modules/discord-api-types/payloads/v10/_interactions/applicationCommands").ApplicationCommandType.ChatInput | undefined' is not assignable to type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord-api-types/payloads/v10/_interactions/applicationCommands").ApplicationCommandType.ChatInput | undefined'.
              Type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord.js/node_modules/discord-api-types/payloads/v10/_interactions/applicationCommands").ApplicationCommandType.ChatInput' is not assignable to type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord-api-types/payloads/v10/_interactions/applicationCommands").ApplicationCommandType.ChatInput'.
                Property 'PrimaryEntryPoint' is missing in type 'import("/home/runner/work/bastion-bot/bastion-bot/node_modules/discord-api-types/payloads/v10/_interactions/applicationCommands").ApplicationCommandType'.
didinele commented 3 weeks ago

Should be resolved by #10524 already. Waiting for a release cycle.