fix TypeScript build errors

That's what I get for forking a TS file, not knowing TS, and ignoring the errors lol :p
This commit is contained in:
Emi Matchu 2021-02-02 19:20:02 -08:00
parent d3b9f72e67
commit cee5e128cb

View file

@ -35,6 +35,7 @@ export interface CacheControlExtensionOptions {
declare module 'graphql/type/definition' { declare module 'graphql/type/definition' {
interface GraphQLResolveInfo { interface GraphQLResolveInfo {
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
cacheControl: { cacheControl: {
setCacheHint: (hint: CacheHint) => void; setCacheHint: (hint: CacheHint) => void;
cacheHint: CacheHint; cacheHint: CacheHint;
@ -45,6 +46,7 @@ declare module 'graphql/type/definition' {
declare module 'apollo-server-types' { declare module 'apollo-server-types' {
interface GraphQLRequestContext<TContext> { interface GraphQLRequestContext<TContext> {
// Not readonly: plugins can set it. // Not readonly: plugins can set it.
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
overallCachePolicy?: Required<CacheHint> | undefined; overallCachePolicy?: Required<CacheHint> | undefined;
} }
} }
@ -60,7 +62,9 @@ export const plugin = (
function setOverallCachePolicyWhenUnset() { function setOverallCachePolicyWhenUnset() {
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
if (!requestContext.overallCachePolicy) { if (!requestContext.overallCachePolicy) {
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
requestContext.overallCachePolicy = computeOverallCachePolicy(hints); requestContext.overallCachePolicy = computeOverallCachePolicy(hints);
} }
} }
@ -136,6 +140,7 @@ export const plugin = (
willSendResponse(requestContext) { willSendResponse(requestContext) {
const { const {
response, response,
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
overallCachePolicy: overallCachePolicyOverride, overallCachePolicy: overallCachePolicyOverride,
} = requestContext; } = requestContext;
@ -148,6 +153,7 @@ export const plugin = (
// own computation onto the `requestContext` for other plugins to read. // own computation onto the `requestContext` for other plugins to read.
const overallCachePolicy = const overallCachePolicy =
overallCachePolicyOverride || overallCachePolicyOverride ||
// @ts-ignore: FORK. Don't know enough TypeScript to resolve this!
(requestContext.overallCachePolicy = (requestContext.overallCachePolicy =
computeOverallCachePolicy(hints)); computeOverallCachePolicy(hints));