Type definition error: Type `{ matches: string; }` is not assignable to type `Partial<LayoutAxis>`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
Hi,
I am getting a typescript error when I try to set 'y' in LayoutAxis.matches.
If I ignore this error and run the program, the y2 axis is as expected.
Environments
"plotly.js":"2.28.0""@types/plotly.js":"2.12.32"
Declared here
Axis: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/index.d.ts#L572
LayoutAxis: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/index.d.ts#L832
Document
https://plotly.com/javascript/reference/layout/yaxis/#layout-yaxis-matches
matches
Parent: layout.yaxis
Type: enumerated , one of ( "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" | "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" )
If set to another axis id (e.g.x2,y), the range of this axis will match the range of the corresponding axis in data-coordinates space. Moreover, matching axes share auto-range values, category lists and histogram auto-bins. Note that setting axes simultaneously in both ascaleanchorand amatchesconstraint is currently forbidden. Moreover, note that matching axes must have the sametype.
SS
Thank you for the support!
Contributor guide
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.
Research direction
Start with the Axis and LayoutAxis declarations linked in types/plotly.js/index.d.ts at lines 572 and 832, then compare them with the documented layout.yaxis.matches values. Confirm that the reported y value is accepted by the type definition and verify the declaration with a TypeScript example using the Plotly 2.28.0 environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100