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

150
Views
Attempting to typecheck a function in Typescript

I am not sure how to describe my problem, but essentially I am attempting to type-check a function but I am unsure if my understanding is correct.

I have these props over here

  const { closeModal, productId, activeEnvironment } = props;

Now I already know that productId is a string and so is activeEnvironment, but closeModal is a function, now I figured this out by outputting it to the console in a console log statement.

This is what was outputted in the browser console.

 ƒ closeModal() {
  setManualBeatModalOpen(false);
}

Here is the usage of my ManualPulseModal

<ManualBeatForm
        productId={productId}
        closeModal={() => {
          setManualBeatModalOpen(false);
        }}
        activeEnvironment={activeEnvironment}
      />

Now how would I type check the closeModal variable do I need to use Dispatch....etc

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Since the closeModal has no parameters and no return value, you can type it simply as closeModal : () => void.

So you could have something similar to this (excluding the other props):

interface Props {
  closeModal : () => void
}

export function YourFunc(props : Props) {
  const { closeModal } = props;
  ...
}
about 4 years ago · Juan Pablo Isaza Report
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!