Skip to content

Commit

Permalink
fix: change Awaited to Awaitable
Browse files Browse the repository at this point in the history
This matches the change made in
sapphiredev/utilities#193
  • Loading branch information
favna committed Oct 4, 2021
1 parent 0474b43 commit f1f9c1b
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 143 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@discordjs/collection": "^0.2.1",
"@sapphire/utilities": "^2.0.1",
"@sapphire/utilities": "next",
"tslib": "^2.3.1"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/lib/strategies/ILoaderStrategy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Awaited, Constructor, Ctor } from '@sapphire/utilities';
import type { Awaitable, Constructor, Ctor } from '@sapphire/utilities';
import type { Piece } from '../structures/Piece';
import type { Store } from '../structures/Store';

Expand Down Expand Up @@ -40,7 +40,7 @@ export type FilterResult = ModuleData | null;
/**
* Represents the return data from {@link ILoaderStrategy.preload}
*/
export type PreloadResult<T extends Piece> = Awaited<Constructor<T> & Record<PropertyKey, unknown>>;
export type PreloadResult<T extends Piece> = Awaitable<Constructor<T> & Record<PropertyKey, unknown>>;

/**
* Represents the return data from {@link ILoaderStrategy.preload}
Expand Down Expand Up @@ -121,26 +121,26 @@ export interface ILoaderStrategy<T extends Piece> {
* @param store The store that holds the piece.
* @param piece The piece that was loaded.
*/
onLoad(store: Store<T>, piece: T): Awaited<unknown>;
onLoad(store: Store<T>, piece: T): Awaitable<unknown>;

/**
* Called after all pieces have been loaded.
* @param store The store that loaded all pieces.
*/
onLoadAll(store: Store<T>): Awaited<unknown>;
onLoadAll(store: Store<T>): Awaitable<unknown>;

/**
* Called after a piece has been unloaded or overwritten by a newly loaded piece.
* @param store The store that held the piece.
* @param piece The piece that was unloaded.
*/
onUnload(store: Store<T>, piece: T): Awaited<unknown>;
onUnload(store: Store<T>, piece: T): Awaitable<unknown>;

/**
* Called after all pieces have been unloaded.
* @param store The store that unloaded all pieces.
*/
onUnloadAll(store: Store<T>): Awaited<unknown>;
onUnloadAll(store: Store<T>): Awaitable<unknown>;

/**
* @param error The error that was thrown.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/structures/Piece.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Awaited } from '@sapphire/utilities';
import type { Awaitable } from '@sapphire/utilities';
import { container, Container } from '../shared/Container';
import { PieceLocation, PieceLocationJSON } from './PieceLocation';
import type { Store } from './Store';
Expand Down Expand Up @@ -89,15 +89,15 @@ export class Piece {
* Per-piece listener that is called when the piece is loaded into the store.
* Useful to set-up asynchronous initialization tasks.
*/
public onLoad(): Awaited<unknown> {
public onLoad(): Awaitable<unknown> {
return undefined;
}

/**
* Per-piece listener that is called when the piece is unloaded from the store.
* Useful to set-up clean-up tasks.
*/
public onUnload(): Awaited<unknown> {
public onUnload(): Awaitable<unknown> {
return undefined;
}

Expand Down
Loading

0 comments on commit f1f9c1b

Please sign in to comment.