0

I am using NextJs and typescript and I when I pass a correctly typed prop the error i get is:

./pages/jobs.tsx:100:15
Type error: Type '{ job: jobType; key: number; handleTagClick: (tag: string) => void; }' is not assignable to type 'IntrinsicAttributes & jobType'.
  Property 'job' does not exist on type 'IntrinsicAttributes & jobType'.

   98 |           filteredJobs.map((job) => (
   99 |             <JobComponent
> 100 |               job={job}
      |               ^
  101 |               key={job.id}
  102 |               handleTagClick={handleTagClick}
  103 |             />
error Command failed with exit code 1.

The code is here: https://github.com/samrath2007/Internova

1 Answer 1

1

JobComponent is typed as if it receives multiple arguments, but you likely meant for this to be one props object.

Currently:

const JobComponent = (job: jobType, handleTagClick: Function) => {}

What it should be:

type Props = { job: jobType, handleTagClick: Function };

const JobComponent = ({job, handleTagClick}: Props) => {}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.