fix(virtualscroller,selectbutton,inputchips): enable generic type inference for items and slots#8493
Open
YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
Conversation
…Button, InputChips
This was referenced Mar 11, 2026
Open
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.
Defect Fixes
Fixes #8492
VirtualScroller, SelectButton, and InputChips use
anyfor their collection props and slot scoped data. These are the last three PrimeVue components where collection props flow to slots without generic type inference.Same root cause as #8442 —
DefineComponent's no-arg constructor prevents generic inference. Same fix pattern as #8444 (DataTable/DatePicker).Related: #7426, #6041
Reproducer: StackBlitz —
bun run type-check(0 errors, typo undetected) →bun run patch && bun run type-check(TS2339 catches it)Problem
After this fix, TypeScript infers
Tfrom the collection prop and flows it to all slots:Changes
VirtualScroller:
VirtualScrollerProps<T = any>:items?: T[] | T[][]VirtualScrollerSlots<T = any>: item slotitem: T, content slotitems: T[]SelectButton:
SelectButtonProps<T = any>:options?: T[], callbacks(data: T) => ...SelectButtonSlots<T = any>: option slotoption: TmodelValuestaysany—optionValueextracts a scalar, same reasoning as Select (fix(select,multiselect,listbox): enable generic type inference for options and slots #8484)InputChips:
InputChipsProps<T = any>:modelValue?: T[]InputChipsSlots<T = any>: chip slotvalue: TmodelValuebecomesT[]— items ARE the value (nooptionValue), same reasoning as OrderList (fix(orderlist,picklist): enable generic type inference for items and slots #8491)Each component uses the generic constructor pattern (
new <T>(props)) so TypeScript infersTautomatically.What gets typed
#itemslotitemanyT#contentslotitemsanyT[]#optionslotoptionanyToptionLabelcallback paramanyToptionValuecallback paramanyToptionDisabledcallback paramanyT#chipslotvalueanyTmodelValueany[]T[]Scope / Impact
Tdefaults toanyVerification
pnpm run format:checkpnpm run lintpnpm run test:unitpnpm run build:packages(primevue)@ts-expect-errorchecks)Series
This is the final PR in a series bringing generic type inference to all PrimeVue data components:
ofprop)After this series, every PrimeVue component with a collection prop infers
Tfrom the binding and flows it to slots — giving developers full IDE autocomplete and compile-time type safety in templates.