Skip to content

Commit

Permalink
Avoid duplication in types
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Jan 19, 2022
1 parent fb04ca4 commit 98f9bc2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/link/batch/batching.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Operation, FetchResult, NextLink } from '../core';
import { FetchResult, NextLink, Operation } from '../core';
import { Observable, ObservableSubscription } from '../../utilities';

export type BatchHandler = (
Expand All @@ -11,7 +11,7 @@ export interface BatchableRequest {
forward?: NextLink;
}

interface QueuedRequest extends BatchableRequest {
type QueuedRequest = BatchableRequest & {
observable?: Observable<FetchResult>;
next: Array<(result: FetchResult) => void>;
error: Array<(error: Error) => void>;
Expand Down Expand Up @@ -145,12 +145,12 @@ export class OperationBatcher {
return;
}

const operations: Operation[] = [];
const forwards: (NextLink | undefined)[] = [];
const observables: (Observable<FetchResult> | undefined)[] = [];
const nexts: Array<(result: FetchResult) => void>[] = [];
const errors: Array<(error: Error) => void>[] = [];
const completes: Array<() => void>[] = [];
const operations: QueuedRequest['operation'][] = [];
const forwards: QueuedRequest['forward'][] = [];
const observables: QueuedRequest['observable'][] = [];
const nexts: QueuedRequest['next'][] = [];
const errors: QueuedRequest['error'][] = [];
const completes: QueuedRequest['complete'][] = [];

// Even though batch is a Set, it preserves the order of first insertion
// when iterating (per ECMAScript specification), so these requests will be
Expand Down

0 comments on commit 98f9bc2

Please sign in to comment.