Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
How to create instance of callable interface in TypeScript?

I have an interface below with call signature inside it

type MyTest = {
  description: string;
  (x: number): number;
};

But I don't know how to create instance of this interface in TypeScript. I have tested 3 solution below and nothing worked

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.
}

Please give me an instruction for this problem. Thank a lot and have nice day!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!