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

121
Views
TS7006: Parameter 'copyMe' implicitly has an 'any' type

I'm trying to create a button which copies into clipboard content from variable using TypeScript. I tried this:

const [copySuccess, setCopySuccess] = useState('');

const copyToClipBoard = async copyMe => {
    try {
        await navigator.clipboard.writeText(copyMe);
        setCopySuccess('Copied!');
    } catch (err) {
        setCopySuccess('Failed to copy!');
    }
};

Button to call above code:

<Button                                    
    onClick={() => copyToClipBoard('some text to copy')}
>
    Copy Url
</Button>

I get error:

TS7006: Parameter 'copyMe' implicitly has an 'any' type.

Do you know how I can fix this issue?

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

0

Add an annotation:

const copyToClipBoard = async (copyMe: string) => {
    try {
        await navigator.clipboard.writeText(copyMe);
        setCopySuccess('Copied!');
    } catch (err) {
        setCopySuccess('Failed to copy!');
    }
};
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!