fix!: resolve SelectItem barrel export collision in favor of the component#395
Merged
Conversation
…onent The barrel exported the name SelectItem twice via star exports: the new SelectItem React component and the deprecated SelectItem type re-exported from @vaadin/select (deprecated in favor of SelectItemData in vaadin/web-components#12132). TypeScript resolved the duplicate to the first star export, breaking `SelectItem` in type positions (TS2749) and leaving resolution dependent on barrel line order. The generated barrel now emits explicit component re-exports after the star exports, so each component name deterministically resolves to the component. Adds a tsc-based regression fixture (test/typings/SelectItem.tsx) that compiles against the built @vaadin/react-components barrel and would have caught this: SelectItem in value/JSX position, SelectItemData in type position, and a @ts-expect-error asserting the deprecated type is no longer importable from the barrel root. BREAKING CHANGE: the deprecated TypeScript type SelectItem is no longer exported from the package barrel; use SelectItemData instead, or import the deprecated type from @vaadin/react-components/Select.js. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
web-padawan
force-pushed
the
fix/select-item-data
branch
from
July 24, 2026 09:53
f5959d9 to
1e7381e
Compare
vursen
approved these changes
Jul 24, 2026
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.
Problem
Since #390 added the
SelectItemReact component, the package barrel exports the nameSelectItemtwice viaexport *chains:export * from "./SelectItem.js"→ the new React component (value)export * from "./Select.js"→export * from "@vaadin/select/vaadin-select.js"→ the deprecatedtype SelectItem = SelectItemDataalias (deprecated in feat: make select-item and select-list-box public, add SelectItemData web-components#12132)TypeScript resolves the duplicated name to the first star export, so
SelectItemin type position now fails in consumer projects:Resolution was also order-dependent (barrel line order follows schema-discovery order), so a reordering could have silently broken the component import instead. The repo's own
validate:typesnever catches this because the barrel is emitted directly asindex.d.ts/index.jsand never compiled as source.Change
export { X } from './X.js';per component after the star exports. Explicit exports beat star exports per-name, so each component name deterministically resolves to the component, independent of barrel order.test/typings/SelectItem.tsx, compiled byvalidate:types) asserting:SelectItemworks as a JSX component from the barrel,SelectItemDataworks in type position,SelectItemin type position is an error, and the deprecated type remains importable from@vaadin/react-components/Select.js.SelectItemDatawas already re-exported transitively and keeps working unchanged; docs examples were migrated in vaadin/docs#5831. Runtime is unaffected — the collision was type-only.BREAKING CHANGE
The deprecated TypeScript type
SelectItemis no longer exported from the package barrel; useSelectItemDatainstead, or import the deprecated type from@vaadin/react-components/Select.js.SelectItemnow refers to the React component. (In practice this break already shipped with 25.3.0-alpha6, where the component shadowed the type — this change makes the resolution deterministic and documented.)🤖 Generated with Claude Code