feat(thread)!: Add query to getting a thread member (#11136)

BREAKING CHANGE: Third parameter of `ThreadsAPI#getMember()` is now `query`, pushing `options` to the fourth.

* feat(thread): add query to getting a thread member

* Apply suggestion from @almeidx

Co-authored-by: Almeida <github@almeidx.dev>

* Apply suggestion from @almeidx

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
This commit is contained in:
Jiralite
2025-10-06 10:35:31 +01:00
committed by GitHub
parent fbdec3d828
commit 2c08b0f975
2 changed files with 51 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { REST } from '@discordjs/rest';
import type {
APIActionRowComponent,
APIComponentInModalActionRow,
RESTGetAPIChannelThreadMemberResult,
RESTPostAPIInteractionCallbackWithResponseResult,
} from 'discord-api-types/v10';
import { expectTypeOf, describe, test } from 'vitest';
@@ -158,3 +159,20 @@ describe('Interaction with_response overloads.', () => {
Promise<RESTPostAPIInteractionCallbackWithResponseResult | undefined>
>());
});
describe('Thread member overloads.', () => {
test('Getting a thread member with with_member makes the guild member present.', () =>
expectTypeOf(api.threads.getMember(SNOWFLAKE, SNOWFLAKE, { with_member: true })).toEqualTypeOf<
Promise<Required<Pick<RESTGetAPIChannelThreadMemberResult, 'member'>> & RESTGetAPIChannelThreadMemberResult>
>());
test('Getting a thread member without with_member returns RESTGetAPIChannelThreadMemberResult.', () => {
expectTypeOf(api.threads.getMember(SNOWFLAKE, SNOWFLAKE, { with_member: false })).toEqualTypeOf<
Promise<RESTGetAPIChannelThreadMemberResult>
>();
expectTypeOf(api.threads.getMember(SNOWFLAKE, SNOWFLAKE)).toEqualTypeOf<
Promise<RESTGetAPIChannelThreadMemberResult>
>();
});
});