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.
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
optsindownloadImage()function is required but I think it should be optional. That intoImage()is optional.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) allowsoptsto 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.