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

176
Views
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 answers
Answer question

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 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!