Merge branch 'types-2.0' into remove-dexie

This commit is contained in:
Nathan Shively-Sanders
2016-11-24 08:25:24 -08:00
843 changed files with 31387 additions and 15332 deletions
+2 -1
View File
@@ -37,5 +37,6 @@ node_modules
.sublimets
.settings/launch.json
.vscode
yarn.lock
yarn.lock
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"3d-bin-packing.d.ts",
"index.d.ts",
"3d-bin-packing-tests.ts"
]
}
+2 -1
View File
@@ -1665,7 +1665,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju)
* [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff)
* [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom-2.3.9.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [César Vidril](https://github.com/Yimiprod)
* [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo)
* [:link:](svgjs/svgjs.d.ts) [svg.js](http://www.svgjs.com) by [Sean Hess](https://seanhess.github.io)
* [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff)
+1 -1
View File
@@ -13,5 +13,5 @@ If adding a new definition:
- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. Base these on the README, *not* on an existing project.
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
- [ ] Increase the version number in the header if appropriate.
+18 -12
View File
@@ -52,21 +52,26 @@ DefinitelyTyped only works because of contributions by users like you!
Before you share your improvement with the world, use it yourself.
#### Test editing an exiting package
#### Test editing an existing package
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`,
or copy them from there and paste inside of `declarations.d.ts` and follow the steps below.
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
#### Test a new package
* Add a new file `declarations.d.ts` to your project.
* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html),
or through a `/// <reference path="" />` declaration in your code.
* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside.
* Test that your code works.
* *Then*, once you've tested your definitions, make a PR contributing the definition.
Add to your `tsconfig.json`:
```json
"baseUrl": "types",
"typeRoots": ["types"],
```
(You can also use `src/types`.)
Create `types/foo/index.d.ts` containing declarations for the module "foo".
You should now be able import from `"foo"` in your code and it will route to the new type definition.
Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime.
Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`.
### Make a pull request
@@ -95,7 +100,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR.
#### Create a new package
If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped.
If you are the library author, or can make a pull request to the library, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) instead of publishing to DefinitelyTyped.
If you are adding typings for an NPM package, create a directory with the same name.
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
@@ -108,6 +113,7 @@ Your package should have this structure:
| index.d.ts | This contains the typings for the package. |
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
| tsconfig.json | This allows you to run `tsc` within the package. |
| tslint.json | Enables linting. |
Generate these by running `npm run new-package -- new-package-name`.
@@ -125,7 +131,7 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object.
* `interface IFoo {}`: Don't add `I` to the front of an interface name.
* `interface Foo { new(): Foo; }`:
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`.
* `const Class: { new(): IClass; }`:
Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant.
* `namespace foo {}`:
@@ -187,7 +193,7 @@ Changes to the `master` branch are also manually merged into the `types-2.0` bra
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
If the module you're referencing is an external module (uses `export`), use an import.
If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
#### What do I do about older versions of typings?
+67 -72
View File
@@ -3,77 +3,72 @@
// Definitions by: Sergey Gerasimov <https://github.com/gerich-home/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface IAccountingCurrencyFormat {
pos: string; // for positive values, eg. "$ 1.00"
neg?: string; // for negative values, eg. "$ (1.00)"
zero?: string; // for zero values, eg. "$ --"
declare namespace accounting {
interface IAccountingCurrencyFormat {
pos: string; // for positive values, eg. "$ 1.00"
neg?: string; // for negative values, eg. "$ (1.00)"
zero?: string; // for zero values, eg. "$ --"
}
interface IAccountingCurrencySettings<TFormat> {
symbol?: string; // default currency symbol is '$'
format?: TFormat; // controls output: %s = symbol, %v = value/number
decimal?: string; // decimal point separator
thousand?: string; // thousands separator
precision?: number; // decimal places
}
interface IAccountingNumberSettings {
precision?: number; // default precision on numbers is 0
thousand?: string;
decimal?: string;
}
interface IAccountingSettings {
currency: IAccountingCurrencySettings<any>; // IAccountingCurrencySettings<string> or IAccountingCurrencySettings<IAccountingCurrencyFormat>
number: IAccountingNumberSettings;
}
interface IAccountingStatic {
// format any number into currency
formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string;
formatMoney(number: number, options: IAccountingCurrencySettings<string> | IAccountingCurrencySettings<IAccountingCurrencyFormat>): string;
formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[];
formatMoney(numbers: number[], options: IAccountingCurrencySettings<string> | IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[];
// generic case (any array of numbers)
formatMoney(numbers: any[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): any[];
formatMoney(numbers: any[], options: IAccountingCurrencySettings<string> | IAccountingCurrencySettings<IAccountingCurrencyFormat>): any[];
// format a list of values for column-display
formatColumn(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[];
formatColumn(numbers: number[], options: IAccountingCurrencySettings<string> | IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[];
formatColumn(numbers: number[][], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[][];
formatColumn(numbers: number[][], options: IAccountingCurrencySettings<string> | IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[][];
// format a number with custom precision and localisation
formatNumber(number: number, precision?: number, thousand?: string, decimal?: string): string;
formatNumber(number: number, options: IAccountingNumberSettings): string;
formatNumber(number: number[], precision?: number, thousand?: string, decimal?: string): string[];
formatNumber(number: number[], options: IAccountingNumberSettings): string[];
formatNumber(number: any[], precision?: number, thousand?: string, decimal?: string): any[];
formatNumber(number: any[], options: IAccountingNumberSettings): any[];
// better rounding for floating point numbers
toFixed(number: number, precision?: number): string;
// get a value from any formatted number/currency string
unformat(string: string, decimal?: string): number;
// settings object that controls default parameters for library methods
settings: IAccountingSettings;
}
}
interface IAccountingCurrencySettings<TFormat> {
symbol?: string; // default currency symbol is '$'
format?: TFormat; // controls output: %s = symbol, %v = value/number
decimal?: string; // decimal point separator
thousand?: string; // thousands separator
precision?: number // decimal places
}
interface IAccountingNumberSettings {
precision?: number; // default precision on numbers is 0
thousand?: string;
decimal?: string;
}
interface IAccountingSettings {
currency: IAccountingCurrencySettings<any>; // IAccountingCurrencySettings<string> or IAccountingCurrencySettings<IAccountingCurrencyFormat>
number: IAccountingNumberSettings;
}
interface IAccountingStatic {
// format any number into currency
formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string;
formatMoney(number: number, options: IAccountingCurrencySettings<string>): string;
formatMoney(number: number, options: IAccountingCurrencySettings<IAccountingCurrencyFormat>): string;
formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[];
formatMoney(numbers: number[], options: IAccountingCurrencySettings<string>): string[];
formatMoney(numbers: number[], options: IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[];
// generic case (any array of numbers)
formatMoney(numbers: any[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): any[];
formatMoney(numbers: any[], options: IAccountingCurrencySettings<string>): any[];
formatMoney(numbers: any[], options: IAccountingCurrencySettings<IAccountingCurrencyFormat>): any[];
// format a list of values for column-display
formatColumn(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[];
formatColumn(numbers: number[], options: IAccountingCurrencySettings<string>): string[];
formatColumn(numbers: number[], options: IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[];
formatColumn(numbers: number[][], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[][];
formatColumn(numbers: number[][], options: IAccountingCurrencySettings<string>): string[][];
formatColumn(numbers: number[][], options: IAccountingCurrencySettings<IAccountingCurrencyFormat>): string[][];
// format a number with custom precision and localisation
formatNumber(number: number, precision?: number, thousand?: string, decimal?: string): string;
formatNumber(number: number, options: IAccountingNumberSettings): string;
formatNumber(number: number[], precision?: number, thousand?: string, decimal?: string): string[];
formatNumber(number: number[], options: IAccountingNumberSettings): string[];
formatNumber(number: any[], precision?: number, thousand?: string, decimal?: string): any[];
formatNumber(number: any[], options: IAccountingNumberSettings): any[];
// better rounding for floating point numbers
toFixed(number: number, precision?: number): string;
// get a value from any formatted number/currency string
unformat(string: string, decimal?: string): number;
// settings object that controls default parameters for library methods
settings: IAccountingSettings;
}
declare var accounting: IAccountingStatic;
declare module "accounting" {
export = accounting;
}
declare var accounting: accounting.IAccountingStatic;
export = accounting;
export as namespace accounting;
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"actioncable-tests.ts"
]
}
-1571
View File
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,6 @@
import algoliasearch = require('algoliasearch');
import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions,
AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch";
var _clientOptions: ClientOptions = {
timeout : 12,
+1528
View File
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"algoliasearch-tests.ts"
]
}
+3
View File
@@ -24,6 +24,9 @@ declare namespace AmCharts {
/** Set it to true if you want UTC time to be used instead of local time. */
var useUTC: boolean;
/** Object with themes */
var themes: any;
/** Clears all the charts on page, removes listeners and intervals. */
function clear(): void;
-260
View File
@@ -1,265 +1,5 @@
/// <reference types="jquery" />
// Copied examples directly from AmplifyJs site
// Subscribe and publish with no data
amplify.subscribe("nodataexample", function () {
alert("nodataexample topic published!");
});
// Subscribe and publish with data
amplify.publish("nodataexample");
amplify.subscribe("dataexample", function (data) {
alert(data.foo); // bar
});
amplify.publish("dataexample", { foo: "bar" });
amplify.subscribe("dataexample2", function (param1, param2) {
alert(param1 + param2); // barbaz
});
//...
amplify.publish("dataexample2", "bar", "baz");
// Subscribe and publish with context and data
amplify.subscribe("datacontextexample", $("p:first"), function (data) {
this.text(data.exampleText); // first p element would have "foo bar baz" as text
});
amplify.publish("datacontextexample", { exampleText: "foo bar baz" });
// Subscribe to a topic with high priority
amplify.subscribe("priorityexample", function (data) {
alert(data.foo);
});
amplify.subscribe("priorityexample", function (data) {
if (data.foo === "oops") {
return false;
}
}, 1);
// Store data with amplify storage picking the default storage technology:
amplify.publish("priorityexample", { foo: "bar" });
amplify.publish("priorityexample", { foo: "oops" });
amplify.store("storeExample1", { foo: "bar" });
amplify.store("storeExample2", "baz");
// retrieve the data later via the key
var myStoredValue = amplify.store("storeExample1"),
myStoredValue2 = amplify.store("storeExample2"),
myStoredValues = amplify.store();
myStoredValue.foo; // bar
myStoredValue2; // baz
myStoredValues.storeExample1.foo; // bar
myStoredValues.storeExample2; // baz
// Store data explicitly with session storage
amplify.store.sessionStorage("explicitExample", { foo2: "baz" });
// retrieve the data later via the key
var myStoredValue2 = amplify.store.sessionStorage("explicitExample");
myStoredValue2.foo2; // baz
// REQUEST
// Set up and use a request utilizing Ajax
amplify.request.define("ajaxExample1", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET"
});
// later in code
amplify.request("ajaxExample1", function (data) {
data.foo; // bar
});
// Set up and use a request utilizing Ajax and Caching
amplify.request.define("ajaxExample2", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET",
cache: "persist"
});
// later in code
amplify.request("ajaxExample2", function (data) {
data.foo; // bar
});
// a second call will result in pulling from the cache
amplify.request("ajaxExample2", function (data) {
data.baz; // qux
})
// Set up and use a RESTful request utilizing Ajax
amplify.request.define("ajaxRESTFulExample", "ajax", {
url: "/myRestFulApi/{type}/{id}",
type: "GET"
})
// later in code
amplify.request("ajaxRESTFulExample",
{
type: "foo",
id: "bar"
},
function (data) {
// /myRESTFulApi/foo/bar was the URL used
data.foo; // bar
}
);
// POST data with Ajax
amplify.request.define("ajaxPostExample", "ajax", {
url: "/myRestFulApi",
type: "POST"
})
// later in code
amplify.request("ajaxPostExample",
{
type: "foo",
id: "bar"
},
function (data) {
data.foo; // bar
}
);
// Using data maps
// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map:
amplify.request.define("twitter-search", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: {
term: "q"
}
});
amplify.request("twitter-search", { term: "amplifyjs" });
// Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: function (data) {
return {
q: "@" + data.user
};
}
});
amplify.request("twitter-mentions", { user: "amplifyjs" });
// Setting up and using decoders
//Example:
var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
};
//a new decoder can be added to the amplifyDecoders interface
interface amplifyDecoders {
appEnvelope: amplifyDecoder;
}
amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
//but you can also just add it via an index
amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder;
amplify.request.define("decoderExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: "appEnvelope"
});
amplify.request({
resourceId: "decoderExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// POST with caching and single - use decoder
// Example:
amplify.request.define("decoderSingleExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
}
});
amplify.request({
resourceId: "decoderSingleExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// Handling Status
// Status in Success and Error Callbacks
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
//...
});
amplify.request({
resourceId: "statusExample1",
success: function (data, status) {
},
error: function (data, status) {
}
});
amplify.request({
resourceId: "statusExample1"
}).done(function (data, status) {
}).fail(function (data, status) {
}).always(function (data, status) { });
+22 -174
View File
@@ -5,178 +5,26 @@
/// <reference types="jquery" />
interface amplifyRequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
import * as amplify from "amplify";
declare module "amplify" {
interface Request {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): JQueryPromise<any>;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: RequestSettings): JQueryPromise<any>;
}
}
interface amplifyDecoder {
(
data?: any,
status?: string,
xhr?: JQueryXHR,
success?: (...args: any[]) => void,
error?: (...args: any[]) => void
): void
}
interface amplifyDecoders {
[decoderName: string]: amplifyDecoder;
jsSend: amplifyDecoder;
}
interface amplifyAjaxSettings extends JQueryAjaxSettings {
cache?: any;
dataMap?: {} | ((data: any) => {});
decoder?: any /* string or amplifyDecoder */;
}
interface amplifyRequest {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): JQueryPromise<any>;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: amplifyRequestSettings): JQueryPromise<any>;
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void;
decoders: amplifyDecoders;
cache: any;
}
interface amplifySubscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
*/
(topic: string, callback: Function): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
}
interface amplifyStorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface amplifyStore extends amplifyStorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: amplifyStorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: amplifyStorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: amplifyStorageTypeStore;
/***
* IE 5 - 7
*/
userData: amplifyStorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: amplifyStorageTypeStore;
}
interface amplifyStatic {
subscribe: amplifySubscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: amplifyStore;
request: amplifyRequest;
}
declare var amplify: amplifyStatic;
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false
}
}
+7 -3
View File
@@ -1,6 +1,8 @@
/// <reference types="jquery" />
import amplify = require("amplify");
// Copied examples directly from AmplifyJs site
// Subscribe and publish with no data
@@ -176,7 +178,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" });
//Example:
var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) {
var appEnvelopeDecoder: amplify.Decoder = function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
@@ -187,8 +189,10 @@ var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, e
};
//a new decoder can be added to the amplifyDecoders interface
interface amplifyDecoders {
appEnvelope: amplifyDecoder;
declare module "amplify" {
interface Decoders {
appEnvelope: amplify.Decoder;
}
}
amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
+168 -173
View File
@@ -5,178 +5,173 @@
/// <reference types="jquery" />
interface amplifyRequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
declare namespace amplify {
interface RequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
}
type Decoder =
(
data?: any,
status?: string,
xhr?: JQueryXHR,
success?: (...args: any[]) => void,
error?: (...args: any[]) => void
) => void;
interface Decoders {
[decoderName: string]: Decoder;
jsSend: Decoder;
}
interface AjaxSettings extends JQueryAjaxSettings {
cache?: any;
dataMap?: {} | ((data: any) => {});
decoder?: any /* string or amplifyDecoder */;
}
interface Request {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): void;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: RequestSettings): any;
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: AjaxSettings): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: (settings: RequestSettings) => void): void;
decoders: Decoders;
cache: any;
}
interface Subscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
}
interface StorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface Store extends StorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: StorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: StorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: StorageTypeStore;
/***
* IE 5 - 7
*/
userData: StorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: StorageTypeStore;
}
interface Static {
subscribe: Subscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: Store;
request: Request;
}
}
interface amplifyDecoder {
(
data?: any,
status?: string,
xhr?: JQueryXHR,
success?: (...args: any[]) => void,
error?: (...args: any[]) => void
): void
}
interface amplifyDecoders {
[decoderName: string]: amplifyDecoder;
jsSend: amplifyDecoder;
}
interface amplifyAjaxSettings extends JQueryAjaxSettings {
cache?: any;
dataMap?: {} | ((data: any) => {});
decoder?: any /* string or amplifyDecoder */;
}
interface amplifyRequest {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): void;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: amplifyRequestSettings): any;
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void;
decoders: amplifyDecoders;
cache: any;
}
interface amplifySubscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
*/
(topic: string, callback: Function): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
}
interface amplifyStorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface amplifyStore extends amplifyStorageTypeStore{
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: amplifyStorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: amplifyStorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: amplifyStorageTypeStore;
/***
* IE 5 - 7
*/
userData: amplifyStorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: amplifyStorageTypeStore;
}
interface amplifyStatic {
subscribe: amplifySubscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: amplifyStore;
request: amplifyRequest;
}
declare var amplify: amplifyStatic;
declare module "amplify" { export =amplify; }
declare var amplify: amplify.Static;
export = amplify;
export as namespace amplify;
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "../tslint.json",
"rules": {
"forbidden-types": false,
"unified-signatures": false
}
}
+43 -3
View File
@@ -7,7 +7,35 @@ import * as moment from 'moment';
import * as angular from 'angular';
declare module 'angular' {
export namespace bootstrap.calendar {
export namespace bootstrap.calendar {
interface IEventAction {
/**
* The label of the action
*/
label: string;
/**
* CSS class to be added to the action element
*/
cssClass?: string;
/**
* The action that occurs when it's clicked
* @param args - the IEvent whose action was clicked
*/
onClick: (args: any) => void;
}
interface IEventColor {
/**
* The primary color of the event, should be darker than secondary
*/
primary: string;
/**
* The secondary color of the event, should be lighter than primary
*/
secondary: string;
}
interface IEvent {
/**
* The title of the event
@@ -16,7 +44,7 @@ declare module 'angular' {
/**
* The type of the event (determines its color). Can be important, warning, info, inverse, success or special
*/
type: string;
type?: string;
/**
* A javascript date object for when the event starts
*/
@@ -25,6 +53,14 @@ declare module 'angular' {
* Optional - a javascript date object for when the event ends
*/
endsAt?: Date;
/**
* Color of the Event
*/
color?: IEventColor;
/**
* Actions of the Event
*/
actions?: Array<IEventAction>;
/**
* If edit-event-html is set and this field is explicitly set to false then dont make it editable.
*/
@@ -53,6 +89,10 @@ declare module 'angular' {
* A CSS class (or more, just separate with spaces) that will be added to the event when it is displayed on each view. Useful for marking an event as selected / active etc
*/
cssClass?: string;
/**
* If set the event will display as all-day event
*/
allDay?: boolean;
}
interface ICalendarConfig {
@@ -134,7 +174,7 @@ declare module 'angular' {
}
interface IOnViewChangeClick {
(calendarDate: Date, calendarNextView: string): void;
(calendarDate: Date, calendarNextView: string): boolean;
}
}
}
+1 -1
View File
@@ -76,4 +76,4 @@ declare namespace ncy {
**/
getLastStep(): angular.ui.IState;
}
}
}
+5 -4
View File
@@ -76,7 +76,7 @@ declare module 'angular' {
}
interface IColorService {
applyThemeColors(element: Element|JQuery, colorExpression: IColorExpression): void;
applyThemeColors(element: Element | JQuery, colorExpression: IColorExpression): void;
getThemeColor(expression: string): string;
hasTheme(): boolean;
}
@@ -158,7 +158,7 @@ declare module 'angular' {
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
toastClass(toastClass: string): T;
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
@@ -225,7 +225,7 @@ declare module 'angular' {
hues: IThemeHues;
}
interface IBrowserColors{
interface IBrowserColors {
theme: string;
palette: string;
hue: string;
@@ -264,6 +264,7 @@ declare module 'angular' {
definePalette(name: string, palette: IPalette): IThemingProvider;
enableBrowserColor(browserColors: IBrowserColors): Function;
extendPalette(name: string, palette: IPalette): IPalette;
registerStyles(styles: String): void;
setDefaultTheme(theme: string): void;
setNonce(nonce: string): void;
theme(name: string, inheritFrom?: string): ITheme;
@@ -414,7 +415,7 @@ declare module 'angular' {
ESCAPE: string,
};
absPosition: {
TOP: string,
TOP: string,
RIGHT: string,
BOTTOM: string,
LEFT: string,
+19
View File
@@ -301,6 +301,25 @@ declare module 'angular' {
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
}
///////////////////////////////////////////////////////////////////////////
// AnimateService
// see https://docs.angularjs.org/api/ngMock/service/$animate
///////////////////////////////////////////////////////////////////////////
module animate {
interface IAnimateService {
/**
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks.
*/
closeAndFlush(): void;
/**
* This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that).
*/
flush(): void;
}
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"files": [
"angular-q-spread.d.ts",
"index.d.ts",
"angular-q-spread-tests.ts"
],
"compilerOptions": {
+2
View File
@@ -162,6 +162,8 @@ declare module 'angular' {
* Really just a regular Array object with $promise and $resolve attached to it
*/
interface IResourceArray<T> extends Array<T & IResource<T>> {
$cancelRequest(): void;
/** the promise of the original server interaction that created this collection. **/
$promise: angular.IPromise<IResourceArray<T>>;
$resolved: boolean;
+1 -1
View File
@@ -110,7 +110,7 @@ declare module 'angular' {
interface IUrlMatcher {
concat(pattern: string): IUrlMatcher;
exec(path: string, searchParams: {}): {};
exec(path: string, search?: any, hash?: string, options?: any): {};
parameters(): string[];
format(values: {}): string;
}
@@ -1,5 +1,3 @@
/// <reference path="angular-websocket.d.ts" />
let dummySocket: ng.websocket.IWebSocket;
let dummyPromise: ng.IPromise<void>;
let dummyScope: ng.IScope;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"files": [
"angular-websocket.d.ts",
"index.d.ts",
"angular-websocket-tests.ts"
],
"compilerOptions": {
+2 -4
View File
@@ -1,9 +1,7 @@
/// <reference path="angular-xeditable.d.ts" />
var myApp = angular.module('testModule', ['xeditable']);
var myApp = angular.module('testModule', ['xeditable']);
myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => {
editableOptions.activate = "select";
editableOptions.activationEvent = "click";
editableOptions.blurElem = "ignore";
+1 -1
View File
@@ -1,6 +1,6 @@
{
"files": [
"angular-xeditable.d.ts",
"index.d.ts",
"angular-xeditable-tests.ts"
],
"compilerOptions": {
+9 -3
View File
@@ -1,10 +1,15 @@
// Type definitions for assert and power-assert
// Project: https://github.com/Jxck/assert
// Project: https://github.com/twada/power-assert
// Project: https://github.com/Jxck/assert, https://github.com/twada/power-assert
// Definitions by: vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// copy from assert external module in node.d.ts
// Definitions for commonjs-assert match that of node.js' assert module,
// but commonjs-assert is intended to be used as an independent module,
// for instance when making a stand-alone site or app that doesn't have
// access to node modules. For that reason, these definitions define a
// "assert" module. This will conflict with node.d.ts and other assert
// modules such as "power-assert", but a project should realistically
// only be using one of these at a time.
declare function assert(value:any, message?:string):void;
declare namespace assert {
@@ -51,3 +56,4 @@ declare namespace assert {
export function ifError(value:any):void;
}
+67 -66
View File
@@ -7,22 +7,23 @@ declare var path: {
exists: (path: string, callback?: (err: Error, exists: boolean) => any) => void;
};
function funcStringCbErrBoolean(v:string, cb:(err:Error,res:boolean) => void) {}
function callback() { }
async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { });
async.map(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.filter(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.select(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.filter(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.select(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.reject(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.reject(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.parallel([
function () { },
@@ -46,9 +47,9 @@ var openFilesObj = {
file2: "fileTwo"
}
var saveFile = function () { }
async.each(openFiles, saveFile, function (err) { });
async.eachSeries(openFiles, saveFile, function (err) { });
var saveFile = function (file:string,cb:(err:Error)=>void) { }
async.each(openFiles, saveFile, function (err:Error) { });
async.eachSeries(openFiles, saveFile, function (err:Error) { });
var documents: any, requestApi: any;
async.eachLimit(documents, 20, requestApi, function (err) { });
@@ -77,9 +78,9 @@ async.foldl(numArray, 0, reducer, function (err, result) { });
async.reduceRight(numArray, 0, reducer, function (err, result) { });
async.foldr(numArray, 0, reducer, function (err, result) { });
async.detect(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.detect(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err: Error,result:string) { });
async.detectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err,result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err,result) { });
async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
fs.stat(file, function (err, stats) {
@@ -87,13 +88,13 @@ async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
});
}, function (err, results) { });
async.some(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.any(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.some(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.someLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.any(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.every(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.all(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.every(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.all(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
@@ -111,7 +112,7 @@ async.series([
],
function (err, results) { });
async.series<string>([
async.series<string,Error>([
function (callback) {
callback(undefined, 'one');
},
@@ -135,7 +136,7 @@ async.series({
},
function (err, results) { });
async.series<number>({
async.series<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -175,7 +176,7 @@ async.parallel([
],
function (err, results) { });
async.parallel<string>([
async.parallel<string,Error>([
function (callback) {
setTimeout(function () {
callback(undefined, 'one');
@@ -204,7 +205,7 @@ async.parallel({
},
function (err, results) { });
async.parallel<number>({
async.parallel<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -270,7 +271,7 @@ async.waterfall([
], function (err, result) { });
var q = async.queue<any>(function (task: any, callback: any) {
var q = async.queue<any,Error>(function (task: any, callback: () => void) {
console.log('hello ' + task.name);
callback();
}, 2);
@@ -323,7 +324,7 @@ q.resume();
q.kill();
// tests for strongly typed tasks
var q2 = async.queue<string>(function (task: string, callback: any) {
var q2 = async.queue<string,Error>(function (task: string, callback: () => void) {
console.log('Task: ' + task);
callback();
}, 1);
@@ -386,10 +387,10 @@ async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }
async.parallel([
function (callback) { },
function (callback: ( err:Error, val:string ) => void ) { },
function (callback) { }
],
function (results) {
function (err:Error,results:Array<string>) {
async.series([
function (callback) { },
function email_link(callback) { }
@@ -442,10 +443,10 @@ async.dir(function (name: string, callback: any) {
// each
async.each<number>({
async.each<number,Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback): void {
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -461,10 +462,10 @@ async.each<number>({
});
async.eachSeries<number>({
async.eachSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback): void {
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -480,14 +481,14 @@ async.eachSeries<number>({
});
async.eachLimit<number>({
async.eachLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: ErrorCallback): void {
}, 2, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -505,10 +506,10 @@ async.eachLimit<number>({
// forEachOf/eachOf
async.eachOf<number>({
async.eachOf<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback): void {
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -524,10 +525,10 @@ async.eachOf<number>({
});
async.forEachOfSeries<number>({
async.forEachOfSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback): void {
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -543,14 +544,14 @@ async.forEachOfSeries<number>({
});
async.forEachOfLimit<number>({
async.forEachOfLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, key: string, next: ErrorCallback): void {
}, 2, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -568,11 +569,11 @@ async.forEachOfLimit<number>({
// map
async.map<number, string>({
async.map<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string>): void {
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -588,11 +589,11 @@ async.map<number, string>({
});
async.mapSeries<number, string>({
async.mapSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string>): void {
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -608,14 +609,14 @@ async.mapSeries<number, string>({
});
async.mapLimit<number, string>({
async.mapLimit<number, string, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: AsyncResultCallback<string>): void {
}, 2, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -633,11 +634,11 @@ async.mapLimit<number, string>({
// mapValues
async.mapValues<number, string>({
async.mapValues<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -653,11 +654,11 @@ async.mapValues<number, string>({
});
async.mapValuesSeries<number, string>({
async.mapValuesSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -675,11 +676,11 @@ async.mapValuesSeries<number, string>({
// filter/select/reject
async.filter<number>({
async.filter<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback): void {
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
@@ -695,11 +696,11 @@ async.filter<number>({
});
async.reject<number>({
async.reject<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback): void {
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
@@ -717,11 +718,11 @@ async.reject<number>({
// concat
async.concat<string, string>({
async.concat<string, string, Error>({
"a": "1",
"b": "2",
"c": "3"
}, function(item: string, next: AsyncResultCallback<string[]>): void {
}, function(item: string, next: AsyncResultCallback<string[], Error>): void {
console.log(`async.concat: ${item}`);
@@ -735,11 +736,11 @@ async.concat<string, string>({
// detect/find
async.detect<number>({
async.detect<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.detect/find: ${item}`);
@@ -760,11 +761,11 @@ async.detect<number>({
// every/all
async.every<number>({
async.every<number,Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.every/all: ${item}`);
@@ -778,11 +779,11 @@ async.every<number>({
// some/any
async.some<number>({
async.some<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.some/any: ${item}`);
+88 -88
View File
@@ -5,22 +5,22 @@
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback { (err?: Error): void; }
interface AsyncWaterfallCallback { (err: Error, ...args: any[]): void; }
interface AsyncBooleanResultCallback { (err: Error, truthValue: boolean): void; }
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
interface ErrorCallback<T> { (err?: T): void; }
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
interface AsyncFunction<T> { (callback: (err?: Error, result?: T) => void): void; }
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
interface AsyncForEachOfIterator<T> { (item: T, key: number|string, callback: ErrorCallback): void; }
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncBooleanIterator<T> { (item: T, callback: AsyncBooleanResultCallback): void; }
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
interface AsyncWorker<T> { (task: T, callback: ErrorCallback): void; }
interface AsyncVoidFunction { (callback: ErrorCallback): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
interface AsyncVoidFunction<E> { (callback: ErrorCallback<E>): void; }
interface AsyncQueue<T> {
length(): number;
@@ -28,10 +28,10 @@ interface AsyncQueue<T> {
running(): number;
idle(): boolean;
concurrency: number;
push(task: T, callback?: ErrorCallback): void;
push(task: T[], callback?: ErrorCallback): void;
unshift(task: T, callback?: ErrorCallback): void;
unshift(task: T[], callback?: ErrorCallback): void;
push<E>(task: T, callback?: ErrorCallback<E>): void;
push<E>(task: T[], callback?: ErrorCallback<E>): void;
unshift<E>(task: T, callback?: ErrorCallback<E>): void;
unshift<E>(task: T[], callback?: ErrorCallback<E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -53,8 +53,8 @@ interface AsyncPriorityQueue<T> {
concurrency: number;
started: boolean;
paused: boolean;
push(task: T, priority: number, callback?: AsyncResultArrayCallback<T>): void;
push(task: T[], priority: number, callback?: AsyncResultArrayCallback<T>): void;
push<E>(task: T, priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
push<E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -90,122 +90,122 @@ interface AsyncCargo {
interface Async {
// Collections
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
each<T>(arr: Dictionary<T>, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
each<T, E>(arr: T[], iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
each<T, E>(arr: Dictionary<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachSeries: typeof async.each;
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T, E>(arr: T[], limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
forEach: typeof async.each;
forEachSeries: typeof async.each;
forEachLimit: typeof async.eachLimit;
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOf<T>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOf<T, E>(obj: T[], iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOf<T, E>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfSeries: typeof async.forEachOf;
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit<T>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit<T, E>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfLimit<T, E>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
eachOf: typeof async.forEachOf;
eachOfSeries: typeof async.forEachOf;
eachOfLimit: typeof async.forEachOfLimit;
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
map<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
map<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
map<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapSeries: typeof async.map;
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
mapLimit<T, R>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
mapValuesLimit<T, R>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValues<T, R>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapLimit<T, R, E>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapLimit<T, R, E>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
mapValuesSeries: typeof async.mapValues;
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filter<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filter<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filter<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterSeries: typeof async.filter;
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filterLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filterLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
select: typeof async.filter;
selectSeries: typeof async.filter;
selectLimit: typeof async.filterLimit;
reject: typeof async.filter;
rejectSeries: typeof async.filter;
rejectLimit: typeof async.filterLimit;
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): void;
reduce<T, R, E>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
inject: typeof async.reduce;
foldl: typeof async.reduce;
reduceRight: typeof async.reduce;
foldr: typeof async.reduce;
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detect<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detect<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detect<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectSeries: typeof async.detect;
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detectLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detectLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
find: typeof async.detect;
findSeries: typeof async.detect;
findLimit: typeof async.detectLimit;
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): void;
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
some<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
sortBy<T, V, E>(arr: T[], iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
some<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
some<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someSeries: typeof async.some;
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
someLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
someLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
any: typeof async.some;
anySeries: typeof async.someSeries;
anyLimit: typeof async.someLimit;
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
every<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
every<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
every<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everySeries: typeof async.every;
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
everyLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
everyLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everyLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
all: typeof async.every;
allSeries: typeof async.every;
allLimit: typeof async.everyLimit;
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
concat<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
concat<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concat<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concatSeries: typeof async.concat;
// Control Flow
series<T>(tasks: AsyncFunction<T>[], callback?: AsyncResultArrayCallback<T>): void;
series<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallel<T>(tasks: Array<AsyncFunction<T>>, callback?: AsyncResultArrayCallback<T>): void;
parallel<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallelLimit<T>(tasks: Array<AsyncFunction<T>>, limit: number, callback?: AsyncResultArrayCallback<T>): void;
parallelLimit<T>(tasks: Dictionary<AsyncFunction<T>>, limit: number, callback?: AsyncResultObjectCallback<T>): void;
whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void;
forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void;
waterfall<T>(tasks: Function[], callback?: AsyncResultCallback<T>): void;
series<T, E>(tasks: AsyncFunction<T, E>[], callback?: AsyncResultArrayCallback<T, E>): void;
series<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallel<T, E>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doWhilst<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doUntil<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
compose(...fns: Function[]): Function;
seq(...fns: Function[]): Function;
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any>): void;
autoInject(tasks: any, callback?: AsyncResultCallback<any>): void;
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: AsyncResultCallback<any>): void;
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: AsyncResultCallback<any>): void;
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
queue<T, E>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T, E>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T>(tasks: AsyncFunction<T>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
timeout<T>(fn: AsyncFunction<T>, milliseconds: number, info: any): AsyncFunction<T>;
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info: any): AsyncFunction<T, E>;
times<T> (n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesSeries<T>(n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesLimit<T>(n: number, limit: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
transform<T, R>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
race<T>(tasks: (AsyncFunction<T>)[], callback: AsyncResultCallback<T>) : void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
+1 -1
View File
@@ -84,7 +84,7 @@ interface Auth0Identity {
interface Auth0DecodedHash {
access_token: string;
id_token: string;
idToken: string;
profile: Auth0UserProfile;
state: any;
}
+27
View File
@@ -49,3 +49,30 @@ auth
}).catch((err) => {
// Handle the error.
});
// Update a user
management
.updateUser({id: "user_id"}, {"email": "hi@me.co"});
// Update a user using callback
management
.updateUser({id: "user_id"}, {"email": "hi@me.co"}, (err: Error, users: auth0.User) => {});
// Update user metadata
management
.updateUserMetadata({id: "user_id"}, {"key": "value"});
// Update user metadata using callback
management
.updateUserMetadata({id: "user_id"}, {"key": "value"}, (err: Error, users: auth0.User) => {});
// Update app metadata
management
.updateAppMetadata({id: "user_id"}, {"key": "value"});
// Update app metadata using callback
management
.updateAppMetadata({id: "user_id"}, {"key": "value"}, (err: Error, users: auth0.User) => {});
+20 -5
View File
@@ -10,15 +10,18 @@ export interface ManagementClientOptions {
domain?: string;
}
export type UserMetadata = {};
export type AppMetadata = {};
export interface UserData {
connection: string;
email?: string;
username?: string;
password?: string;
phone_number?: string;
user_metadata?: {};
user_metadata?: UserMetadata;
email_verified?: boolean;
app_metadata?: {};
app_metadata?: AppMetadata;
}
export interface GetUsersData {
@@ -43,8 +46,8 @@ export interface User {
created_at?: string;
updated_at?: string;
identities?: Identity[];
app_metadata?: {};
user_metadata?: {};
app_metadata?: AppMetadata;
user_metadata?: UserMetadata;
picture?: string;
name?: string;
nickname?: string;
@@ -53,6 +56,8 @@ export interface User {
last_login?: string;
logins_count?: number;
blocked?: boolean;
given_name?: string;
family_name?: string;
}
export interface Identity {
@@ -62,6 +67,10 @@ export interface Identity {
isSocial: boolean;
}
export interface UpdateUserParameters {
id: string;
}
export class ManagementClient {
constructor(options: ManagementClientOptions);
@@ -69,6 +78,12 @@ export class ManagementClient {
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void
}
export interface AuthenticationClientOptions {
@@ -86,4 +101,4 @@ export class AuthenticationClient {
requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise<string>;
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
}
}
+1 -1
View File
@@ -30,4 +30,4 @@ export class RequestSigner {
formatPath(): string;
}
export function sign(options?: any, credentials?: any): RequestSigner;
export function sign(options?: any, credentials?: any): any;
+1 -1
View File
@@ -237,7 +237,7 @@ declare namespace Azure.MobileApps {
interface SqlParameterDefinition {
name: string;
value: any;
}
}
interface TableDefinition {
access?: AccessType;
+1
View File
@@ -16,6 +16,7 @@ declare namespace retry {
max_interval?: number;
timeout?: number;
max_tries?: number;
predicate?: any;
}
}
+23
View File
@@ -336,6 +336,29 @@ fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{
class CustomError extends Error {
public customField: number;
}
fooProm = fooProm.catch(CustomError, reason => {
let a: number = reason.customField
})
}
{
class CustomErrorWithConstructor extends Error {
constructor(public arg1: boolean, public arg2: number) {
super();
};
}
fooProm = fooProm.catch(CustomErrorWithConstructor, reason => {
let a: boolean = reason.arg1;
let b: number = reason.arg2;
})
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
barProm = fooProm.error((reason: any) => {
return bar;
});
+9 -4
View File
@@ -65,14 +65,19 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*/
catch(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
+1 -1
View File
@@ -13,6 +13,6 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"bootstrap-fileinput.d.ts"
"index.d.ts"
]
}
+3 -3
View File
@@ -97,7 +97,7 @@ declare namespace BraintreeWeb {
// billingContact
// Billing contact information for the user.
// countryCode
//Required.The merchants two- letter ISO 3166 country code.
//Required.The merchants two- letter ISO 3166 country code.
// currencyCode
// Required.The three- letter ISO 4217 currency code for the payment.
// lineItems
@@ -782,7 +782,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
on(event: string, handler: (() => any)): void;
on(event: string, handler: ((event: any) => any)): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/hosted-fields.create|create}
@@ -1740,4 +1740,4 @@ interface BraintreeStatic {
VERSION: string;
}
declare var braintree: BraintreeStatic;
declare var braintree: BraintreeStatic;
+11 -11
View File
@@ -11,7 +11,7 @@ import { EventEmitter } from 'events';
declare class Logger extends EventEmitter {
constructor(options: LoggerOptions);
addStream(stream: Stream): void;
addSerializers(serializers:Serializers | StdSerializers):void;
addSerializers(serializers:Serializers | StdSerializers):void;
child(options: LoggerOptions, simple?: boolean): Logger;
child(obj: Object, simple?: boolean): Logger;
reopenFileStreams(): void;
@@ -58,18 +58,18 @@ interface LoggerOptions {
src?: boolean;
}
interface Serializer {
(input:any): any;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key:string]: Serializer;
}
[key: string]: Serializer
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface Stream {
@@ -82,7 +82,7 @@ interface Stream {
count?: number;
}
export var stdSerializers:StdSerializers;
export declare var stdSerializers: StdSerializers;
export declare var TRACE: number;
export declare var DEBUG: number;
+1 -1
View File
@@ -134,7 +134,7 @@ export namespace types {
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
// var ResultStream: ResultStreamStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
-2
View File
@@ -1,5 +1,3 @@
/// <reference path="chai-dom.d.ts" />
import * as chai from 'chai';
import * as chaiDom from 'chai-dom';
View File
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"chai-dom.d.ts",
"index.d.ts",
"chai-dom-tests.ts"
]
}
-1
View File
@@ -1,5 +1,4 @@
/// <reference types="react" />
/// <reference path="./chai-enzyme.d.ts" />
/// <reference types="enzyme" />
/// <reference types="chai" />
+1 -1
View File
@@ -15,7 +15,7 @@
"jsx": "react"
},
"files": [
"chai-enzyme.d.ts",
"index.d.ts",
"chai-enzyme-tests.tsx"
]
}
+35
View File
@@ -0,0 +1,35 @@
import Chai = require('chai');
import ChaiOequal = require('chai-oequal');
Chai.use(ChaiOequal);
import {
expect,
assert
} from 'chai';
expect({
equals: () => true,
}).to.be.oequal({});
expect({
customequals: () => true,
}).to.be.oequal({}, 'customequals');
expect({
equals: () => true,
}).to.be.oeql({});
expect({
equals: () => true,
}).to.be.oeq({});
assert.oequal({
equals: () => true,
}, {});
assert.oequal({
customequals: () => true,
}, {}, 'customequals');
assert.oeql({
equals: () => true,
}, {});
assert.oeq({
equals: () => true,
}, {});
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for chai-oequal
// Project: https://github.com/wrwrwr/chai-oequal
// Definitions by: Mizunashi Mana <https://github.com/mizunashi-mana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
declare namespace Chai {
// For BDD APIs
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
oequal(result: any, method?: string): Equal;
oeql(result: any, method?: string): Equal;
oeq(result: any, method?: string): Equal;
}
// For Assert APIs
interface Assert {
oequal(act: any, exp: any, method?: string): Equal;
oeql(act: any, exp: any, method?: string): Equal;
oeq(act: any, exp: any, method?: string): Equal;
}
}
declare module 'chai-oequal' {
function chaiOequal(chai: any, utils: any): void;
export = chaiOequal;
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"chai-oequal-tests.ts"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"no-single-declare-module": false
}
}
+11
View File
@@ -0,0 +1,11 @@
/// <reference path="index.d.ts" />
/// <reference types="node" />
let requirePeer = codependency.register(module), package: any;
requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]});
requirePeer = codependency.get("some-middleware");
package = requirePeer("some-peer-dependency-package");
package = requirePeer("some-peer-dependency-package", {optional: true});
package = requirePeer("some-peer-dependency-package", {dontThrow: true});
package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true});
package = requirePeer.resolve("peer-package-name");
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for codependency v0.1.3
// Project: https://github.com/Wizcorp/codependency
// Definitions by: Morgan Benton <https://github.com/morphatic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export as namespace codependency;
interface DependencyInfo {
supportedRange: string|null;
installedVersion: string|null;
isInstalled: boolean|null;
isValid: boolean|null;
pkgPath: string;
}
interface RequirePeerFunctionOptions {
optional?: boolean;
dontThrow?: boolean;
}
interface RequirePeerFunction {
(name: string, options?: RequirePeerFunctionOptions): any;
resolve: (name: string) => DependencyInfo;
}
export function register(baseModule: NodeModule, options?: {index: string[]}): RequirePeerFunction;
export function get(middlewareName: string): RequirePeerFunction;
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"@types/node": "^6.0.0"
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"codependency-tests.ts"
]
}
+7
View File
@@ -79,6 +79,13 @@ program
console.log('unknown option is allowed');
});
program
.version('0.0.1')
.arguments('<cmd> [env]')
.action(function (cmd, env) {
console.log(cmd, env);
});
program.parse(process.argv);
console.log('stuff');
+5
View File
@@ -74,6 +74,11 @@ declare namespace commander {
*/
command(name:string, desc?:string, opts?: any):ICommand;
/**
* Set / get the arguments usage `str`.
*/
arguments(str: string):ICommand;
/**
* Add an implicit `help [cmd]` subcommand
* which invokes `--help` for the given command.
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"commangular.d.ts",
"index.d.ts",
"commangular-mock.d.ts"
]
}
+1
View File
@@ -74,6 +74,7 @@ declare namespace connectMongo {
* (Default: 10)
*/
autoRemoveInterval?: number;
/**
* don't save session if unmodified
*/
-1
View File
@@ -1,4 +1,3 @@
/// <reference path="./connect-redis.d.ts" />
/// <reference types="express-session" />
import * as connectRedis from "connect-redis";
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"connect-redis.d.ts",
"index.d.ts",
"connect-redis-tests.ts"
]
}
+1 -3
View File
@@ -1,5 +1,3 @@
/// <reference path="csv-parse.d.ts" />
import parse = require('csv-parse');
function callbackAPITest() {
@@ -38,7 +36,7 @@ import fs = require('fs');
function pipeFunctionTest() {
var transform = require('stream-transform');
var output:any = [];
var parser = parse({delimiter: ':'})
var input = fs.createReadStream('/etc/passwd');
View File
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"csv-parse.d.ts",
"index.d.ts",
"csv-parse-tests.ts"
]
}
-3
View File
@@ -1,6 +1,3 @@
/// <reference path="../d3/d3.d.ts" />
/// <reference path="d3-box.d.ts" />
// Inspired by http://bl.ocks.org/mbostock/4061502
function iqr(k: number) {
+2 -2
View File
@@ -3,9 +3,9 @@
// Definitions by: Linkun Chen <https://github.com/lk-chen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../d3/d3.d.ts"/>
import * as d3 from "d3";
declare namespace d3 {
declare module "d3" {
export function box(): Box;
interface Box {
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"@types/d3": "^3.5.36"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-box-tests.ts"
]
}
+9
View File
@@ -636,6 +636,15 @@ identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature2
identityTransform = identityTransform.fitSize([960, 500], sampleFeatureCollection);
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeatureCollection);
let reflecting: boolean;
identityTransform = identityTransform.reflectX(true);
// identityTransform = identityTransform.reflectX(5); // fails, wrong argument data type
reflecting = identityTransform.reflectX();
identityTransform = identityTransform.reflectY(true);
// identityTransform = identityTransform.reflectY(5); // fails, wrong argument data type
reflecting = identityTransform.reflectY();
// ----------------------------------------------------------------------
// Stream interface
+26 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for D3JS d3-geo module v1.3.1
// Type definitions for D3JS d3-geo module v1.4.0
// Project: https://github.com/d3/d3-geo/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -1412,6 +1412,31 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
*/
fitSize(size: [number, number], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
/**
* Returns true if x-reflection is enabled, which defaults to false.
*/
reflectX(): boolean;
/**
* Sets whether or not the x-dimension is reflected (negated) in the output.
*
* @param reflect true = reflect x-dimension, false = do not reflect x-dimension.
*/
reflectX(reflect: boolean): this;
/**
* Returns true if y-reflection is enabled, which defaults to false.
*/
reflectY(): boolean;
/**
* Sets whether or not the y-dimension is reflected (negated) in the output.
*
* This is especially useful for transforming from standard spatial reference systems,
* which treat positive y as pointing up, to display coordinate systems such as Canvas and SVG,
* which treat positive y as pointing down.
*
* @param reflect true = reflect y-dimension, false = do not reflect y-dimension.
*/
reflectY(reflect: boolean): this;
/**
* Returns the current scale factor.
-3
View File
@@ -1,6 +1,3 @@
/// <reference path="../d3/d3.d.ts" />
/// <reference path="d3.slider.d.ts" />
d3.select('#slider1').call(d3.slider());
d3.select('#slider2').call(d3.slider().value( [ 10, 25 ] ));
d3.select('#slider3').call(d3.slider().axis(true).value( [ 10, 25 ] )
+2 -2
View File
@@ -3,9 +3,9 @@
// Definitions by: Linkun Chen <https://github.com/lk-chen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../d3/d3.d.ts"/>
import * as d3 from "d3";
declare namespace d3 {
declare module "d3" {
export function slider(): Slider;
interface Slider {
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"@types/d3": "^3.5.36"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3.slider-tests.ts"
]
}
+194 -1110
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
View File
+115
View File
@@ -0,0 +1,115 @@
// Type definitions for d3Kit v3.1.2
// Project: https://github.com/twitter/d3kit
// Definitions by: Morgan Benton <https://github.com/morphatic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="d3" />
export as namespace d3kit;
export class AbstractChart {
container: Element;
constructor(selector: string|Element, options?: ChartOptions);
static getDefaultOptions(): ChartOptions;
static getCustomEventNames(): string[];
setupDispatcher(customEventNames?: string[]): void;
getCustomEventNames(): string[];
getInnerWidth(): number;
getInnerHeight(): number;
width(value: number): this;
width(): number;
height(value: number): this;
height(): number;
dimension(dimensions: [number, number]): this;
dimension(): [number, number];
data(data: any): this;
data(): any;
margin(margins: ChartMargin): this;
margin(): ChartMargin;
offset(offset: ChartOffset): this;
offset(): ChartOffset;
options(options: ChartOptions): this;
options(): ChartOptions;
updateDimensionNow(): this;
hasData(): boolean;
hasNonZeroArea(): boolean;
fit(fitOptions: FitOptions, watchOptions?: WatchOptions): this;
stopFitWatcher(): this;
on(name: string, listener: () => void): this;
off(name: string): this;
destroy(): void;
}
export interface ChartMargin {
top?: number;
right?: number;
bottom?: number;
left?: number;
}
export interface ChartOffset {
x: number;
y: number;
}
export interface ChartOptions {
initialWidth?: number;
initialHeight?: number;
margin?: ChartMargin;
offset?: ChartOffset;
pixelRatio?: number;
}
// from https://github.com/kristw/slimfit
export interface FitOptions {
mode?: string;
width?: string|number;
height?: string|number;
ratio?: number;
maxWidth?: string|number;
maxHeight?: string|number;
}
// from https://github.com/kristw/slimfit
export interface WatchOptions {
mode?: string;
target?: any; // lazy
interval?: number;
}
export class SvgChart extends AbstractChart {
svg: d3.Selection<d3.BaseType, any, d3.BaseType, any>;
rootG: d3.Selection<d3.BaseType, any, d3.BaseType, any>;
layers: LayerOrganizer;
constructor(selector: string|Element, options?: ChartOptions);
}
export class CanvasChart extends AbstractChart {
constructor(selector: string|Element, options?: ChartOptions);
static getDefaultOptions(): ChartOptions;
getContext2d(): CanvasRenderingContext2D;
clear(): this;
}
export class LayerOrganizer {
constructor(container: d3.Selection<d3.BaseType, any, d3.BaseType, any>, defaultTag?: string);
create(layerNames: string|Array<string>|LayerConfig|Array<LayerConfig>): d3.Selection<d3.BaseType, any, d3.BaseType, any>|Array<d3.Selection<d3.BaseType, any, d3.BaseType, any>>;
get(name: string): d3.Selection<d3.BaseType, any, d3.BaseType, any>;
has(name: string): boolean;
}
export interface LayerConfig {
[layerName: string]: string|string[]|LayerConfig|Array<LayerConfig>;
}
export namespace helper {
function debounce(fn: (...args: Array<any>) => void, delay: number): (...args: Array<any>) => void;
function deepExtend(dest: Object, ...args: Object[]): Object;
function extend(dest: Object, ...args: Object[]): Object;
function functor(value: any): (...args: Array<any>) => any;
function rebind(target: Object, source: Object): Object;
function isFunction(value: any): boolean;
function isObject(value: any): boolean;
function kebabCase(str: string): string;
function throttle(fn: (...args: Array<any>) => void, delay: number): (...args: Array<any>) => void;
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"dependencies": {
"@types/d3": "^3.5.36"
"@types/d3": "^4.2.38"
}
}
+1 -2
View File
@@ -6,7 +6,6 @@
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"node_modules/@types",
"../"
],
"types": [],
@@ -14,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"d3kit.d.ts",
"index.d.ts",
"d3kit-tests.ts"
]
}
+9 -14
View File
@@ -43,20 +43,15 @@ declare namespace dat {
updateDisplay(): void;
// gui properties in dat/gui/GUI.js
parent(): GUI;
scrollable(): boolean;
autoPlace(): boolean;
preset(): string;
preset(s: string): void;
width(): number;
width(n: number): void;
name(): string;
name(s: string): void;
closed(): boolean;
closed(b: boolean): void;
load(): Object;
useLocalStorage(): boolean;
useLocalStorage(b: boolean): void;
readonly parent: GUI;
readonly scrollable: boolean;
readonly autoPlace: boolean;
preset: string;
width: number;
name: string;
closed: boolean;
readonly load: Object;
useLocalStorage: boolean;
}
export interface GUIParams{
-1
View File
@@ -1,4 +1,3 @@
/// <reference path="daterangepicker.d.ts"/>
import moment = require("moment")
function tests_simple() {
@@ -167,6 +167,5 @@ declare namespace daterangepicker {
}
}
declare module "daterangepicker" {
export = daterangepicker;
}
export = daterangepicker;
export as namespace daterangepicker;
+1 -1
View File
@@ -13,7 +13,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"daterangepicker.d.ts",
"index.d.ts",
"daterangepicker-tests.ts"
]
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Test file for db.js Definition file
import db = require("db.js");
/* Type for use in tests */
+12 -12
View File
@@ -7,7 +7,7 @@ declare module DbJs {
interface ErrorListener {
(err: Error): void;
}
interface OpenOptions {
server: string;
version: number;
@@ -29,14 +29,14 @@ declare module DbJs {
interface CountableQuery<T> {
count(): ExecutableQuery<T>;
}
interface KeysQuery<T> extends DescableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DistinctableQuery<T>, MappableQuery<T> {
}
}
interface KeyableQuery<T> {
keys(): KeysQuery<T>;
}
interface FilterQuery<T> extends KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, DistinctableQuery<T>, ModifiableQuery<T>, LimitableQuery<T>, MappableQuery<T> {
}
@@ -44,14 +44,14 @@ declare module DbJs {
filter<TValue>(index: string, value: TValue): FilterQuery<T>;
filter(filter: (value: T) => boolean): FilterQuery<T>;
}
interface DescQuery<T> extends KeyableQuery<T>, CountableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, ModifiableQuery<T>, MappableQuery<T> {
interface DescQuery<T> extends KeyableQuery<T>, CountableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, ModifiableQuery<T>, MappableQuery<T> {
}
interface DescableQuery<T> {
desc(): DescQuery<T>;
}
interface DistinctQuery<T> extends KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, ModifiableQuery<T>, MappableQuery<T>, CountableQuery<T> {
}
@@ -71,7 +71,7 @@ declare module DbJs {
interface MappableQuery<T> {
map<TMap>(fn: (value: T) => TMap): Query<TMap>;
}
interface Query<T> extends Promise<T>, KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, DistinctableQuery<T>, ModifiableQuery<T>, LimitableQuery<T>, MappableQuery<T>, CountableQuery<T> {
}
@@ -93,11 +93,11 @@ declare module DbJs {
getIndexedDB(): IDBDatabase;
close(): void;
}
interface IndexAccessibleServer {
[store: string]: TypedObjectStoreServer<any>;
}
interface ObjectStoreServer {
add<T>(table: string, entity: T): Promise<T>;
add<T>(table: string, ...entities: T[]): Promise<T[]>;
@@ -142,11 +142,11 @@ declare module DbJs {
query(index: string): IndexQuery<T>;
count(key: any): Promise<number>;
}
type Server = DbJs.IndexAccessibleServer & DbJs.ObjectStoreServer & DbJs.BaseServer;
}
declare module "db" {
declare module "db.js" {
var db: DbJs.DbJsStatic;
export = db;
}
+9 -1
View File
@@ -58,7 +58,15 @@ export interface ILegendwidget {
export var events: IEvents;
export interface IListener<T> {
on: (eventName: string, fnctn: (c:T) => void) => T;
on: {
(event: "preRender", fnctn: (c: T) => any): T;
(event: "postRender", fnctn: (c: T) => any): T;
(event: "preRedraw", fnctn: (c: T) => any): T;
(event: "postRedraw", fnctn: (c: T) => any): T;
(event: "filtered", fnctn: (c: T, filter: any) => any): T;
(event: "zoomed", fnctn: (c: T, filter: any) => any): T;
(event: string, fnctn: (c: T, ...args: any[]) => any): T;
};
}
export interface ImarginObj {

Some files were not shown because too many files have changed in this diff Show More