Move all packages to a types directory

This commit is contained in:
Andy Hanson
2017-03-24 14:27:52 -07:00
parent f9869dc191
commit 354cec620d
13846 changed files with 0 additions and 0 deletions

16
types/node-array-ext/index.d.ts vendored Normal file
View 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;

View 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);

View 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"
]
}