Skip to content

Commit

Permalink
Enable connection example code to run in playground
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone committed Mar 24, 2024
1 parent b0fafef commit 0631059
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion website/docs/05-guides/snippets/connection-spec.grats.ts
@@ -1,5 +1,4 @@
import { Int } from "grats";
import { connectionFromArray } from "graphql-relay";

/** @gqlField */
export function users(
Expand Down Expand Up @@ -54,4 +53,16 @@ type User = {
/** @gqlField */
name: string;
};

// This function can be found in the module `graphql-relay`.
// Extracted here for example purposes.
declare function connectionFromArray<T>(
data: ReadonlyArray<T>,
args: {
first?: Int | null;
after?: string | null;
last?: Int | null;
before?: string | null;
},
): Connection<T>;
// trim-end
13 changes: 12 additions & 1 deletion website/docs/05-guides/snippets/connection-spec.out
@@ -1,5 +1,4 @@
import { Int } from "grats";
import { connectionFromArray } from "graphql-relay";

/** @gqlField */
export function users(
Expand Down Expand Up @@ -54,6 +53,18 @@ type User = {
/** @gqlField */
name: string;
};

// This function can be found in the module `graphql-relay`.
// Extracted here for example purposes.
declare function connectionFromArray<T>(
data: ReadonlyArray<T>,
args: {
first?: Int | null;
after?: string | null;
last?: Int | null;
before?: string | null;
},
): Connection<T>;
// trim-end

=== SNIP ===
Expand Down

0 comments on commit 0631059

Please sign in to comment.