Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG]: incorrect `downloadImage` type definition

Open Beginner friendly
#8,072 0 comments 0 reactions 0 assignees View on GitHub

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
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

bug
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

  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.

More from plotly/plotly.js

All issues in plotly/plotly.js

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.