Skip to content

Commit b4dea80

Browse files
committed
Loosen data_array type and update schema types
1 parent 87b6e0e commit b4dea80

3 files changed

Lines changed: 345 additions & 335 deletions

File tree

src/types/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ This directory documents the TypeScript conversion in progress.
2828
hand-written union that can drift. Consumers need `.default` appended per the established
2929
[conversion pattern](CONVERTING_ATTRIBUTES.md#L72-L86).
3030

31+
- **Add dimensionality to `data_array` in the JS attribute sources.** The
32+
schema's `data_array` valType carries no shape info, but several attributes
33+
are genuinely 2D (heatmap/contour/contourcarpet `z`, surface `z` and
34+
`surfacecolor`, 2D `text`/`customdata`/`hovertext` on those traces) or 3D
35+
(`image.z`). The generator currently emits the loose union
36+
`Datum[] | Datum[][] | TypedArray` for *every* `data_array` so 2D/3D usage
37+
typechecks, but the trade-off is that 1D-only fields also accept 2D arrays.
38+
3139
The published consumer surface lives at [`lib/index.d.ts`](../../lib/index.d.ts).
3240
This `src/types/` directory is the authoring location — internal types live
3341
here, public types are re-exported through `lib/index.d.ts` to consumers.

0 commit comments

Comments
 (0)