plotly / plotly/angular-plotly.js

event handlers are not typed

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
242
Forks
81
Avg merge
8h 48m
Merged PRs (30d)
18

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in projects/plotly/src/lib/plotly.component.ts at the output declaration around line 80 and the emission around line 241. Trace the event payloads emitted by the plotlyClick output and give the outputs a usable TypeScript type broad enough for the chart data; done means consumers no longer see the event as void while the emitted data remains represented.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.