I'm trying to use the library Chart.js in my Angular application with Typescript, but I'm getting the following error:
Error: Object literal may only specify known properties, and 'stepSize' does not exist in type 'TickOptions'.
Looking at the TickOptions interface, the property is really not present there, but it's on another interface that extends TickOptions, the interface LinearTickOptions:
interface LinearTickOptions extends TickOptions {
maxTicksLimit?: number;
stepSize?: number;
suggestedMin?: number;
suggestedMax?: number;
}
How to make Typescript look for the interface LinearTickOptions instead of TickOptions?
This is the code that shows the error:
new Chart(this.clientsPerMonthElement.nativeElement, {
type: 'line',
data: {
labels,
datasets: [{
data,
label: 'Clientes no mês',
backgroundColor: 'transparent',
borderColor: lineColor,
borderWidth: 2,
pointBackgroundColor: lineColor,
pointRadius: 4,
}],
},
options: {
legend: {
display: false,
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 1, // I'm getting an error here
},
}],
},
},
});