From c4e32d92f1f33c6f20a0f885a26c5e2d76ff9f3f Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 26 Nov 2021 15:22:01 -0800 Subject: [PATCH] Fix Typescript error with caching + new Apollo Okay, right, I guess the Apollo Server upgrade broke type checking in our weird cache control hacks! This should force them to be compatible! --- src/server/lib/apollo-cache-control-fork.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/lib/apollo-cache-control-fork.ts b/src/server/lib/apollo-cache-control-fork.ts index e9e6747..04cad60 100644 --- a/src/server/lib/apollo-cache-control-fork.ts +++ b/src/server/lib/apollo-cache-control-fork.ts @@ -122,7 +122,6 @@ export const plugin = ( willSendResponse(requestContext) { const { response, - // @ts-ignore: FORK. Don't know enough TypeScript to resolve this! overallCachePolicy: overallCachePolicyOverride, } = requestContext; @@ -133,12 +132,13 @@ export const plugin = ( // Use the override by default, but if it's not overridden, set our // own computation onto the `requestContext` for other plugins to read. - const overallCachePolicy = + // FORK: I do an `any` cast here to convince Typescript that our + // CacheHint type is compatible with the built-in one. + const overallCachePolicy: Required | undefined = overallCachePolicyOverride || - // @ts-ignore: FORK. Don't know enough TypeScript to resolve this! - (requestContext.overallCachePolicy = computeOverallCachePolicy( + ((requestContext.overallCachePolicy = computeOverallCachePolicy( hints - )); + )) as any); if ( overallCachePolicy &&