useTable Typing error is unkown

Getting full typing expect for error :
import { useTable } from "@pankod/refine-react-table"
...
const useTableMethods = useTable<ExpenseLaborAPI, HttpError>({
refineCoreProps: {
resource: ExpensesEnum.Labor,

initialFilter: [
{ field: "financialplan][id]", operator: "eq", value: selectedFinplan },
],

},
columns,
})

const {
refineCore: {
tableQueryResult: { data: tableData, error, isLoading, isSuccess, refetch },
},
} = useTableMethods
import { useTable } from "@pankod/refine-react-table"
...
const useTableMethods = useTable<ExpenseLaborAPI, HttpError>({
refineCoreProps: {
resource: ExpensesEnum.Labor,

initialFilter: [
{ field: "financialplan][id]", operator: "eq", value: selectedFinplan },
],

},
columns,
})

const {
refineCore: {
tableQueryResult: { data: tableData, error, isLoading, isSuccess, refetch },
},
} = useTableMethods
tableData, isLoading, isSuccess and refetch are correctly typed. error is unkown. How to get correct typing on error?
No description
No description
10 Replies
united-yellow
united-yellow3y ago
Hey @zomh, When you change the ‘HttpError’, do you still have unknown type? Could you try it?
rising-crimson
rising-crimsonOP3y ago
hello @salihozdemir you mean like this ? const useTableMethods = useTable<ExpenseLaborAPI>({ .... Its still unkown
united-yellow
united-yellow3y ago
I mean, whether it is ‘unknown’ when you give any type instead of HhtpError. If you have still issue, the first business day will disscuss this issue with team.
Omer
Omer3y ago
It seems we don't use generic error type in return type. Would you like to fix it? @zomh https://github.com/refinedev/refine/blob/next/packages/react-table/src/useTable/index.ts#L19
GitHub
refine/index.ts at next · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at next · refinedev/refine
rising-crimson
rising-crimsonOP3y ago
@Omer Thanks for the feedback. I am afraid i just learned typescript like 2 month ago. This exceeds my knowledge to be honest. Sorry gonna be honest 🥲
Omer
Omer3y ago
Don't worries. Could you create an issue? 🚀
rising-crimson
rising-crimsonOP3y ago
yes will do
Omer
Omer3y ago
We'll fix it monday
Omer
Omer2y ago
Hey @zomh , We've released @pankod/refine-react-table@4.9.1 🎯 Can you confirm that the problem is fixed? You can use CLI's update command for update 👊 https://refine.dev/docs/packages/documentation/cli/#update
CLI | refine
refine CLI is a command line application that allows you to interact with your refine project and perform some tasks. This includes creating a new resource, managing updates, swizzle components, and runs your project (build, start, dev).
rising-crimson
rising-crimsonOP2y ago
@Omer @salihozdemir confirmed fixed. thank you!

Did you find this page helpful?