Skip to content

Commit

Permalink
feat(ioc): added CommandResult type
Browse files Browse the repository at this point in the history
  • Loading branch information
kedrzu committed Jun 6, 2024
1 parent 0cbb3f1 commit e5ef387
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ioc/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export interface CommandDefinition<T extends CommandFunction> extends Resolvable
readonly setup: (ctx: CommandContext) => T;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type CommandResult<T extends Command<any>> =
T extends Command<infer R> ? Awaited<ReturnType<R>> : never;

export function defineCommand<T extends CommandFunction>(
definition: CommandDefinition<T>,
): Command<T> {
Expand Down

0 comments on commit e5ef387

Please sign in to comment.