Skip to content

Commit

Permalink
docs: Minor RestEndpoint typing explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Sep 23, 2023
1 parent 796fd81 commit 9d2d722
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/rest/api/RestEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,17 @@ import { Todo } from './Todo';
const getTodo = new RestEndpoint({ path: '/', schema: Todo });
// Hover your mouse over 'todo' to see its type
const todo = useSuspense(getTodo);

async () => {
const ctrl = useController();
const todo2 = await ctrl.fetch(getTodo);
};
```

</TypeScriptEditor>

[process](#process) determines the resolution value when the endpoint is called directly. Otherwise this will be `any` to
ensure compatibility.
[process](#process) determines the resolution value when the endpoint is called directly. For
`RestEndpoints` without a schema, it also determines the return type of [hooks](/docs/api/useSuspense) and [Controller.fetch](/docs/api/Controller#fetch).

<TypeScriptEditor>

Expand Down

0 comments on commit 9d2d722

Please sign in to comment.