[backlog] add type assertion for client.query params when make api call
Open
@raylrui is already working on this.
Since Aug 29, 2024.
backlog
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 49m
- Merged PRs (30d)
- 4
Description
Query client params type should be dynamically assigned through the openapi path params
Temporary we add // @ts-expect-error to suppress ts check.
In the future, we will find a way to pass right type assertion for query params.
this issue is for all createFetchingHook with @tanstack/react-query
function createMetadataFetchingHook<K extends keyof paths>(path: K) {
return function ({ params, reactQuery }: UseSuspenseQueryOptions<paths[typeof path]['get']>) {
return useSuspenseQuery({
...reactQuery,
queryKey: [path, params],
queryFn: async ({ signal }) => {
// @ts-expect-error: params is dynamic type type for openapi-fetch
const { data } = await client.GET(path, { params, signal });
return data;
},
});
};
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.