[BUG]: incorrect `downloadImage` type definition
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- documentation
Research direction
The issue points to the type definition for downloadImage in the TypeScript definitions. Check the source file src/snapshot/download.js to see how opts is handled (it allows nullish values). Then update the TypeScript definition to make the opts parameter optional, matching the behavior of toImage. Verify by testing the change with a simple TypeScript compilation.
Written by the indexing model from the issue text.
Description
Description
I'm happy to see type definitions about image export features were improved in recent PR #8066. Let me point out a minor type problem that (I think) remains after the PR.
The second parameter opts in downloadImage() function is required but I think it should be optional. That in toImage() is optional.
export function downloadImage(root: RootOrData, opts: DownloadImgopts): Promise<string>;
Because of this, a TS compiler complains about Plotly.downloadImage('graphDiv'), while it works as JS code. It seems the source code (src/snapshot/download.js) allows opts to be nullish.
There is a workaround such as calling Plotly.downloadImage('graphDiv', {}), and so this problem is not serious. I would be happy if it were fixed in future.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 21
Getting set up
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.
More from plotly/plotly.js
-
chore P3 plotly-internal size: 3 task
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
chore P1 plotly-internal size: 1 task
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
chore P3 plotly-internal size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
plotly/plotly.js#7648 · 3 comments ·
Maintainers usually reply within 1 day
-
bug infrastructure P2
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 1 day
All issues in plotly/plotly.js
Similar issues
-
curriculum documentation quality
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
githubnext/gh-aw-workshop#3897 ·
Maintainers usually reply within 2 days
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
check:failed feeds:add
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
iptv-org/database#36179 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day