diff --git a/.changeset/nine-knives-lie.md b/.changeset/nine-knives-lie.md new file mode 100644 index 000000000..45a6c74f7 --- /dev/null +++ b/.changeset/nine-knives-lie.md @@ -0,0 +1,5 @@ +--- +'apollo-angular': patch +--- + +Relax type to be able to use `extract-files` properly diff --git a/packages/apollo-angular/http/src/types.ts b/packages/apollo-angular/http/src/types.ts index 3d4ca4b8b..58ddf3612 100644 --- a/packages/apollo-angular/http/src/types.ts +++ b/packages/apollo-angular/http/src/types.ts @@ -41,11 +41,13 @@ export type Request = { options: HttpRequestOptions; }; -export type ExtractFiles = (body: Body | Body[]) => { - clone: Body; +export type ExtractedFiles = { + clone: unknown; files: Map; }; +export type ExtractFiles = (body: Body | Body[]) => ExtractedFiles; + export type BatchOptions = { batchMax?: number; batchInterval?: number; diff --git a/packages/apollo-angular/http/src/utils.ts b/packages/apollo-angular/http/src/utils.ts index de20520df..be56e1752 100644 --- a/packages/apollo-angular/http/src/utils.ts +++ b/packages/apollo-angular/http/src/utils.ts @@ -1,6 +1,6 @@ import { Observable } from 'rxjs'; import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; -import { Body, ExtractFiles, Request } from './types'; +import {Body, ExtractedFiles, ExtractFiles, Request} from './types'; export const fetch = ( req: Request, @@ -12,10 +12,7 @@ export const fetch = ( ['variables', 'extensions'].indexOf(param.toLowerCase()) !== -1; const isBatching = (req.body as Body[]).length; let shouldUseMultipart = req.options && req.options.useMultipart; - let multipartInfo: { - clone: Body; - files: Map; - }; + let multipartInfo: ExtractedFiles; if (shouldUseMultipart) { if (isBatching) {