Skip to content

Typescript: GatewayIntentBits is not exported  #10614

@armin-salihovic

Description

@armin-salihovic

Which package is this bug report for?

discord.js

Issue description

I am trying to use discord.js with TypeScript. However, I am unable to import GatewayIntentBits. My IDE is complaining that the element has not been exported. Is passing gateway intents as strings instead of using the enum the only option in typescript?

Minimal code in a .ts file:

import { Client, GatewayIntentBits } from 'discord.js';

const client = new Client({ intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildPresences,
]});

and my tsconfig:

{
  "compilerOptions": {
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es2022",
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
    "verbatimModuleSyntax": true,
    "module": "es2022"
  }
}

Code sample

No response

Versions

  • discord.js 14.16.3
  • Node.js v20.18.0
  • TypeScript 5.6.3

Issue priority

Low (slightly annoying)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildPresences, GuildMessages, MessageContent

I have tested this issue on a development release

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions