From 84197a0ee0bbfc110caa8a3e7a5e82c4672be138 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Wed, 12 Nov 2025 13:31:13 +0000 Subject: [PATCH] fix: Remove data conditional check (#11250) * fix: remove conditional * types: sort types --- packages/discord.js/src/structures/GuildMember.js | 2 +- packages/discord.js/src/structures/PermissionOverwrites.js | 2 +- packages/discord.js/src/structures/Role.js | 2 +- packages/discord.js/src/structures/ThreadChannel.js | 2 +- packages/discord.js/src/structures/Webhook.js | 2 +- packages/discord.js/typings/index.d.ts | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/discord.js/src/structures/GuildMember.js b/packages/discord.js/src/structures/GuildMember.js index 0bfa5512d..bea548d30 100644 --- a/packages/discord.js/src/structures/GuildMember.js +++ b/packages/discord.js/src/structures/GuildMember.js @@ -56,7 +56,7 @@ class GuildMember extends Base { */ Object.defineProperty(this, '_roles', { value: [], writable: true }); - if (data) this._patch(data); + this._patch(data); } _patch(data) { diff --git a/packages/discord.js/src/structures/PermissionOverwrites.js b/packages/discord.js/src/structures/PermissionOverwrites.js index 356ef3ee1..27515aa12 100644 --- a/packages/discord.js/src/structures/PermissionOverwrites.js +++ b/packages/discord.js/src/structures/PermissionOverwrites.js @@ -22,7 +22,7 @@ class PermissionOverwrites extends Base { */ Object.defineProperty(this, 'channel', { value: channel }); - if (data) this._patch(data); + this._patch(data); } _patch(data) { diff --git a/packages/discord.js/src/structures/Role.js b/packages/discord.js/src/structures/Role.js index c2e7e81c8..c148324f6 100644 --- a/packages/discord.js/src/structures/Role.js +++ b/packages/discord.js/src/structures/Role.js @@ -34,7 +34,7 @@ class Role extends Base { */ this.unicodeEmoji = null; - if (data) this._patch(data); + this._patch(data); } _patch(data) { diff --git a/packages/discord.js/src/structures/ThreadChannel.js b/packages/discord.js/src/structures/ThreadChannel.js index 6f8de0ce1..53fb2fa38 100644 --- a/packages/discord.js/src/structures/ThreadChannel.js +++ b/packages/discord.js/src/structures/ThreadChannel.js @@ -49,7 +49,7 @@ class ThreadChannel extends BaseChannel { * @type {ThreadMemberManager} */ this.members = new ThreadMemberManager(this); - if (data) this._patch(data); + this._patch(data); } _patch(data) { diff --git a/packages/discord.js/src/structures/Webhook.js b/packages/discord.js/src/structures/Webhook.js index 84c233c64..6c0ed4b93 100644 --- a/packages/discord.js/src/structures/Webhook.js +++ b/packages/discord.js/src/structures/Webhook.js @@ -22,7 +22,7 @@ class Webhook { * @readonly */ Object.defineProperty(this, 'client', { value: client }); - if (data) this._patch(data); + this._patch(data); } _patch(data) { diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index e8483d008..bc2515e37 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3841,7 +3841,7 @@ export interface PrivateThreadChannel extends ThreadChannel { export interface ThreadChannel extends Omit, 'fetchWebhooks' | 'createWebhook' | 'setNSFW'> {} export class ThreadChannel extends BaseChannel { - private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client); + private constructor(guild: Guild, data: RawThreadChannelData, client?: Client); public archived: boolean | null; public get archivedAt(): Date | null; public archiveTimestamp: number | null; @@ -4234,7 +4234,7 @@ export class VoiceState extends Base { // tslint:disable-next-line no-empty-interface export interface Webhook extends WebhookFields {} export class Webhook { - private constructor(client: Client, data?: RawWebhookData); + private constructor(client: Client, data: RawWebhookData); public avatar: string | null; public avatarURL(options?: ImageURLOptions): string | null; public channelId: Snowflake;