Type definition for CodePane's highlightRanges parameter is incomplete
Closed this issue · 4 comments
Describe the Problem
The docs for CodePane allow for passing an array of arrays for the highlightRanges
parameter, as indicated by the example [[6, 8], [10, 15]]
. However, this usage pattern doesn't compile with the current typescript definition highlightRanges?: number | number[]
.
What's missing is another alternative: highlightRanges
can also be a number[][]
Additional Information
Is it okay to submit a PR for simple changes like this or do you prefer issue reports?
I reflected about this some more, and actually the type can be refined even more: Since only two-element arrays or single-element entries are allowed, the number[]
alternative could be replaced by (number | [number, number])[]
.
This would allow highlightRanges={[[1,5], [7,11], 13]}
and highlightRanges={[[13,15],17]}
, but not highlightRanges={[[1,5,3]]}
and neither highlightRanges={[[13]]}
.
I think #991 addresses this issue.