mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
types(Webhook): specify message type (#11142)
* types(Webhook): specify message type * test(Webhook): update types
This commit is contained in:
6
packages/discord.js/typings/index.d.ts
vendored
6
packages/discord.js/typings/index.d.ts
vendored
@@ -3847,9 +3847,9 @@ export class Webhook<Type extends WebhookType = WebhookType> {
|
|||||||
public editMessage(
|
public editMessage(
|
||||||
message: MessageResolvable,
|
message: MessageResolvable,
|
||||||
options: MessagePayload | WebhookMessageEditOptions | string,
|
options: MessagePayload | WebhookMessageEditOptions | string,
|
||||||
): Promise<Message>;
|
): Promise<Message<true>>;
|
||||||
public fetchMessage(message: Snowflake, options?: WebhookFetchMessageOptions): Promise<Message>;
|
public fetchMessage(message: Snowflake, options?: WebhookFetchMessageOptions): Promise<Message<true>>;
|
||||||
public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<Message>;
|
public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<Message<true>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebhookClient extends WebhookFields, BaseClient<{}> {}
|
export interface WebhookClient extends WebhookFields, BaseClient<{}> {}
|
||||||
|
|||||||
@@ -2687,9 +2687,9 @@ declare const webhookClient: WebhookClient;
|
|||||||
declare const interactionWebhook: InteractionWebhook;
|
declare const interactionWebhook: InteractionWebhook;
|
||||||
declare const snowflake: Snowflake;
|
declare const snowflake: Snowflake;
|
||||||
|
|
||||||
expectType<Promise<Message>>(webhook.send('content'));
|
expectType<Promise<Message<true>>>(webhook.send('content'));
|
||||||
expectType<Promise<Message>>(webhook.editMessage(snowflake, 'content'));
|
expectType<Promise<Message<true>>>(webhook.editMessage(snowflake, 'content'));
|
||||||
expectType<Promise<Message>>(webhook.fetchMessage(snowflake));
|
expectType<Promise<Message<true>>>(webhook.fetchMessage(snowflake));
|
||||||
expectType<Promise<Webhook>>(webhook.edit({ name: 'name' }));
|
expectType<Promise<Webhook>>(webhook.edit({ name: 'name' }));
|
||||||
|
|
||||||
expectType<Promise<APIMessage>>(webhookClient.send('content'));
|
expectType<Promise<APIMessage>>(webhookClient.send('content'));
|
||||||
|
|||||||
Reference in New Issue
Block a user