event handlers are not typed

未关闭
#283 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@andrefarzat 已经在做这个了。

开始于 2026年10月13日。

  • #367 来自 @andrefarzat —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
frontend

调研方向

从 projects/plotly/src/lib/plotly.component.ts 中第 80 行附近的 output 声明和第 241 行附近的 emission 开始。跟踪 plotlyClick output 发出的事件 payload,并为 outputs 提供一个可用的 TypeScript 类型,使其范围足够覆盖图表数据;完成的标准是消费者不再将该事件视为 void,同时发出的数据仍得到表示。

由索引模型根据 Issue 内容生成。

描述

https://github.com/plotly/angular-plotly.js/blob/5201d97fc2e01e5533d08a921cd44e28265a9222/projects/plotly/src/lib/plotly.component.ts#L80

I was attempting to implement some drill down functionality in the charts in my dashboard. Unfortunately, when I bound a method in my component to the (plotlyClick) output, I noticed that the type of $event was void. But my component method typed the event as unknown anyway, and I console.log the event object, and there is a ton of information in there.

On this line: https://github.com/plotly/angular-plotly.js/blob/master/projects/plotly/src/lib/plotly.component.ts#L241

...I can see that the output indeed is emitting data, just like my logging indicated. Is there anyway we could get these outputs typed? I imagine that the type would be pretty broad due to the amount of different charts/maps out there. But TypeScript thinking that the output is void is probably worse then just not knowing what the event data looks like, but still acknowledging its existence.

主要语言
TypeScript
星标
242
派生
81
平均合并
23 小时 52 分钟
30 天内合并 PR
5

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

plotly/angular-plotly.js 的其他 Issue

查看 plotly/angular-plotly.js 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。