i get an error
Cannot invoke an expression whose type lacks a call signature ... has no compatible call signatures.
on one of my methods and i cant figure out how to fix it.
i have seen this link cannot-invoke-an-expression-whose-type-lacks-a-call-signature
and 2 more but still didn`t mange to figure it out
type declaration :
type ProcessMethods = execute | execSpawn
interface IDeferedCmd {
type: ProcessMethods,
cmd: string,
name: string,
resolve: IResolveFn,
reject: IRejectFn,
args?: Array<string>,
options?: object
}
in my class i have 2 static methods that looks like this
static execute({cmd, name}: { cmd: string, name: string }): Promise<{
stdout: string;
stderr: string;
}>
static execSpawn({cmd, name, args , options }: { cmd: string, name: string, args: Array<string>, options: object }): Promise<NodeJS.ReadableStream>
and a third method in witch the error is thrown from try to call them dynamicly
if (typeof firstDeferedCmd == object && ( firstDeferedCmd.type === execute || firstDeferedCmd.type === execSpawn )) {
ProcessPoolExecutor[firstDeferedCmd.type](firstDeferedCmd); // this line throw the error
}
and the error it self
Cannot invoke an expression whose type lacks a call signature. Type '(({ cmd, name }: { cmd: string; name: string; }) => Promise<{}>) | (({ cmd, name, args, options }...' has no compatible call signatures.
ProcessPoolExecutorfirstDeferedCmd.type;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~