diff --git a/docs/API.md b/docs/API.md index 13b9cc5..1b83249 100644 --- a/docs/API.md +++ b/docs/API.md @@ -841,7 +841,7 @@ Triggers the closest error boundary if the document cannot be found | Function | Type | | ---------- | ---------- | -| `useSingleDocByDocId` | `({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => Pick[D]["getByDocId"]>>>, "data" or ... 1 more ... or "isRefetching">` | +| `useSingleDocByDocId` | `({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => Pick[D]["getByDocId"]>>>>, "data" or ... 1 more ... or "isRefetching">` | Parameters: diff --git a/src/hooks/documents.ts b/src/hooks/documents.ts index c38d5d8..31219e9 100644 --- a/src/hooks/documents.ts +++ b/src/hooks/documents.ts @@ -57,7 +57,10 @@ export function useSingleDocByDocId({ lang?: string }): // NOTE: Needs explicit return type due to TS struggles with inference Pick< - UseSuspenseQueryResult>>, + UseSuspenseQueryResult< + // NOTE: Using NonNullable here to get the return type associated with the overload that uses `mustBeFound: true` + NonNullable>> + >, 'data' | 'error' | 'isRefetching' > { const { data: projectApi } = useSingleProject({ projectId })