fix command types

This commit is contained in:
Philipp Kühn
2020-10-23 10:48:10 +02:00
parent fd298b645b
commit 56da8880dc

View File

@@ -37,11 +37,17 @@ export interface CommandsSpec {
export interface AllExtensions {} export interface AllExtensions {}
export type SingleCommands = UnionToIntersection<ReturnType<PickValue<ReturnType<AllExtensions[keyof AllExtensions]>, 'addCommands'>>> export type AllCommands = UnionToIntersection<ReturnType<PickValue<ReturnType<AllExtensions[keyof AllExtensions]>, 'addCommands'>>>
export type SingleCommands = {
[Item in keyof AllCommands]: AllCommands[Item] extends (...args: any[]) => any
? (...args: Parameters<AllCommands[Item]>) => boolean
: never
}
export type ChainedCommands = { export type ChainedCommands = {
[Item in keyof SingleCommands]: SingleCommands[Item] extends (...args: any[]) => any [Item in keyof AllCommands]: AllCommands[Item] extends (...args: any[]) => any
? (...args: Parameters<SingleCommands[Item]>) => ChainedCommands ? (...args: Parameters<AllCommands[Item]>) => ChainedCommands
: never : never
} & { } & {
run: () => boolean run: () => boolean