Add chart-discriminated Vega-Lite authoring types - #131
Open
Alper Sarikaya (yelper) wants to merge 7 commits into
Open
Alper Sarikaya (yelper) wants to merge 7 commits into
Alper Sarikaya (yelper) wants to merge 7 commits into
Conversation
Keep upstream docs/reference-vegalite.md (regenerated) so QR/Discord changes merge cleanly. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Alper Sarikaya (yelper)
requested a review
from Chenglong Wang (Chenglong-MS)
September 24, 2026 21:47
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a PR only to concretize the acceptable
chartPropertiesoptions available to individual chart types. This is needed becauseChartAssemblyInputaccepts arbitrary chart names and properties, so TypeScript cannot catch misspelled options or properties used with the wrong chart.What did you do?
Add opt-in
VegaLiteChartType,VegaLiteChartPropertiesMap, andVegaLiteChartSpecexports generated from the live registry. Preserve native fields and runtime compatibility, with build integration, drift checks, consuming TypeScript fixtures, and authoring documentation.Changes
Add three opt-in, type-only exports from
flint-chartandflint-chart/vegalite:VegaLiteChartType: names from the live Vega-Lite registry.VegaLiteChartPropertiesMap: chart-specific property shapes derived from template properties and encoding-action controls.VegaLiteChartSpec: a chart-discriminated union for authoring withsatisfies, preserving native titles, sizes, and encodings.The types preserve literal option values, registered tuples, and explicit
undefineddefaults. They include the supportedfacetColumnsand deprecatedshowTextLabelsinputs while excluding data-dependent transition IDs. ExistingChartAssemblyInput, runtime signatures, and assembly behavior remain unchanged.Build integration
The generated types are checked into source control.
npm run gen:chart-types -w packages/flint-jsregenerates them directly from the source registry using an in-memory esbuild bundle, so generation does not depend on an existingdistbuild.The package build runs generation before tsup emits JavaScript and declarations. CI checks generated-file drift before building, preventing regeneration from masking stale checked-in output. After building, a dedicated TypeScript project checks the public package entrypoints with
skipLibCheck: falseandexactOptionalPropertyTypes: true; this check also runs before publishing.Why did you do it this way?
An alternative approach is to generate a schema (maybe JSON), but this isn't naturally consumed by downstream consumers and tool builders.