mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Move all packages to a types directory
This commit is contained in:
16
types/node-array-ext/index.d.ts
vendored
Normal file
16
types/node-array-ext/index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for node-array-ext v1.0.00
|
||||
// Project: https://github.com/Beng89/node-array-ext
|
||||
// Definitions by: Ben Goltz <https://github.com/Beng89>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
/**
|
||||
* Processes each of the elements in the array and triggers a callback once every element has been processed.
|
||||
* - note that the elements are called in order but are not guaranteed to finish in order.
|
||||
*/
|
||||
export declare function asyncEach<T>(array: Array<T>, each: (i: number, element: T, done: (err?: Error) => void) => void, finish: (err?: Error) => void): void;
|
||||
/**
|
||||
* Processes each of the elements in the array and triggers a callback once every element has been processed.
|
||||
* - note that the elements are called in order and are guaranteed to finish in order.
|
||||
*/
|
||||
export declare function awaitEach<T>(array: Array<T>, each: (i: number, element: T, done: (err?: Error) => void) => void, finish: (err?: Error) => void): void;
|
||||
23
types/node-array-ext/node-array-ext-tests.ts
Normal file
23
types/node-array-ext/node-array-ext-tests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
import extensions = require("node-array-ext");
|
||||
|
||||
var array: Array<string> = [ "hello", "world", "test" ];
|
||||
var result: string = "";
|
||||
var finish = function(err?: Error) {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
console.log(result);
|
||||
}
|
||||
}
|
||||
function each(i: number, element: string, next: (err?: Error) => void): void {
|
||||
setTimeout(function() {
|
||||
console.log("%s => %s", i, element);
|
||||
result += element + " ";
|
||||
next();
|
||||
}, 50 * (array.length - i));
|
||||
}
|
||||
|
||||
extensions.asyncEach<string>(array, each, finish);
|
||||
extensions.awaitEach<string>(array, each, finish);
|
||||
23
types/node-array-ext/tsconfig.json
Normal file
23
types/node-array-ext/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-array-ext-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user