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

171
Vistas
Unsure of correct type and using 'any' causes compile error due to type-safety

I have this in my Landing.tsx:

<Pless handleClose={this.hidePless} showPless={this.state.showPlessPrompt} />

hidePless = () => {
this.setState({ showPlessPrompt: false });
};

In my Pless.tsx I have:

interface Props {
    handleClose: any;
    showPless: boolean;
}

export class Pless extends React.Component<Props> {
    constructor(props: Props) {
        super(props);
    }
    ...
}

When I run my application I get this:

Failed to compile. C:/Users/.../Paperless.tsx (6,18): Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.

Most likely a silly question but what should the type be?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is a void function as you are not returning anything from it, just doing something inside of it.

interface Props {
    handleClose: () => void;
    showPless: boolean;
}

Should keep the typescript compiler happy.

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