src/types/README.md
This directory documents the TypeScript conversion in progress.
| Doc | Audience |
|---|---|
| SETUP.md | First-time contributor — toolchain overview, npm scripts |
| ARCHITECTURE.md | Anyone working with types — directory layout, public/private split |
| CONVERTING_ATTRIBUTES.md | Contributor doing conversion work — step-by-step recipe |
| GENERATOR.md | Maintainer extending or debugging the type generator |
src/types/: ✅ doneAttributeMap validation machinery: ✅ donelib/index.d.ts, wired via package.json#types): ✅ donetypecheck + schema-typegen-diff-check): ✅ donesrc/fonts/ploticon.js — convert so DefaultIcons and IconsMap in
src/types/core/api.d.ts can be derived from the module
(type DefaultIcons = keyof typeof Ploticon) instead of maintained as a
hand-written union that can drift. Consumers need .default appended per the established
conversion pattern.
Add dimensionality to data_array in the JS attribute sources. The
schema's data_array valType carries no shape info, but several attributes
are genuinely 2D (heatmap/contour/contourcarpet z, surface z and
surfacecolor, 2D text/customdata/hovertext on those traces) or 3D
(image.z). The generator currently emits the loose union
Datum[] | Datum[][] | TypedArray for every data_array so 2D/3D usage
typechecks, but the trade-off is that 1D-only fields also accept 2D arrays.
The published consumer surface lives at lib/index.d.ts.
This src/types/ directory is the authoring location — internal types live
here, public types are re-exported through lib/index.d.ts to consumers.
The following are auto-generated from plot-schema.json by
tasks/generate_schema_types.mjs:
PlotType alias)Data discriminated union over all of them_internal namespace with helpers like _internal.Marker,
_internal.AutoRangeOptions that aren't meant as direct public surfaceRun npm run schema to regenerate. The output lives at
src/types/generated/schema.d.ts. See GENERATOR.md for
the generator's internals.
If you want to convert a component attribute file:
Each conversion is a single self-contained commit.