TreeTable and DataTable | Typescript Definition Bug for global Filters #2378
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
filters
injected into theTreeTable
component should be a key-value object following the documentation. The global filter is supposed to use the keyglobal
. The code concerning the global filter suggests the same: https://github.com/primefaces/primevue/blob/master/src/components/treetable/TreeTable.vue#L564However the type definition defines
filters
asTreeTableFilterMeta
:https://github.com/primefaces/primevue/blob/master/src/components/treetable/TreeTable.vue#L564
That interface defines the keys as
[key: string]: TreeTableFilterMetaData | TreeTableOperatorFilterMetaData;
. Those values would be objects.I am not sure about local filtering (except for the discrepancy to the docs), but it is not the correct definition for the global filter.
I'm submitting a ... (check one with "x")
Current behavior
if I define
filters
asTreeTableFilterMeta
, I cannot setfilters["global"]
without getting an TS2322 Typescript error.If I define
filters
as{ global?: string }
(because I just need the global filter) I get the TS2322 Typescript errorType '{ global?: string | undefined; }' is not assignable to type 'TreeTableFilterMeta'.
(Type 'string' is not assignable to type 'TreeTableFilterMetaData | TreeTableOperatorFilterMetaData'.)Expected behavior
Either I have a typescript definition that I could use or I use my own.
Please tell us about your environment:
Workaround
I used the following workaround for the global filter:
I created the file
primevue.d.ts
(name should not matter, I put it insrc/types/
):(Note: it only solves the global filter, I did not check the column filters)
The text was updated successfully, but these errors were encountered: