Type definition error: Type Date is not assignable to type `Annotations.x`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
Hi,
I'm getting typescript error when trying to set Date object for Annotations.x in axis type is date chart.
Note that if you ignore this error and run the program, the position of the X in the annotation will be as expected.
Environments
"plotly.js":"2.28.0""@types/plotly.js":"2.12.32"
Declared here
Document
https://plotly.com/javascript/reference/layout/annotations/#layout-annotations-items-annotation-x
x
Parent: layout.annotations[]
Type: number or categorical coordinate string
Sets the annotation's x position. If the axistypeis "log", then you must take the log of your desired range. If the axistypeis "date", it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axistypeis "category", it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.
SS
Thank you for the support!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Annotations.x declaration in types/plotly.js/index.d.ts at the referenced lines, then compare its type with the Plotly annotation documentation. Confirm that a Date value for a date axis is accepted by the type definition, and validate the result with a minimal TypeScript usage matching the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100