Skip to content

Commit

Permalink
fix(utilities): rename Awaited<T> to Awaitable<T> (#193)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `Awaited` has been renamed to `Awaitable`
  • Loading branch information
kyranet committed Oct 4, 2021
1 parent cf2c08f commit 6ff3e28
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Awaited, isNullish } from '@sapphire/utilities';
import { Awaitable, isNullish } from '@sapphire/utilities';
import type { CollectorFilter, CollectorOptions, EmojiIdentifierResolvable, Message, MessageReaction, User } from 'discord.js';
import { isTextBasedChannel } from '../../type-guards';
import type { MessagePrompterChannelTypes, MessagePrompterMessage } from '../constants';
Expand Down Expand Up @@ -49,7 +49,7 @@ export abstract class MessagePrompterBaseStrategy {
this.message = message;
}

public abstract run(channel: MessagePrompterChannelTypes, authorOrFilter: User | CollectorFilter<unknown[]>): Awaited<unknown>;
public abstract run(channel: MessagePrompterChannelTypes, authorOrFilter: User | CollectorFilter<unknown[]>): Awaitable<unknown>;

protected async collectReactions(
channel: MessagePrompterChannelTypes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Time } from '@sapphire/time-utilities';
import { Awaited, isFunction } from '@sapphire/utilities';
import { Awaitable, isFunction } from '@sapphire/utilities';
import type { RESTPostAPIChannelMessageJSONBody } from 'discord-api-types/v9';
import {
Collection,
Expand Down Expand Up @@ -962,7 +962,7 @@ export interface PaginatedMessage {
*/
export interface IPaginatedMessageAction {
id: string;
run(context: PaginatedMessageActionContext): Awaited<unknown>;
run(context: PaginatedMessageActionContext): Awaitable<unknown>;
}

/**
Expand Down Expand Up @@ -1016,7 +1016,7 @@ export interface PaginatedMessageOptions {
* on the provided pages and we can only guarantee this will work properly when using the utility methods.
*/
export type MessagePage =
| ((index: number, pages: MessagePage[], handler: PaginatedMessage) => Awaited<MessagePayload | MessageOptions>)
| ((index: number, pages: MessagePage[], handler: PaginatedMessage) => Awaitable<MessagePayload | MessageOptions>)
| MessagePayload
| MessageOptions;

Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/src/lib/utilityTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export type SecondArgument<T> = T extends (arg1: unknown, arg2: infer U, ...args
/**
* ReturnType for a function that can return either a value or a `Promise` with that value
*/
export type Awaited<T> = PromiseLike<T> | T;
export type Awaitable<T> = PromiseLike<T> | T;

/**
* Type union for the full 2 billion dollar mistake in the JavaScript ecosystem
Expand Down
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"PrettierSchema",
"InternalAsyncQueueDeferredPromise",
"Ctor",
"Awaited",
"Awaitable",
"Nullish",
"EmbedData",
"EmbedInformation",
Expand Down

0 comments on commit 6ff3e28

Please sign in to comment.