-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Expected behavior
I expected TypeScript to accept options: { scales: { x: { type: "time", min: "2021-01-01", max: "2021-12-01" } } }.
Current behavior
Compiler errors:
Type '"time"' is not assignable to type '"timeseries" | undefined'.
Type 'string' is not assignable to type 'number | undefined'.
Reproducible sample
Optional extra steps/info to reproduce
Here's a codepen demonstrating that this works at runtime: https://codepen.io/StephanTLavavej/pen/RwjooGY
The Time Cartesian Axis > Date Formats documentation explains how string values are adapted:
When providing data for the time scale, Chart.js uses timestamps defined as milliseconds since the epoch (midnight January 1, 1970, UTC) internally. However, Chart.js also supports all of the formats that your chosen date adapter accepts.
And then it lists min and max as number | string.
Possible solution
No response
Context
I'm converting the microsoft/STL Status Chart, powered by Chart.js, to use TypeScript. 😸
chart.js version
v3.7.0
Browser name and version
Chrome 98.0.4758.81
Link to your project
No response