fix command types
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user