You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using .type field to check for component type, the result will always include ButtonComponentData as it has no definition of .type which falls back to the base definition of type: ComponentType.
Code sample
import{ButtonComponentData,StringSelectMenuComponentData,UserSelectMenuComponentData}from"discord.js";typeExample1=(|ButtonComponentData|StringSelectMenuComponentData|UserSelectMenuComponentData);typeExample2=(|StringSelectMenuComponentData|UserSelectMenuComponentData);constexample1: Example1={}asany;constexample2: Example2={}asany;if(example1.type===ComponentType.StringSelect){// Type of example1: ButtonComponentData | StringSelectMenuComponentData}if(example2.type===ComponentType.StringSelect){// Type of example2: StringSelectMenuComponentData}
Versions
discord.js 14.11.1
Node.js 18.16.0
TypeScript 4.9.5
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
The text was updated successfully, but these errors were encountered:
Which package is this bug report for?
discord.js
Issue description
When using
.type
field to check for component type, the result will always includeButtonComponentData
as it has no definition of.type
which falls back to the base definition oftype: ComponentType
.Code sample
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
The text was updated successfully, but these errors were encountered: