Skip to content

Commit c5cfbf8

Browse files
authored
docs: move type after usage
1 parent 07ca234 commit c5cfbf8

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

docs/content/docs/4.utils/3.query-collection-item-surroundings.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@ description: The queryCollectionItemSurroundings composable looks for sibling
44
contents of an specific path.
55
---
66

7-
## Type
8-
9-
```ts
10-
function queryCollectionItemSurroundings<T extends keyof PageCollections>(
11-
collection: T,
12-
path: string,
13-
opts?: SurroundOptions<keyof PageCollections[T]>
14-
): ChainablePromise<T, ContentNavigationItem[]>
15-
16-
interface ChainablePromise<T extends keyof PageCollections, R> extends Promise<R> {
17-
where(field: keyof PageCollections[T] | string, operator: SQLOperator, value?: unknown): ChainablePromise<T, R>
18-
andWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
19-
orWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
20-
order(field: keyof PageCollections[T], direction: 'ASC' | 'DESC'): ChainablePromise<T, R>
21-
}
22-
```
23-
247
## Usage
258

269
Use the auto-imported `queryCollectionItemSurroundings` to find the previous and next items relative to a specific content item in a collection. This is particularly useful for creating navigation between related content pages.
@@ -41,6 +24,22 @@ const { data } = await useAsyncData('surround', () => {
4124
The `queryCollectionItemSurroundings` utility is available in both Vue and Nitro. Checkout [Server Usage](#server-usage) for more details on how to use it on the server side.
4225
::
4326

27+
## Type
28+
29+
```ts
30+
function queryCollectionItemSurroundings<T extends keyof PageCollections>(
31+
collection: T,
32+
path: string,
33+
opts?: SurroundOptions<keyof PageCollections[T]>
34+
): ChainablePromise<T, ContentNavigationItem[]>
35+
36+
interface ChainablePromise<T extends keyof PageCollections, R> extends Promise<R> {
37+
where(field: keyof PageCollections[T] | string, operator: SQLOperator, value?: unknown): ChainablePromise<T, R>
38+
andWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
39+
orWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
40+
order(field: keyof PageCollections[T], direction: 'ASC' | 'DESC'): ChainablePromise<T, R>
41+
}
42+
```
4443

4544
## API
4645

0 commit comments

Comments
 (0)