fix(orderlist,picklist): enable generic type inference for items and slots#8491
Open
YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
Open
fix(orderlist,picklist): enable generic type inference for items and slots#8491YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
Conversation
…slots Make OrderListProps/Slots and PickListProps/Slots generic on T, inferred from the modelValue binding. Unlike Select family, modelValue IS the full item array (no optionValue extraction), so modelValue becomes T[]. OrderList item/option slots get T, PickList item/option slots get T. PickList modelValue is T[][] (source + target arrays).
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 #8488
OrderList and PickList use
anyfor their modelValue and slot scoped data. Unlike the Select family (#8484), these components'modelValueIS the full item array — there is nooptionValueextraction. This meansmodelValueitself becomesT[]/T[][], providing end-to-end type safety from binding to slot.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 thev-modelbinding and flows it to all slots:Changes
OrderListProps<T = any>—modelValue: T[],selection: T[]OrderListSlots<T = any>—item: T,option: TPickListProps<T = any>—modelValue: T[][],selection: T[][]PickListSlots<T = any>—item: T,option: TDefineComponentWhy
modelValuebecomesT[]hereIn Select/MultiSelect (#8484),
modelValuestaysanybecauseoptionValueextracts a scalar — the value type differs from the option type. OrderList and PickList have nooptionValueextraction. The items inmodelValueARE the option objects, somodelValue: T[]is correct and gives full round-trip type safety.What gets typed
modelValueany[]T[]selectionany[]T[]#option/#itemdataanyTmodelValueany[][]T[][]selectionany[][]T[][]#option/#itemdataanyTScope / Impact
Tdefaults toanyVerification
pnpm run format:checkpnpm run lintpnpm run test:unitpnpm run build:packagesSeries
This is part of a series bringing generic type inference to all PrimeVue data components:
ofprop)After this series, every PrimeVue component with a collection prop will infer
Tfrom the binding and flow it to slots — giving developers full IDE autocomplete and compile-time type safety in templates.