-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataTableFilterMeta TypeScript error #2196
Comments
Hopefully I hear back from someone soon as it appears TS is pretty broken (unless some issue my side). I also have issues with DataView.
Give TS error:
Code is from composition api example on primevue - DataView webpage |
Thanks for the great repo. It really helped. Please also create separate issues for different bugs. Regards, |
This is broken again in 3.24.0 after the typescript types were removed. Please reopen. |
The team decided to remove typescript types. You could see the breaking changes from here #3696 |
Thanks for the quick reply! I did see the breaking changes and it seemed intentional, but I didn't see the reason for it? I'm also not sure how we're supposed to use the filters with TypeScript now, do you have a suggestion? I assume PrimeVue is still intended to fully support TypeScript? |
Not fully supporting typescript is an issue and one of the reasons why I have been looking at other options besides vue which wasn't an easy decision. |
PrimeVue supports TypeScript but with some changes according to previous versions. I also asking following this issue #3727 Thanks for your understanding. |
I have the same issue... updated primevue today to 3.24.0 and getting the type error. import type { DataTableFilterMetaData } from 'primevue/datatable'
const filters = ref({
'global': { value: null as null | string, matchMode: FilterMatchMode.CONTAINS } as DataTableFilterMetaData,
'type': { value: null as null | Array<number>, matchMode: FilterMatchMode.IN } as DataTableFilterMetaData
}) |
@borsTiHD The way it worked here using the [col]: {
value: null,
matchMode: FilterMatchMode["CONTAINS"],
} as DataTableFilterMetaData, |
I didn't see a codesandbox template for primevue using typescript but here is github link to project demonstrating the issue https://github.com/colinbes/primevue-ts.
I have commented observations in the readme file.
Current Behavior
For primevue versions > 3.10.0 typescript projects fail to build as they fail typecript test - specifically in my case setting of filters for DataTable
<DataTable :value="actions" :rowHover="true" v-model:filters="filters"></DataTable>
this has type error for filters stating... is not assignable to type 'DataTableFilterMeta'
Note, that it is also unclear how to create a custom filter - included in example is custom filter for filter
program
- it is unclear how one is meant to define the matchMode for filter.Expected Behavior
Interfaces and type checking should work for standard FilterMatchMode.xxx as well as allow for defining custom matchMode names.
Reproduction of issue
Clone project https://github.com/colinbes/primevue-ts and follow instructions in README to install and run TSC (via npm run tsc)
Note, this problem does not appear to be related to only Vite as I could replicate exact same behavior creating project using vue-cli
The text was updated successfully, but these errors were encountered: