Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4k
fix: Remove data conditional check#11250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more aboutVercel for GitHub. 2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR removes the conditionalif (data) checks before calling_patch(data) in the constructors of multiple structures includingWebhook,ThreadChannel,Role,PermissionOverwrites, andGuildMember. The changes standardize the initialization pattern by always calling_patch regardless of whether data is provided.
- Removes conditional data checks before
_patch()calls in constructors - Affects 5 structure classes: Webhook, ThreadChannel, Role, PermissionOverwrites, and GuildMember
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/discord.js/src/structures/Webhook.js | Removesif (data) check before calling_patch(data) in constructor |
| packages/discord.js/src/structures/ThreadChannel.js | Removesif (data) check before calling_patch(data) in constructor |
| packages/discord.js/src/structures/Role.js | Removesif (data) check before calling_patch(data) in constructor |
| packages/discord.js/src/structures/PermissionOverwrites.js | Removesif (data) check before calling_patch(data) in constructor |
| packages/discord.js/src/structures/GuildMember.js | Removesif (data) check before calling_patch(data) in constructor |
Comments suppressed due to low confidence (1)
packages/discord.js/src/structures/ThreadChannel.js:43
- The constructor accesses
data.owner_iddirectly on line 43 before calling_patch. With the removedif (data)check, ifdatais null or undefined, this will throw a TypeError. The same issue exists on line 36 withdata.guild_id. Either restore the conditional check or add null/undefined handling in the constructor.
this.ownerId = data.owner_id;💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
vakiliner commentedNov 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Even though these constructors are private, typings needs to be updated
|
These should never be constructed without data...
The blame seems to go years and years back. Was likely ancient logic made redundant over time.