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
I am unable to set filter match mode for DataTable with vue-tsc showing error:
src/components/Test.vue:9:64 - error TS2322: Type 'string' is not assignable to type 'DataTableFilterMatchModeType'.
Simple code example demonstrates issue with setting up matchMode.
<script setup lang="ts">
import all from 'primevue/api'
import { DataTableFilterMetaData } from 'primevue/datatable'
import { FilterMatchMode } from 'primevue/api'
const filterMetaData1: DataTableFilterMetaData = {value: null, matchMode: 'equals'}
const filterMetaData2: DataTableFilterMetaData = {value: null, matchMode: FilterMatchMode.EQUALS}
</script>
filterMetaData1 gives no tsc error
filterMetaData2 gives tsc error shown below:
❯ npm run tsc
> my-vue-app@0.0.0 tsc
> vue-tsc --noEmit
src/components/Test.vue:7:64 - error TS2322: Type 'string' is not assignable to type 'DataTableFilterMatchModeType'.
7 const filterMetaData2: DataTableFilterMetaData = {value: null, matchMode: FilterMatchMode.EQUALS}
~~~~~~~~~
node_modules/primevue/datatable/DataTable.d.ts:58:5
58 matchMode: DataTableFilterMatchModeType;
~~~~~~~~~
The expected type comes from property 'matchMode' which is declared here on type 'DataTableFilterMetaData'
Found 1 error.
I have traced issue back to 9a9ae86 where interfaces were modified. All in all I like the idea but in my case it doesn't work. I assume others must also be having the issue.
If I roll primevue back to 3.9.1 then build and tsc work (note I have tried creating project with vite and vue-cli - in all cases with typescript support.
colinbes
changed the title
Type 'string' is not assignable to type 'DataTableFilterMatchModeType'.
Broken DataTable filter - Type 'string' is not assignable to type 'DataTableFilterMatchModeType'.
Feb 18, 2022
I am unable to set filter match mode for DataTable with vue-tsc showing error:
src/components/Test.vue:9:64 - error TS2322: Type 'string' is not assignable to type 'DataTableFilterMatchModeType'.
Simple code example demonstrates issue with setting up matchMode.
filterMetaData1 gives no tsc error
filterMetaData2 gives tsc error shown below:
package.json
The text was updated successfully, but these errors were encountered: