Skip to content

Commit

Permalink
types(resolvePartialEmoji): overload method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Oct 10, 2023
1 parent 234ef69 commit 5cfc603
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3204,7 +3204,8 @@ export function mergeDefault(def: unknown, given: unknown): unknown;
export function moveElementInArray(array: unknown[], element: unknown, newIndex: number, offset?: boolean): number;
export function parseEmoji(text: string): PartialEmoji | null;
export function resolveColor(color: ColorResolvable): number;
export function resolvePartialEmoji(emoji: Emoji | EmojiIdentifierResolvable): PartialEmoji | PartialEmojiOnlyId | null;
export function resolvePartialEmoji(emoji: Snowflake): PartialEmojiOnlyId;
export function resolvePartialEmoji(emoji: Emoji | EmojiIdentifierResolvable): PartialEmoji | null;
export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
export function setPosition<T extends Channel | Role>(
item: T,
Expand Down
10 changes: 10 additions & 0 deletions packages/discord.js/typings/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ import {
PartialGuildMember,
PartialMessage,
PartialMessageReaction,
resolvePartialEmoji,
PartialEmojiOnlyId,
Emoji,
PartialEmoji,
} from '.';
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
Expand Down Expand Up @@ -2363,3 +2367,9 @@ expectType<true>(partialUser.partial);
expectType<null>(partialUser.username);
expectType<null>(partialUser.tag);
expectType<null>(partialUser.discriminator);

declare const emoji: Emoji;
{
expectType<PartialEmojiOnlyId>(resolvePartialEmoji('12345678901234567'));
expectType<PartialEmoji | null>(resolvePartialEmoji(emoji));
}

0 comments on commit 5cfc603

Please sign in to comment.