I have the following code.
interface MySecondInterface<A>{
type: A;
}
interface MyInterface {
(val1:string, val2:string): MySecondInterface<string>;
(): MySecondInterface<string>;
}
const myInterfaceFn: MyInterface = (value1: string, value2:string) => {
return {
type: value1 + value2
};
}
const myInterfaceFn2: MyInterface = () => {
return {
type: "Text"
};
}
You can find the code here. I am getting error
Type '(value: string) => { type: string; }' is not assignable to type 'MyInterface'.
How will I create the interface to support both method signatures?
Basically, an interface for a function that takes either 2 arguments or no arguments. How can I do that?