rlei-odes commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5382342309
Thanks for the flag — I checked this against ECharts and I believe the
current schema is correct, so I'd like to leave it as is.
ECharts types the option as a per-element union rather than a uniform one:
```ts
// echarts/types/dist/shared.d.ts
declare type DecalDashArrayX = number | (number | number[])[];
```
which is what `z.union([z.number(), z.array(z.union([z.number(),
z.array(z.number())]))])` models.
Mixed nesting is intentional rather than malformed. From
`normalizeDashArrayX` in `echarts/lib/util/decal.js`:
```js
/**
* [20, 5] should be normalized into [[20, 5]],
* while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]
*/
```
The loop below it branches per element — a number becomes a `[n, n]` row, an
array becomes that row's dash pattern — so `[1, [2, 3]]` describes two rows
with different patterns.
Narrowing to `number | number[] | number[][]` would reject that and make the
allowlist stricter than ECharts itself, which runs against the intent of this
PR. The schema mirrors `DecalObject` exactly, in the same way `lineStyleSchema`
mirrors its own type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]