Skip to content

Commit

Permalink
Add missing type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 14, 2023
1 parent 8ce67c3 commit 6903339
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/internal/fetchSource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Source, fromAsyncIterable } from 'wonka';
import { Operation, OperationResult } from '../types';
import { Operation, OperationResult, ExecutionResult } from '../types';
import { makeResult, makeErrorResult, mergeResultPatch } from '../utils';

const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null;
Expand All @@ -25,7 +25,10 @@ async function* streamBody(response: Response): AsyncIterableIterator<string> {
}
}

async function* parseMultipartChunks(response: Response, contentType: string) {
async function* parseMultipartChunks(
contentType: string,
response: Response
): AsyncIterableIterator<ExecutionResult> {
const boundaryHeader = contentType.match(boundaryHeaderRe);
const boundary = '--' + (boundaryHeader ? boundaryHeader[1] : '-');

Expand Down Expand Up @@ -85,7 +88,7 @@ async function* fetchOperation(
return yield makeResult(operation, JSON.parse(text), response);
}

const iterator = parseMultipartChunks(response, contentType);
const iterator = parseMultipartChunks(contentType, response);
for await (const payload of iterator) {
yield (result = result
? mergeResultPatch(result, payload, response)
Expand Down

0 comments on commit 6903339

Please sign in to comment.