mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
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:
@@ -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>
|
||||
>();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user