mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(RoleManager): Fetching roles is not nullable (#10629)
fix(RoleManager): `fetch()` not nullable Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -48,7 +48,7 @@ class RoleManager extends CachedManager {
|
||||
* Obtains a role from Discord, or the role cache if they're already available.
|
||||
* @param {Snowflake} [id] The role's id
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @returns {Promise<?Role|Collection<Snowflake, Role>>}
|
||||
* @returns {Promise<Role|Collection<Snowflake, Role>>}
|
||||
* @example
|
||||
* // Fetch all roles from the guild
|
||||
* message.guild.roles.fetch()
|
||||
|
||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -4491,7 +4491,7 @@ export class RoleManager extends CachedManager<Snowflake, Role, RoleResolvable>
|
||||
public guild: Guild;
|
||||
public get premiumSubscriberRole(): Role | null;
|
||||
public botRoleFor(user: UserResolvable): Role | null;
|
||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<Role | null>;
|
||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<Role>;
|
||||
public fetch(id?: undefined, options?: BaseFetchOptions): Promise<Collection<Snowflake, Role>>;
|
||||
public create(options?: RoleCreateOptions): Promise<Role>;
|
||||
public edit(role: RoleResolvable, options: RoleEditOptions): Promise<Role>;
|
||||
|
||||
@@ -1700,7 +1700,7 @@ declare const messageManager: MessageManager;
|
||||
declare const roleManager: RoleManager;
|
||||
expectType<Promise<Collection<Snowflake, Role>>>(roleManager.fetch());
|
||||
expectType<Promise<Collection<Snowflake, Role>>>(roleManager.fetch(undefined, {}));
|
||||
expectType<Promise<Role | null>>(roleManager.fetch('0'));
|
||||
expectType<Promise<Role>>(roleManager.fetch('0'));
|
||||
|
||||
declare const guildEmojiManager: GuildEmojiManager;
|
||||
expectType<Promise<Collection<Snowflake, GuildEmoji>>>(guildEmojiManager.fetch());
|
||||
|
||||
Reference in New Issue
Block a user