Type definition error: Type Date is not assignable to type `Annotations.x`
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
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!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从所引用行中 types/plotly.js/index.d.ts 的 Annotations.x 声明开始,然后将其类型与 Plotly 的 annotation 文档进行比较。确认类型定义接受日期轴的 Date 值,并使用与所报告案例相匹配的最小 TypeScript 用法验证结果。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100