Error when customizing AjaxStore's encodeSorterParams
"With the code below I'm unable to run a build "npm run build". Is there a different approach to defining a custom sort encoder that can send params to the API? I will have the same question for encodeFilterParams as I'll need to modify params for filtering also.
It gives the error:
"Object literal may only specify known properties, and 'encodeSorterParams' does not exist in type 'AjaxStoreConfig'." "
Add to a Typescript (can be the React-Vite one) the following piece of code
new AjaxStore({
readUrl: `/api/accounts`,
autoLoad: true,
pageParamName: "page",
sortParamName: "sort",
filterParamName: "filter",
responseDataProperty: "data",
responseTotalProperty: "total",
encodeSorterParams: (sorters: any[]) => {
return sorters.map((sorter: any) => JSON.stringify({
property: sorter.field,
direction: sorter.ascending ? 'asc' : 'desc'
}));
},
})
It should allow overriding encodeSorterParams, but it gives the error that the user is mentioned.
encodeFilterParams may have the same issue
Probably need to document it as a config if it is intended to be overridden , for it to appear correctly in typings