Skip to content

Commit 7d9a681

Browse files
committed
docs: use EdgeInput types in examples
1 parent 49645e6 commit 7d9a681

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ Now define a `ConnectionBuilder` class for your `Connection` object. The builder
8080
pagination arguments for the connection, and creating the cursors and `Edge` objects that make up the connection.
8181

8282
```ts
83-
import { ConnectionBuilder, Cursor, PageInfo, validateParamsUsingSchema } from 'nestjs-graphql-connection';
83+
import {
84+
ConnectionBuilder,
85+
Cursor,
86+
EdgeInputWithCursor,
87+
PageInfo,
88+
validateParamsUsingSchema,
89+
} from 'nestjs-graphql-connection';
8490

8591
export type PersonCursorParams = { id: string };
8692
export type PersonCursor = Cursor<PersonCursorParams>;
@@ -96,7 +102,7 @@ export class PersonConnectionBuilder extends ConnectionBuilder<
96102
return new PersonConnection(fields);
97103
}
98104

99-
public createEdge(fields: { node: TestNode; cursor: string }): TestEdge {
105+
public createEdge(fields: EdgeInputWithCursor<PersonEdge>): PersonEdge {
100106
return new PersonEdge(fields);
101107
}
102108

@@ -168,7 +174,12 @@ determining what the last result was on page 9.
168174
To use offset cursors, extend your builder class from `OffsetPaginatedConnectionBuilder` instead of `ConnectionBuilder`:
169175

170176
```ts
171-
import { OffsetPaginatedConnectionBuilder, PageInfo, validateParamsUsingSchema } from 'nestjs-graphql-connection';
177+
import {
178+
EdgeInputWithCursor,
179+
OffsetPaginatedConnectionBuilder,
180+
PageInfo,
181+
validateParamsUsingSchema,
182+
} from 'nestjs-graphql-connection';
172183

173184
export class PersonConnectionBuilder extends OffsetPaginatedConnectionBuilder<
174185
PersonConnection,
@@ -180,7 +191,7 @@ export class PersonConnectionBuilder extends OffsetPaginatedConnectionBuilder<
180191
return new PersonConnection(fields);
181192
}
182193

183-
public createEdge(fields: { node: TestNode; cursor: string }): TestEdge {
194+
public createEdge(fields: EdgeInputWithCursor<PersonEdge>): PersonEdge {
184195
return new PersonEdge(fields);
185196
}
186197

0 commit comments

Comments
 (0)