You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
table=headlessTable<Row>(this,{columns: ()=>this.args.columns,// this.args.columns: ColumnConfig<Row>[]data: ()=>this.args.data,// this.args.data: Row[]plugins: [RowSelection.with(()=>{return{selection: [],onSelect: (data)=>{// Parameter 'data' implicitly has an 'any' type.
...
},onDeselect: ()=>{},};}),],});
I would hope that the first data argument of onSelect hook would give me correct type on the first argument (data) and not any. Or what would be the correct TS usage?
Not sure, but I don't see how to pass generics through static methods in a way that would automatically infer the DataType from the table context. A possible solution may be to have a factory method pattern like RowSelection.for().with(...), but that does not help much in practice, as you'd still need to pass in the generic yourself.
Activity
NullVoxPopuli commentedon Oct 1, 2025
Yes, that is expected to work, and this not working is a bug. Thanks for reporting!
johanrd commentedon Oct 13, 2025
okay, I'm not sure this is an easy fix. Currently in src/plugins/-private/base.ts:106-111, the
withmethod signature is:table/table/src/plugins/-private/base.ts
Lines 106 to 111 in a667947
Not sure, but I don't see how to pass generics through static methods in a way that would automatically infer the DataType from the table context. A possible solution may be to have a factory method pattern like RowSelection.for().with(...), but that does not help much in practice, as you'd still need to pass in the generic yourself.