I have the following code:
export interface IStartCreate1 {
(desc?: string, opts?: IDescribeOpts, arr?: Array<string | IDescribeOpts | TCreateHook>, fn?: TCreateHook): void;
tooLate?: boolean;
}
export interface IStartCreate2 {
(opts?: IDescribeOpts, arr?: Array<string | IDescribeOpts | TCreateHook>, fn?: TCreateHook): void;
tooLate?: boolean;
}
export interface IStartCreate3 {
(arr?: Array<string | IDescribeOpts | TCreateHook>, fn?: TCreateHook): void;
tooLate?: boolean;
}
export interface IStartCreate4 {
(fn: TCreateHook): void;
tooLate?: boolean;
}
export type IStartCreate = IStartCreate1 | IStartCreate2 | IStartCreate3 | IStartCreate4;
Then I have an object like so:
const v = {
create: function(){} as IStartCreate
}
v.create([]);
I get this error message:
Cannot invoke an expression whose type lacks a call signature.
I would think an empty array would match IStartCreate3
I have looked at other SO questions with a similar error message and I cannot figure this one out!