Skip to content

Commit

Permalink
Added declarations as included file and removed automatic generation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-van committed Nov 5, 2021
1 parent 27179a1 commit 3355e89
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 54 deletions.
7 changes: 0 additions & 7 deletions gen-typescript-declarations.bash

This file was deleted.

266 changes: 266 additions & 0 deletions modern-async.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
declare module "asyncIterableWrap" {
export default asyncIterableWrap;
function asyncIterableWrap<T>(iterable: Iterable<T> | AsyncIterable<T>): AsyncIterable<T>;
}
declare module "asyncWrap" {
export default asyncWrap;
function asyncWrap(fct: Function): Function;
}
declare module "asyncRoot" {
export default asyncRoot;
function asyncRoot(fct: () => void, errorHandler?: (reason: any) => void): Promise<void>;
}
declare module "CancelledError" {
export default CancelledError;
class CancelledError extends Error {
constructor(message: string);
}
}
declare module "Deferred" {
export default Deferred;
class Deferred<T> {
get promise(): Promise<T>;
get resolve(): (v: T) => void;
get reject(): (v: any) => void;
}
}
declare module "delayCancellable" {
export default delayCancellable;
function delayCancellable(): [Promise<void>, () => boolean];
}
declare module "delay" {
export default delay;
function delay(): Promise<void>;
}
declare module "Delayer" {
export default Delayer;
class Delayer {
constructor(triggerTime: number);
set triggerTime(arg: number);
get triggerTime(): number;
reset(): void;
checkDelay(): boolean;
}
}
declare module "queueMicrotask" {
export default queueMicrotask;
function queueMicrotask(fct: () => void): void;
}
declare module "Queue" {
export default Queue;
class Queue {
constructor(concurrency: number);
get concurrency(): number;
get running(): number;
get pending(): number;
exec<M>(fct: () => M, priority?: number): Promise<M>;
execCancellable<M_1>(fct: () => M_1, priority?: number): [Promise<M_1>, () => boolean];
cancelAllPending(): number;
}
}
declare module "findIndexLimit" {
export default findIndexLimit;
function findIndexLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency: Queue | number, ordered?: boolean): Promise<number>;
import Queue from "Queue";
}
declare module "everyLimit" {
export default everyLimit;
function everyLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency: Queue | number): Promise<boolean>;
import Queue from "Queue";
}
declare module "every" {
export default every;
function every<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<boolean>;
}
declare module "everySeries" {
export default everySeries;
function everySeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<boolean>;
}
declare module "toArray" {
export default toArray;
function toArray<V>(iterable: Iterable<V> | AsyncIterable<V>): Promise<V[]>;
}
declare module "mapGenerator" {
export default mapGenerator;
function mapGenerator<V, M>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => M, queueOrConcurrency?: Queue | number, ordered?: boolean): AsyncIterable<M>;
import Queue from "Queue";
}
declare module "filterGenerator" {
export default filterGenerator;
function filterGenerator<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency?: Queue | number, ordered?: boolean): AsyncIterable<V>;
import Queue from "Queue";
}
declare module "filterLimit" {
export default filterLimit;
function filterLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency: Queue | number): V[];
import Queue from "Queue";
}
declare module "filter" {
export default filter;
function filter<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): V[];
}
declare module "filterSeries" {
export default filterSeries;
function filterSeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): V[];
}
declare module "findLimit" {
export default findLimit;
function findLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency: Queue | number, ordered?: boolean): Promise<V>;
import Queue from "Queue";
}
declare module "find" {
export default find;
function find<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, ordered?: boolean): Promise<V>;
}
declare module "findIndex" {
export default findIndex;
function findIndex<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, ordered?: boolean): Promise<number>;
}
declare module "findIndexSeries" {
export default findIndexSeries;
function findIndexSeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<number>;
}
declare module "findSeries" {
export default findSeries;
function findSeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<V>;
}
declare module "forEachLimit" {
export default forEachLimit;
function forEachLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => void, queueOrConcurrency: Queue | number): Promise<void>;
import Queue from "Queue";
}
declare module "forEach" {
export default forEach;
function forEach<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => void): Promise<void>;
}
declare module "forEachSeries" {
export default forEachSeries;
function forEachSeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => void): Promise<void>;
}
declare module "mapLimit" {
export default mapLimit;
function mapLimit<V, M>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => M, queueOrConcurrency: Queue | number): Promise<M[]>;
import Queue from "Queue";
}
declare module "map" {
export default map;
function map<V, M>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => M): Promise<M[]>;
}
declare module "mapSeries" {
export default mapSeries;
function mapSeries<V, M>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => M): Promise<M[]>;
}
declare module "reduce" {
export default reduce;
function reduce<V>(iterable: Iterable<V> | AsyncIterable<V>, reducer: (accumulator: V, value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => V, initial?: V): Promise<V>;
}
declare module "reduceRight" {
export default reduceRight;
function reduceRight<V>(iterable: Iterable<V> | AsyncIterable<V>, reducer: (accumulator: V, value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => V, initial?: V): Promise<V>;
}
declare module "sleepCancellable" {
export default sleepCancellable;
function sleepCancellable(amount: number): [Promise<void>, () => boolean];
}
declare module "Scheduler" {
export default Scheduler;
class Scheduler {
constructor(fct: () => void, delay: number, options?: {
startImmediate?: boolean;
concurrency?: number;
maxPending?: number;
});
get delay(): number;
get startImmediate(): boolean;
get concurrency(): number;
get maxPending(): number;
get started(): boolean;
start(): void;
stop(): void;
}
}
declare module "sleep" {
export default sleep;
function sleep(amount: number): Promise<void>;
}
declare module "sleepPreciseCancellable" {
export default sleepPreciseCancellable;
function sleepPreciseCancellable(amount: number): [Promise<void>, () => boolean];
}
declare module "sleepPrecise" {
export default sleepPrecise;
function sleepPrecise(amount: number): Promise<void>;
}
declare module "someLimit" {
export default someLimit;
function someLimit<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean, queueOrConcurrency: Queue | number): Promise<boolean>;
import Queue from "Queue";
}
declare module "some" {
export default some;
function some<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<boolean>;
}
declare module "someSeries" {
export default someSeries;
function someSeries<V>(iterable: Iterable<V> | AsyncIterable<V>, iteratee: (value: V, index: number, iterable: Iterable<V> | AsyncIterable<V>) => boolean): Promise<boolean>;
}
declare module "TimeoutError" {
export default TimeoutError;
class TimeoutError extends Error {
constructor(message: string);
}
}
declare module "timeout" {
export default timeout;
function timeout<T>(fct: () => T, amount: number): Promise<T>;
}
declare module "timeoutPrecise" {
export default timeoutPrecise;
function timeoutPrecise<T>(fct: () => T, amount: number): Promise<T>;
}
declare module "modern-async" {
export { default as asyncIterableWrap } from "asyncIterableWrap";
export { default as asyncRoot } from "asyncRoot";
export { default as asyncWrap } from "asyncWrap";
export { default as CancelledError } from "CancelledError";
export { default as Deferred } from "Deferred";
export { default as delay } from "delay";
export { default as delayCancellable } from "delayCancellable";
export { default as Delayer } from "Delayer";
export { default as every } from "every";
export { default as everyLimit } from "everyLimit";
export { default as everySeries } from "everySeries";
export { default as filter } from "filter";
export { default as filterGenerator } from "filterGenerator";
export { default as filterLimit } from "filterLimit";
export { default as filterSeries } from "filterSeries";
export { default as find } from "find";
export { default as findIndex } from "findIndex";
export { default as findIndexLimit } from "findIndexLimit";
export { default as findIndexSeries } from "findIndexSeries";
export { default as findLimit } from "findLimit";
export { default as findSeries } from "findSeries";
export { default as forEach } from "forEach";
export { default as forEachLimit } from "forEachLimit";
export { default as forEachSeries } from "forEachSeries";
export { default as map } from "map";
export { default as mapGenerator } from "mapGenerator";
export { default as mapLimit } from "mapLimit";
export { default as mapSeries } from "mapSeries";
export { default as Queue } from "Queue";
export { default as queueMicrotask } from "queueMicrotask";
export { default as reduce } from "reduce";
export { default as reduceRight } from "reduceRight";
export { default as Scheduler } from "Scheduler";
export { default as sleep } from "sleep";
export { default as sleepCancellable } from "sleepCancellable";
export { default as sleepPrecise } from "sleepPrecise";
export { default as sleepPreciseCancellable } from "sleepPreciseCancellable";
export { default as some } from "some";
export { default as someLimit } from "someLimit";
export { default as someSeries } from "someSeries";
export { default as timeout } from "timeout";
export { default as TimeoutError } from "TimeoutError";
export { default as timeoutPrecise } from "timeoutPrecise";
export { default as toArray } from "toArray";
}
22 changes: 1 addition & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"jsdelivr": "dist/modern-async.umd.js",
"unpkg": "dist/modern-async.umd.js",
"types": "dist/modern-async.d.ts",
"types": "modern-async.d.ts",
"files": [
"src/*",
"dist/*",
Expand All @@ -32,13 +32,12 @@
"tsconfig.json"
],
"scripts": {
"build": "rollup -c rollup.config.js && npm run ts-declarations",
"build": "rollup -c rollup.config.js",
"test": "npm run lint && npm run coverage",
"coverage": "npm run jest -- --coverage",
"lint": "eslint -c .eslintrc.cjs \"src/**/*.mjs\"",
"jest": "NODE_OPTIONS=--experimental-vm-modules jest",
"docs": "jsdoc -c .jsdoc.json && node dev/docs-collect-version-numbers.cjs",
"ts-declarations": "./gen-typescript-declarations.bash"
"docs": "jsdoc -c .jsdoc.json && node dev/docs-collect-version-numbers.cjs"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -67,8 +66,7 @@
"jest": "^27.3.1",
"jsdoc": "^3.6.7",
"rollup": "^2.59.0",
"semver-sort": "0.0.4",
"typescript": "^4.6.0-dev.20211105"
"semver-sort": "0.0.4"
},
"dependencies": {
"core-js-pure": "^3.19.1",
Expand Down
20 changes: 0 additions & 20 deletions tsconfig.json

This file was deleted.

0 comments on commit 3355e89

Please sign in to comment.