Tengo una interfaz a continuación con la firma de llamada dentro
type MyTest = { description: string; (x: number): number; };Pero no sé cómo crear una instancia de esta interfaz en TypeScript. He probado 3 soluciones a continuación y nada funcionó
const test1: MyTest = { description: 'My Name' // error: Type '{ description: string; }' provides no match for the signature '(x: number): number'. } const test2: MyTest = (myNumberInput: number) => myNumberInput.toString(); // error: Property 'description' is missing in type '(myNumberInput: number) => string' but required in type 'MyTest'. const test3: MyTest = { description: 'My Name', // error: Type '{ description: string; }' has no call signatures. (myNumberInput: number) => myNumberInput.toString() // error: Cannot find name 'myNumberInput'. + 'number' only refers to a type, but is being used as a value here. }Por favor, dame una instrucción para este problema. ¡Muchas gracias y que tengas un buen día!