Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda