diff --git a/packages/core/src/resolvable.ts b/packages/core/src/resolvable.ts index 236980eff..2c3bbba19 100644 --- a/packages/core/src/resolvable.ts +++ b/packages/core/src/resolvable.ts @@ -25,95 +25,21 @@ export namespace AsyncResolvable { [key in keyof T]: AsyncResolvable; }; - export function resolve( - value: T | DynamicallyResolvable | AsyncDynamicallyResolvable, - ): Awaitable; + export function resolve(value: AsyncResolvable): Awaitable; - export function resolve( - ...values: [AsyncResolvable, AsyncResolvable] - ): Promise<[T1, T2]>; + export function resolve( + ...values: { [K in keyof T]: AsyncResolvable } + ): Promise<{ [K in keyof T]: T[K] }>; - export function resolve( - ...values: [AsyncResolvable, AsyncResolvable, AsyncResolvable] - ): Promise<[T1, T2, T3]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4, T5]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4, T5, T6]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - export function resolve( - ...values: [ - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - AsyncResolvable, - ] - ): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - export function resolve(...values: AsyncResolvable[]): Awaitable | Promise { + export function resolve( + ...values: { [K in keyof T]: AsyncResolvable } + ): Awaitable | Promise<{ [K in keyof T]: T[K] }> { if (values.length === 1) { - const [value] = values; - return resolveAsyncOne(value); + return resolveAsyncOne(values[0]) as Awaitable; } const resolutions = values.map((value) => resolveAsyncOne(value)); - return Promise.all(resolutions); + return Promise.all(resolutions) as Promise<{ [K in keyof T]: T[K] }>; } }