diff --git a/index.d.ts b/index.d.ts index 13396202..c31b6fd5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -629,7 +629,7 @@ declare namespace mercurius { /** * Return the query for a given hash. */ - getQueryFromHash: (hash: string) => Promise; + getQueryFromHash: (hash: string) => Promise; /** * Return the hash for a given query string. Do not provide if you want to skip saving new queries. */ diff --git a/test/types/index.ts b/test/types/index.ts index 4e863989..39e4b8b6 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -654,3 +654,36 @@ expectType(ErrorWithProps) expectType(defaultErrorFormatter) expectType(persistedQueryDefaults) expectType(withFilter) + +app.register(mercurius, { + schema, + resolvers, + persistedQueryProvider: { + ...persistedQueryDefaults.automatic(), + getQueryFromHash: () => { + return Promise.resolve('foo') + }, + } +}) + +app.register(mercurius, { + schema, + resolvers, + persistedQueryProvider: { + ...persistedQueryDefaults.automatic(), + getQueryFromHash: () => { + return Promise.resolve(undefined) + }, + } +}) + +expectError(app.register(mercurius, { + schema, + resolvers, + persistedQueryProvider: { + ...persistedQueryDefaults.automatic(), + getQueryFromHash: () => { + return Promise.resolve(false) + }, + } +}))