1

i am a learning typescript, recently moved from react, i am using chart js for some graph in my react-typescript project and from few hours i am getting this error

Property 'type' is missing in type '{ data: { labels: string[]; datasets: { label: string; data: number[]; fill: boolean; backgroundColor: string; borderColor: string; }[]; }; options: { scales: { yAxes: { ticks: { beginAtZero: boolean; }; }[]; }; }; }' but required in type 'Props' enter image description here

it would be great if anyone could help me out here THank you

1 Answer 1

1

Even though react-chartjs-2 is not expecting an type props for Line component and its value is assign to line by default, The interface used has the type props as required. Please find the interface here

Please pass the type prop to the link tag.

<line type='line' data={data} />
Sign up to request clarification or add additional context in comments.

3 Comments

Hey akhil, thank you so much man, u really are a life saviour
hi @Akshay98 , how does this work for doughnut? <Doughnut options={options} data={data} type="doughnut" /> Fails with the same error as OP
Try disabling Typescript for that line and check

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.