Skip to content

Commit f21d135

Browse files
authored
refactor: replace custom neo-async types with @types/neo-async (#20270)
1 parent c99180f commit f21d135

10 files changed

Lines changed: 280 additions & 368 deletions

declarations.d.ts

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -34,130 +34,6 @@ declare module "typescript-iterable" {
3434
}
3535
}
3636

37-
declare module "neo-async" {
38-
interface QueueObject<T, E> {
39-
push(item: T): void;
40-
drain: () => void;
41-
error: (err: E) => void;
42-
}
43-
44-
export interface Dictionary<T> {
45-
[key: string]: T;
46-
}
47-
export type IterableCollection<T> = T[] | Iterable<T> | Dictionary<T>;
48-
49-
export interface ErrorCallback<T> {
50-
(err?: T): void;
51-
}
52-
export interface AsyncBooleanResultCallback<E> {
53-
(err?: E, truthValue?: boolean): void;
54-
}
55-
export interface AsyncResultCallback<T, E> {
56-
(err?: E, result?: T): void;
57-
}
58-
export interface AsyncResultArrayCallback<T, E> {
59-
(err: E | null, results?: Array<T | undefined>): void;
60-
}
61-
export interface AsyncResultObjectCallback<T, E> {
62-
(err: E | undefined, results: Dictionary<T | undefined>): void;
63-
}
64-
65-
export interface AsyncFunction<T, E> {
66-
(callback: (err?: E, result?: T) => void): void;
67-
}
68-
export interface AsyncFunctionEx<T, E> {
69-
(callback: (err?: E, ...results: T[]) => void): void;
70-
}
71-
export interface AsyncIterator<T, E> {
72-
(item: T, callback: ErrorCallback<E>): void;
73-
}
74-
export interface AsyncForEachOfIterator<T, E> {
75-
(item: T, key: number | string, callback: ErrorCallback<E>): void;
76-
}
77-
export interface AsyncResultIterator<T, R, E> {
78-
(item: T, callback: AsyncResultCallback<R, E>): void;
79-
}
80-
export interface AsyncMemoIterator<T, R, E> {
81-
(memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void;
82-
}
83-
export interface AsyncBooleanIterator<T, E> {
84-
(item: T, callback: AsyncBooleanResultCallback<E>): void;
85-
}
86-
87-
export interface AsyncWorker<T, E> {
88-
(task: T, callback: ErrorCallback<E>): void;
89-
}
90-
export interface AsyncVoidFunction<E> {
91-
(callback: ErrorCallback<E>): void;
92-
}
93-
94-
export type AsyncAutoTasks<R extends Dictionary<any>, E> = {
95-
[K in keyof R]: AsyncAutoTask<R[K], R, E>;
96-
};
97-
export type AsyncAutoTask<R1, R extends Dictionary<any>, E> =
98-
| AsyncAutoTaskFunctionWithoutDependencies<R1, E>
99-
| (keyof R | AsyncAutoTaskFunction<R1, R, E>)[];
100-
export interface AsyncAutoTaskFunctionWithoutDependencies<R1, E> {
101-
(cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
102-
}
103-
export interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E> {
104-
(results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
105-
}
106-
107-
export function each<T, E>(
108-
arr: IterableCollection<T>,
109-
iterator: AsyncIterator<T, E>,
110-
callback?: ErrorCallback<E>
111-
): void;
112-
113-
export function eachLimit<T, E>(
114-
arr: IterableCollection<T>,
115-
limit: number,
116-
iterator: AsyncIterator<T, E>,
117-
callback?: ErrorCallback<E>
118-
): void;
119-
120-
export function map<T, R, E>(
121-
arr: T[] | IterableIterator<T>,
122-
iterator: AsyncResultIterator<T, R, E>,
123-
callback?: AsyncResultArrayCallback<R, E>
124-
): void;
125-
export function map<T, R, E>(
126-
arr: Dictionary<T>,
127-
iterator: AsyncResultIterator<T, R, E>,
128-
callback?: AsyncResultArrayCallback<R, E>
129-
): void;
130-
131-
export function parallel<T, E>(
132-
tasks: Array<AsyncFunction<T, E>>,
133-
callback?: AsyncResultArrayCallback<T, E>
134-
): void;
135-
export function parallel<T, E>(
136-
tasks: Dictionary<AsyncFunction<T, E>>,
137-
callback?: AsyncResultObjectCallback<T, E>
138-
): void;
139-
140-
export function queue<T, E>(
141-
worker: AsyncIterator<T, E>,
142-
concurrency?: number
143-
): QueueObject<T, E>;
144-
145-
export function series<T, E = Error>(
146-
tasks: Array<AsyncFunction<T, E>>,
147-
callback?: AsyncResultArrayCallback<T, E>
148-
): void;
149-
export function series<T, E = Error>(
150-
tasks: Dictionary<AsyncFunction<T, E>>,
151-
callback?: AsyncResultObjectCallback<T, E>
152-
): void;
153-
export function series<T, R, E = Error>(
154-
tasks: Array<AsyncFunction<T, E>> | Dictionary<AsyncFunction<T, E>>
155-
): Promise<R>;
156-
157-
export const forEach: typeof each;
158-
export const forEachLimit: typeof eachLimit;
159-
}
160-
16137
// There are no typings for @webassemblyjs/ast
16238
declare module "@webassemblyjs/ast" {
16339
export class AST extends Node {

0 commit comments

Comments
 (0)