Skip to content

feat(plugin-gateway): add discord.js Resolvable types - #154

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
feat/gateway-resolvables
Sep 28, 2026
Merged

kodiakhq[bot] merged 1 commit into
mainfrom
feat/gateway-resolvables

Conversation

@RedStar071

@RedStar071 RedStar071 commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

🧭 Context

Code ported from discord.js keeps reaching for UserResolvable, ChannelResolvable, ColorResolvable and friends, and the gateway only had the flags ones plus a generic IdResolvable.

📚 Description

Adds the full set of *Resolvable types from discord.js's typings/index.d.ts, pointing at our structures instead of theirs. The ones we already had (BitFieldResolvable, the flags ones, PermissionResolvable, BufferResolvable, EmojiIdentifierResolvable) stay where they are.

Key changes

  • src/types.ts: every channel, guild, user, message, permission and application resolvable, plus ColorResolvable, DateResolvable and RoleColorsResolvable
  • Channel groups discord.js has and we didn't: ThreadChannel, GuildBasedChannel, NonThreadGuildBasedChannel, TextBasedChannel, VoiceBasedChannel, GuildInvitableChannel
  • Colors in util/Colors.ts and resolveColor() in util/Util.ts, same split as discord.js's src/util, so ColorResolvable is actually usable
  • ApplicationFlagsBitField, the one flags bitfield that was missing

Things worth a look:

  • The guild channel groups are listed by hand. Deriving them from AnyChannel doesn't work because its BaseChannel fallback structurally accepts a DMChannel, so GuildChannelResolvable happily took DMs.
  • Application commands, entitlements, SKUs, subscriptions and components have no structure here (interactions and builders are out of scope), so those resolvables use the raw discord-api-types shapes.
  • Managers still take IdResolvable and plain number colors. I left rewiring them (e.g. RoleManager accepting ColorResolvable) for a follow-up rather than changing signatures in the same PR. Happy to fold it in if you'd prefer.

🤖 AI disclosure: Wolfstar Agent Kit modified this description. My AI open-source policy.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Workflow / CI change

Pre-flight Checklist

  • I have read the Contributing Guidelines (if applicable)
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I added a changeset with pnpm changeset (or pnpm changeset add --empty if no release is needed). See .changeset/README.md.

Adds every *Resolvable type from discord.js mapped onto the package's structures,
the guild/text/voice/thread channel groups, Colors and resolveColor, and
ApplicationFlagsBitField.
@wolfstarbot wolfstarbot added the packages:plugin-gateway Changes in plugin-gateway label Sep 28, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the full diff (6 files, 1 commit) adding discord.js-style *Resolvable types to plugin-gateway.

  • util/resolvables.ts (new): every channel/guild/user/message/permission/application *Resolvable type from discord.js's typings/index.d.ts, mapped onto this package's own structures instead of discord.js's.
  • New channel groups: ThreadChannel, GuildBasedChannel, NonThreadGuildBasedChannel, TextBasedChannel, VoiceBasedChannel, GuildInvitableChannel, listed by hand rather than derived from AnyChannel (whose BaseChannel fallback would structurally accept DM channels too).
  • Colors / resolveColor(): ported runtime helper, with unit tests covering hex (with/without #), named colors, RGB-tuple packing, "Random", and the TypeError/RangeError paths.
  • ApplicationFlagsBitField (util/flags.ts): the one flags bitfield that was missing, following the existing NumberFlagsBitField pattern used by every sibling bitfield in that file.
  • tests/types/resolvables.ts: type-level consumption test (wired into the package's existing tsconfig.consumption.json, so it runs under the root pnpm typecheck) asserting DM channels and threads are correctly rejected by the guild-channel resolvables.
  • index.ts: re-exports the new module.

Spot-checked several of the ported types (ColorResolvable, Colors, GuildResolvable, UserResolvable) against current discord.js source/docs — all matched exactly. Confirmed the hand-listed channel groups enumerate exactly the concrete channel structures under src/structures/channels/, and that there are no export name collisions with existing code. The PR explicitly and reasonably defers rewiring managers (which still take IdResolvable) to a follow-up rather than changing call signatures here.

Pullfrog  | View workflow run | Using Claude Sonnet | 𝕏

@kodiakhq
kodiakhq Bot merged commit 8bb49ef into main Sep 28, 2026
17 checks passed
@kodiakhq
kodiakhq Bot deleted the feat/gateway-resolvables branch September 28, 2026 17:00
@RedStar071
RedStar071 restored the feat/gateway-resolvables branch September 28, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages:plugin-gateway Changes in plugin-gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants