-
-
Couldn't load subscription status.
- Fork 10.7k
Closed
Labels
feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yetUsed to close PRs that haven't gone through/been accepted the Proposal process yet
Description
What is the new or updated feature that you are suggesting?
When using defer in loader:
const loader = (client: QueryClient) => {
return async () => {
return defer({
todos: fetch('https://jsonplaceholder.typicode.com/todos/1')
});
};
};The data property returned by defer is Record<string, unknown> and cannot be typed properly:
return defer({ todos: fetch('http://jsonplaceholder.com')}) as { data: { todos: { userId: number; id: number; title: string; } }}
will result an error Types of property 'data' are incompatible.
Allowing this syntax would solve it:
defer<{ userId: number; id: number; title: string; }>(fetch('https://jsonplaceholder.typicode.com/todos/1'));and the return type of defer will be:
{ data: T } (where T is the generic)Why should this feature be included?
Allowing proper typing for defer result.
Metadata
Metadata
Assignees
Labels
feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yetUsed to close PRs that haven't gone through/been accepted the Proposal process yet