feat(core): type the remaining json-render catalog components' props - #493
Merged
Merged
Conversation
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
dvcolomban
force-pushed
the
feat/json-render-typed-catalog
branch
from
July 28, 2026 17:02
0e16147 to
966e126
Compare
Extends the Card/Stack/Tabs pattern to the other 12 registered components (Text, Badge, Button, Icon, Divider, TextInput, Switch, KeyValueTable, DataTable, CodeBlock, Progress, Tree): each now co-locates and exports its own `Props` interface, and uses `registryProps<Type, Props>()` instead of the untyped `props: ['element', 'emit', ...]` array form, so `defineComponent` infers `setup`'s `ctx.element.props` as the component's own type. All `*Props` types are re-exported from the client webcomponents entry (`@vitejs/devtools/client/webcomponents`, already public) as opt-in strict types, alongside `Card`/`Stack`/`Tabs` from the sibling PRs — the base catalog's full typed surface once all land. Two components lost a redundant runtime cast now that their props are actually typed: `Badge`'s `colors[variant as keyof typeof colors]` and `DataTable`'s `col: any`/`row: any` map-callback annotations, both no longer necessary once `variant`/`columns`/`rows` carry real types end to end.
dvcolomban
force-pushed
the
feat/json-render-typed-catalog
branch
from
July 28, 2026 17:14
966e126 to
5ecb47e
Compare
dvcolomban
marked this pull request as ready for review
July 28, 2026 17:21
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.
Summary
Extends the co-located-
Propstyping pattern (introduced alongsideTabsin #492) to the rest of the base catalog:Badge,Button,CodeBlock,DataTable,Divider,Icon,KeyValueTable,Progress,Switch,Text,TextInput,Tree.*Propsinterface, co-located in its own file, and switches from the untypedprops: ['element', 'emit', ...]array form toregistryProps<Type, Props>()— this also letsdefineComponent'ssetup(ctx, ...)inferctxcorrectly instead of leavingelement.propsan untypedRecord<string, any>.*Propstypes are re-exported from the existing publicwebcomponents/index.tsbarrel, alongsideJsonRenderElement, so consumers can opt intoJsonRenderElement<'DataTable', DataTableProps>without pulling in@vitejs/devtools-kit.DataTableColumn/DataTablePropsnarrow a couple of previously-manual casts (e.g.DataTable's column mapping) into proper inference.Buttonkeeps its runtimeVARIANTS.has(variant)guard unchanged even thoughvariantis now typed asBaseVariant— defensive check stays for specs authored without the types.Screenshots
No visual/runtime change — this is types only. See
pnpm run typecheckin the test plan below.Test plan
pnpm run lintpnpm run typecheck