From cc7f013893f541342b37f30ce998ef636adbf10c Mon Sep 17 00:00:00 2001 From: Ryandi Tjia Date: Thu, 6 Jun 2019 09:18:12 +0700 Subject: [PATCH 1/2] =?UTF-8?q?Refine=20typing=20on=20createPages=E2=80=99?= =?UTF-8?q?=20graphql=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gatsby/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/gatsby/index.d.ts b/packages/gatsby/index.d.ts index 9d7d8f45a59e1..5786b05cd8d1d 100644 --- a/packages/gatsby/index.d.ts +++ b/packages/gatsby/index.d.ts @@ -600,7 +600,13 @@ export interface PluginOptions { export type PluginCallback = (err: Error | null, result?: any) => void export interface CreatePagesArgs extends ParentSpanPluginArgs { - graphql: Function + graphql( + query: string, + variables?: Record + ): Promise<{ + errors?: any + data?: TData + }> traceId: string waitForCascadingActions: boolean } From 25aaff62dc5cd26906819f24e1da249494932dc0 Mon Sep 17 00:00:00 2001 From: Ryandi Tjia Date: Thu, 6 Jun 2019 10:03:01 +0700 Subject: [PATCH 2/2] =?UTF-8?q?Further=20refinement=20to=20createPages?= =?UTF-8?q?=E2=80=99=20GraphQL=20fn=20to=20accept=20variables=20generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gatsby/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/index.d.ts b/packages/gatsby/index.d.ts index 5786b05cd8d1d..a49e08a832005 100644 --- a/packages/gatsby/index.d.ts +++ b/packages/gatsby/index.d.ts @@ -600,9 +600,9 @@ export interface PluginOptions { export type PluginCallback = (err: Error | null, result?: any) => void export interface CreatePagesArgs extends ParentSpanPluginArgs { - graphql( + graphql( query: string, - variables?: Record + variables?: TVariables ): Promise<{ errors?: any data?: TData