fix(column): add phantom of prop for typed slot inference#8485
Open
YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
Open
fix(column): add phantom of prop for typed slot inference#8485YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
YevheniiKotyrlo wants to merge 1 commit intoprimefaces:masterfrom
Conversation
This was referenced Mar 11, 2026
Open
This was referenced Mar 13, 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.
Defect Fixes
Fixes #8483
Column's
#body,#editor,#node, and#loadingslots are all typed asany. Even with DataTable'sTgeneric (#8444), Column is a separate component — Vue's type system cannot propagate parent component generics to child component slots.This affects the most common DataTable interaction: accessing row data in Column templates.
Related: #7426, #6041
Reproducer: StackBlitz —
bun run type-check(0 errors, typo undetected) →bun run patch && bun run type-check(TS2339 catches it)Problem
DataTable's
T(from #8444) types DataTable's own slots (#groupheader,#expansion), but cannot flow to Column — Vue provides no mechanism for parent generics to propagate to child component slots.Solution: phantom
ofpropAn opt-in
ofprop carries type information without affecting runtime:By binding
:of="orders"(the same array passed to DataTable's:value), TypeScript infersTfrom the array type and flows it to all slot scoped data. Theofprop is never read at runtime — it exists purely for TypeScript inference.Without
:of,Tdefaults toany— fully backward compatible. Adoption is opt-in per Column.Why
of?<Column :of="orders" field="name">Changes
ColumnSlots<T = any>—data: T,node: Tin body/node/editor/loading slots,field: (item: T) => stringnew <T = any>(props: ColumnProps & { of?: readonly T[] | T[] | null })readonly T[]supports read-only query results (e.g., Zero, TanStack Query)What gets typed
:of:of="orders"#bodydata/nodeanyT#nodedata/nodeanyT#editordataanyT#loadingdataanyT#bodyfieldcallback(item: any) => string(item: T) => stringScope / Impact
:of,Tdefaults toany(same as before)ofis never read by Column's runtime code:of="dataArray"only where they want typed slotsVerification
vue-tsc --noEmitwithstrictTemplates:of(backward compat)data: any, zero errors:of="orders"Tinference, autocomplete worksSeries
This is part of a series bringing generic type inference to all PrimeVue data components:
ofprop)