diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index c1a30bb05..306bea98e 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -1119,6 +1119,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame)
* [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet)
* [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR)
+* [:link:](simpleStorage/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena)
* [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u)
* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao)
* [:link:](sinon-chrome/sinon-chrome.d.ts) [Sinon-Chrome](https://github.com/vitalets/sinon-chrome) by [Tim Perry](https://github.com/pimterry)
diff --git a/amqplib/amqplib-tests.ts b/amqplib/amqplib-tests.ts
index 7a1f51200..f99a3bde1 100644
--- a/amqplib/amqplib-tests.ts
+++ b/amqplib/amqplib-tests.ts
@@ -1,5 +1,6 @@
///
+// promise api tests
import amqp = require("amqplib");
var msg = "Hello World";
@@ -19,3 +20,34 @@ amqp.connect("amqp://localhost")
.then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())))
.ensure(() => connection.close());
});
+
+// callback api tests
+import amqpcb = require("amqplib/callback_api");
+
+amqpcb.connect("amqp://localhost", (err, connection) => {
+ if(!err) {
+ connection.createChannel((err, channel) => {
+ if (!err) {
+ channel.assertQueue("myQueue", {}, (err, ok) => {
+ if(!err) {
+ channel.sendToQueue("myQueue", new Buffer(msg));
+ }
+ });
+ }
+ });
+ }
+});
+
+amqpcb.connect("amqp://localhost", (err, connection) => {
+ if(!err) {
+ connection.createChannel((err, channel) => {
+ if (!err) {
+ channel.assertQueue("myQueue", {}, (err, ok) => {
+ if(!err) {
+ channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()));
+ }
+ });
+ }
+ });
+ }
+});
diff --git a/amqplib/amqplib.d.ts b/amqplib/amqplib.d.ts
index 0c7f0720a..f125aaa07 100644
--- a/amqplib/amqplib.d.ts
+++ b/amqplib/amqplib.d.ts
@@ -1,22 +1,12 @@
// Type definitions for amqplib 0.3.x
// Project: https://github.com/squaremo/amqp.node
-// Definitions by: Michael Nahkies
+// Definitions by: Michael Nahkies , Ab Reitsma
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///
///
-declare module "amqplib" {
-
- import events = require("events");
- import when = require("when");
-
- interface Connection extends events.EventEmitter {
- close(): when.Promise;
- createChannel(): when.Promise;
- createConfirmChannel(): when.Promise;
- }
-
+declare module "amqplib/properties" {
module Replies {
interface Empty {
}
@@ -25,6 +15,9 @@ declare module "amqplib" {
messageCount: number;
consumerCount: number;
}
+ interface PurgeQueue {
+ messageCount: number;
+ }
interface DeleteQueue {
messageCount: number;
}
@@ -100,6 +93,22 @@ declare module "amqplib" {
fields: Object;
properties: Object;
}
+}
+
+declare module "amqplib" {
+
+ import events = require("events");
+ import when = require("when");
+ import shared = require("amqplib/properties")
+ import Replies = shared.Replies;
+ import Options = shared.Options;
+ import Message = shared.Message;
+
+ interface Connection extends events.EventEmitter {
+ close(): when.Promise;
+ createChannel(): when.Promise;
+ createConfirmChannel(): when.Promise;
+ }
interface Channel extends events.EventEmitter {
close(): when.Promise;
@@ -108,7 +117,7 @@ declare module "amqplib" {
checkQueue(queue: string): when.Promise;
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise;
- purgeQueue(queue: string): when.Promise;
+ purgeQueue(queue: string): when.Promise;
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise;
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise;
@@ -142,3 +151,68 @@ declare module "amqplib" {
function connect(url: string, socketOptions?: any): when.Promise;
}
+
+declare module "amqplib/callback_api" {
+
+ import events = require("events");
+ import shared = require("amqplib/properties")
+ import Replies = shared.Replies;
+ import Options = shared.Options;
+ import Message = shared.Message;
+
+ interface Connection extends events.EventEmitter {
+ close(callback?: (err: any) => void): void;
+ createChannel(callback: (err: any, channel: Channel) => void): void;
+ createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
+ }
+
+ interface Channel extends events.EventEmitter {
+ close(callback: (err: any) => void): void;
+
+ assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void;
+ checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
+
+ deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void;
+ purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void;
+
+ bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
+ unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
+
+ assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void;
+ checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void;
+
+ deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void;
+
+ bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
+ unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
+
+ publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
+ sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
+
+ consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
+
+ cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
+ get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void;
+
+ ack(message: Message, allUpTo?: boolean): void;
+ ackAll(): void;
+
+ nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
+ nackAll(requeue?: boolean): void;
+ reject(message: Message, requeue?: boolean): void;
+
+ prefetch(count: number, global?: boolean): void;
+ recover(callback?: (err: any, ok: Replies.Empty) => void): void;
+ }
+
+ interface ConfirmChannel extends Channel {
+ publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
+ sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
+
+ waitForConfirms(callback?: (err: any) => void): void;
+ }
+
+ function connect(callback: (err: any, connection: Connection) => void): void;
+ function connect(url: string, callback: (err: any, connection: Connection) => void): void;
+ function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
+}
diff --git a/async/async.d.ts b/async/async.d.ts
index 6054e9a47..418f5539b 100644
--- a/async/async.d.ts
+++ b/async/async.d.ts
@@ -76,11 +76,11 @@ interface Async {
each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void;
eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void;
eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void;
- forEachOf(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
+ forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void;
- forEachOfSeries(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
+ forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void;
- forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
+ forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void;
map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any;
mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any;
diff --git a/closure-compiler/closure-compiler-tests.ts b/closure-compiler/closure-compiler-tests.ts
new file mode 100644
index 000000000..e0bd650a3
--- /dev/null
+++ b/closure-compiler/closure-compiler-tests.ts
@@ -0,0 +1,17 @@
+///
+import {compile} from 'closure-compiler';
+
+compile('some.source()', {'check-only': null},
+ (err: Error, stdout: string, stderr: string): void => {
+ console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
+ });
+
+// No options, Callback wins.
+compile('some.source()', (err: Error, stdout: string, stderr: string): void => {
+ console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
+});
+
+compile(null, {'js': ['a/f.js', 'a/f2.js'], 'check-only': null},
+ (err: Error, stdout: string, stderr: string): void => {
+ console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
+ });
diff --git a/closure-compiler/closure-compiler.d.ts b/closure-compiler/closure-compiler.d.ts
new file mode 100644
index 000000000..0d1aba741
--- /dev/null
+++ b/closure-compiler/closure-compiler.d.ts
@@ -0,0 +1,11 @@
+// Type definitions for closure-compiler
+// Project: https://github.com/tim-smart/node-closure/
+// Definitions by: Martin Probst
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module 'closure-compiler' {
+ type Callback = (err: Error, stdout: string, stderr: string) => any;
+ function compile(src: string, callback: Callback): void;
+ function compile(src: string, options: {[k: string]: string | string[]},
+ callback: Callback): void;
+}
diff --git a/connect/connect-tests.ts b/connect/connect-tests.ts
new file mode 100644
index 000000000..e8665f8f9
--- /dev/null
+++ b/connect/connect-tests.ts
@@ -0,0 +1,32 @@
+///
+
+import * as http from "http";
+import * as connect from "connect";
+
+const app = connect();
+
+// log all requests
+app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
+ console.log(req, res);
+ next();
+});
+
+// Stop on errors
+app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
+ if (err) {
+ return res.end(`Error: ${err}`);
+ }
+
+ next();
+});
+
+// respond to all requests
+app.use((req: http.IncomingMessage, res: http.ServerResponse) => {
+ res.end("Hello from Connect!\n");
+});
+
+//create node.js http server and listen on port
+http.createServer(app).listen(3000);
+
+//create node.js http server and listen on port using connect shortcut
+app.listen(3000);
diff --git a/connect/connect.d.ts b/connect/connect.d.ts
new file mode 100644
index 000000000..575a341b6
--- /dev/null
+++ b/connect/connect.d.ts
@@ -0,0 +1,92 @@
+// Type definitions for connect v3.4.0
+// Project: https://github.com/senchalabs/connect
+// Definitions by: Maxime LUCE
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "connect" {
+ import * as http from "http";
+
+ /**
+ * Create a new connect server.
+ * @public
+ */
+ function createServer(): createServer.Server;
+
+ module createServer {
+ export type ServerHandle = HandleFunction | http.Server;
+
+ export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
+ export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
+ export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
+ export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
+
+ export interface ServerStackItem {
+ route: string;
+ handle: ServerHandle;
+ }
+
+ export interface Server extends NodeJS.EventEmitter {
+ (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
+
+ route: string;
+ stack: ServerStackItem[];
+
+ /**
+ * Utilize the given middleware `handle` to the given `route`,
+ * defaulting to _/_. This "route" is the mount-point for the
+ * middleware, when given a value other than _/_ the middleware
+ * is only effective when that segment is present in the request's
+ * pathname.
+ *
+ * For example if we were to mount a function at _/admin_, it would
+ * be invoked on _/admin_, and _/admin/settings_, however it would
+ * not be invoked for _/_, or _/posts_.
+ *
+ * @public
+ */
+ use(fn: HandleFunction): Server;
+ use(route: string, fn: HandleFunction): Server;
+
+ /**
+ * Handle server requests, punting them down
+ * the middleware stack.
+ *
+ * @private
+ */
+ handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
+
+ /**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * HTTP and HTTPS:
+ *
+ * If you run your application both as HTTP
+ * and HTTPS you may wrap them individually,
+ * since your Connect "server" is really just
+ * a JavaScript `Function`.
+ *
+ * var connect = require('connect')
+ * , http = require('http')
+ * , https = require('https');
+ *
+ * var app = connect();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer(options, app).listen(443);
+ *
+ * @api public
+ */
+ listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
+ listen(port: number, hostname?: string, callback?: Function): http.Server;
+ listen(path: string, callback?: Function): http.Server;
+ listen(handle: any, listeningListener?: Function): http.Server;
+ }
+ }
+
+ export = createServer;
+}
diff --git a/faker/faker.d.ts b/faker/faker.d.ts
index 6397dd993..01ce203ea 100644
--- a/faker/faker.d.ts
+++ b/faker/faker.d.ts
@@ -171,6 +171,8 @@ declare module Faker {
uuid(): string;
boolean(): boolean;
};
+
+ seed(value: number): void;
}
interface Card {
diff --git a/finalhandler/finalhandler-tests.ts b/finalhandler/finalhandler-tests.ts
new file mode 100644
index 000000000..cb8dc053d
--- /dev/null
+++ b/finalhandler/finalhandler-tests.ts
@@ -0,0 +1,17 @@
+///
+
+import {ServerRequest, ServerResponse} from "http";
+import finalHandler from "finalhandler";
+
+let req: ServerRequest;
+let res: ServerResponse;
+let options: {
+ onerror: (err: any, req: ServerRequest, res: ServerResponse) => void;
+ message: boolean|((err: any, status: number) => string);
+ stacktrace: boolean;
+};
+
+let result: (err: any) => void;
+
+result = finalHandler(req, res);
+result = finalHandler(req, res, options);
diff --git a/finalhandler/finalhandler.d.ts b/finalhandler/finalhandler.d.ts
new file mode 100644
index 000000000..37e931718
--- /dev/null
+++ b/finalhandler/finalhandler.d.ts
@@ -0,0 +1,20 @@
+// Type definitions for finalhandler
+// Project: https://github.com/pillarjs/finalhandler
+// Definitions by: Ilya Mochalov
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "finalhandler" {
+ import {ServerRequest, ServerResponse} from "http";
+
+ export interface Options {
+ message?: boolean|((err: any, status: number) => string);
+ onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
+ stacktrace?: boolean;
+ }
+
+ function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void;
+
+ export default finalHandler;
+}
diff --git a/flat/flat-tests.ts b/flat/flat-tests.ts
new file mode 100644
index 000000000..b6909cdb1
--- /dev/null
+++ b/flat/flat-tests.ts
@@ -0,0 +1,57 @@
+///
+
+import {flatten, unflatten} from "flat";
+
+module TestFlatten {
+ let options: {
+ delimiter?: string;
+ safe?: boolean;
+ maxDepth?: number;
+ };
+
+ type Target = {
+ a: {
+ b: number;
+ },
+ c: boolean[][];
+ };
+
+ let target: Target;
+
+ type Result = {
+ 'a.b': number;
+ 'c.0.0': boolean;
+ };
+
+ let result: Result;
+
+ result = flatten(target);
+ result = flatten(target, options);
+}
+
+module TestUnflatten {
+ let options: {
+ delimiter?: string;
+ object?: boolean;
+ overwrite?: boolean;
+ };
+
+ type Target = {
+ 'a.b': number;
+ 'c.0.0': boolean;
+ };
+
+ let target: Target;
+
+ type Result = {
+ a: {
+ b: number;
+ },
+ c: boolean[][];
+ };
+
+ let result: Result;
+
+ result = unflatten(target);
+ result = unflatten(target, options);
+}
diff --git a/flat/flat.d.ts b/flat/flat.d.ts
new file mode 100644
index 000000000..f3698f125
--- /dev/null
+++ b/flat/flat.d.ts
@@ -0,0 +1,41 @@
+// Type definitions for flat
+// Project: https://github.com/hughsk/flat
+// Definitions by: Ilya Mochalov
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module FlatTypes {
+ interface FlattenOptions {
+ delimiter?: string;
+ safe?: boolean;
+ maxDepth?: number;
+ }
+
+ interface Flatten {
+ (
+ target: TTarget,
+ options?: FlattenOptions
+ ): TResult;
+
+ flatten: Flatten;
+ unflatten: Unflatten;
+ }
+
+ interface UnflattenOptions {
+ delimiter?: string;
+ object?: boolean;
+ overwrite?: boolean;
+ }
+
+ interface Unflatten {
+ (
+ target: TTarget,
+ options?: UnflattenOptions
+ ): TResult;
+ }
+}
+
+declare module "flat" {
+ var flatten: FlatTypes.Flatten;
+
+ export = flatten;
+}
diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts
index 850d0b226..e503cb572 100644
--- a/gruntjs/gruntjs.d.ts
+++ b/gruntjs/gruntjs.d.ts
@@ -192,6 +192,12 @@ declare module grunt {
*/
requires(prop: string, ...andProps: string[]): void
requires(prop: string[], ...andProps: string[][]): void
+
+ /**
+ * Recursively merges properties of the specified configObject into the current project configuration.
+ * You can use this method to append configuration options, targets, etc., to already defined tasks.
+ */
+ merge(configObject: T): void;
}
}
diff --git a/gulp-inject/gulp-inject.d.ts b/gulp-inject/gulp-inject.d.ts
index 42f5fb348..fb2668a1f 100644
--- a/gulp-inject/gulp-inject.d.ts
+++ b/gulp-inject/gulp-inject.d.ts
@@ -22,8 +22,11 @@ declare module "gulp-inject" {
ignorePath?: string | string[];
relative?: boolean;
addPrefix?: string;
+ addSuffix?: string;
addRootSlash?: boolean;
name?: string;
+ removeTags?: boolean;
+ empty?: boolean;
starttag?: string | ITagFunction;
endtag?: string | ITagFunction;
transform?: ITransformFunction;
diff --git a/iniparser/iniparser-tests.ts b/iniparser/iniparser-tests.ts
new file mode 100644
index 000000000..8558766df
--- /dev/null
+++ b/iniparser/iniparser-tests.ts
@@ -0,0 +1,21 @@
+///
+
+import * as iniparser from 'iniparser';
+
+type Result = {section: {param: string}};
+
+let file: string;
+
+{
+ let callback: (err: any, data: Result) => void;
+ let result: void;
+
+ iniparser.parse(file, callback);
+}
+
+{
+ let result: Result;
+
+ result = iniparser.parseSync(file);
+ result = iniparser.parseString('');
+}
diff --git a/iniparser/iniparser.d.ts b/iniparser/iniparser.d.ts
new file mode 100644
index 000000000..81fd07377
--- /dev/null
+++ b/iniparser/iniparser.d.ts
@@ -0,0 +1,15 @@
+// Type definitions for iniparser
+// Project: https://github.com/shockie/node-iniparser
+// Definitions by: Ilya Mochalov
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module "iniparser" {
+ export function parse(
+ file: string,
+ callback: (err: any, data: T) => void
+ ): void;
+
+ export function parseSync(file: string): T;
+
+ export function parseString(data: string): T;
+}
diff --git a/jest/jest.d.ts b/jest/jest.d.ts
index d500525b6..2ee765728 100644
--- a/jest/jest.d.ts
+++ b/jest/jest.d.ts
@@ -40,6 +40,7 @@ declare module jest {
toBeFalsy(): boolean;
toBeTruthy(): boolean;
toBeNull(): boolean;
+ toBeDefined(): boolean;
toBeUndefined(): boolean;
toMatch(expected: RegExp): boolean;
toContain(expected: string): boolean;
diff --git a/jquery.pnotify/jquery.pnotify.d.ts b/jquery.pnotify/jquery.pnotify.d.ts
index 6e3e67cd3..a21416f84 100644
--- a/jquery.pnotify/jquery.pnotify.d.ts
+++ b/jquery.pnotify/jquery.pnotify.d.ts
@@ -11,6 +11,8 @@ interface PNotifyStack {
push?: string;
spacing1?: number;
spacing2?: number;
+ firstpos1?: number;
+ firstpos2?: number;
context?: JQuery
}
diff --git a/knex/knex-test.ts b/knex/knex-test.ts
index 081f98867..1d468b260 100644
--- a/knex/knex-test.ts
+++ b/knex/knex-test.ts
@@ -12,6 +12,7 @@ var knex = Knex({
});
var knex = Knex({
+ debug: true,
client: 'mysql',
connection: {
socketPath : '/path/to/socket.sock',
@@ -32,7 +33,13 @@ var knex = Knex({
},
pool: {
min: 0,
- max: 7
+ max: 7,
+ afterCreate: (connection: any, callback: Function) => {
+ return callback(null, connection);
+ },
+ beforeDestroy: (connection: any, callback: Function) => {
+ return callback(null, connection);
+ }
}
});
diff --git a/knex/knex.d.ts b/knex/knex.d.ts
index 82c26cfec..d2afc4aa8 100644
--- a/knex/knex.d.ts
+++ b/knex/knex.d.ts
@@ -135,6 +135,8 @@ declare module "knex" {
transacting(trx: Transaction): QueryBuilder;
connection(connection: any): QueryBuilder;
+
+ clone(): QueryBuilder;
}
interface As {
@@ -394,6 +396,7 @@ declare module "knex" {
}
interface Config {
+ debug?: boolean;
client?: string;
dialect?: string;
connection: string|ConnectionConfig|
@@ -427,7 +430,9 @@ declare module "knex" {
interface PoolConfig {
name?: string;
create?: Function;
+ afterCreate?: Function;
destroy?: Function;
+ beforeDestroy?: Function;
min?: number;
max?: number;
refreshIdle?: boolean;
diff --git a/ko.plus/ko.plus-tests.ts b/ko.plus/ko.plus-tests.ts
index 7dd1053b2..bff291d83 100644
--- a/ko.plus/ko.plus-tests.ts
+++ b/ko.plus/ko.plus-tests.ts
@@ -11,6 +11,9 @@
Version 1.1 - added test for makeEditable
+ Version 1.2 - amended callback on commmand.fail() method - accepts response,
+ status and message values
+
Note: Typescript version 1.4 or higher is required for union types
and type declarations
*/
@@ -29,8 +32,13 @@ function CommandTests() {
.done((data: any) => {
alert("success");
})
- .fail((error: string) => {
- alert(error);
+ .fail((response) => {
+ // dummy
+ return false;
+ })
+ .fail((response, status, message) => {
+ // fail has response, error and text
+ alert(status + message);
});
// initialize command with options (action only)
diff --git a/ko.plus/ko.plus.d.ts b/ko.plus/ko.plus.d.ts
index dacf6121f..4c9299aee 100644
--- a/ko.plus/ko.plus.d.ts
+++ b/ko.plus/ko.plus.d.ts
@@ -1,8 +1,9 @@
-// Type definitions for ko.plus v0.0.21
+// Type definitions for ko.plus v0.0.24
// Project: https://github.com/stevegreatrex/ko.plus
// Definitions by: Howard Richards
// Definitions: https://github.com/borisyankov/DefinitelyTyped
+///
///
/**
@@ -16,6 +17,9 @@
*
* Version 1.1 - fixed bug - makeEditable is now a function on .editable
* also refactored how the Editable classes inherit to simplify
+ *
+ * Version 1.2 - amended callback on commmand.fail() method - accepts response,
+ * status and message values
*/
//
@@ -87,7 +91,7 @@ declare module KoPlus {
//
done: (callback: (data: any) => void) => Command;
- fail: (callback: (error: string) => void) => Command;
+ fail: (callback: (response: any, status?: string, statusText?:string) => void) => Command;
always: (callback: Function) => Command;
diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts
index 974d0b966..c083edd4c 100644
--- a/lodash/lodash-tests.ts
+++ b/lodash/lodash-tests.ts
@@ -104,46 +104,43 @@ result = <(key: string) => any>testMapCache.get;
result = <(key: string) => boolean>testMapCache.has;
result = <(key: string, value: any) => _.Dictionary>testMapCache.set;
-/*************
- * Chaining *
- *************/
-result = <_.LoDashWrapper>_('test');
-result = <_.LoDashWrapper>_(1);
-result = <_.LoDashWrapper>_(true);
-result = <_.LoDashArrayWrapper>_(['test1', 'test2']);
-// Appears to be a change in the compiler, if the type explicity implements the object indexer.
-// Looking at: https://typescript.codeplex.com/wikipage?title=Known%20breaking%20changes%20between%200.8%20and%200.9&referringTitle=Documentation
-// "The ‘noimplicitany’ option now warns on the use of the hidden default indexer"
-result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' });
+// _
+module TestWrapper {
+ {
+ let result: _.LoDashImplicitWrapper;
+ result = _('');
+ }
-result = <_.LoDashWrapper>_.chain('test');
-result = <_.LoDashWrapper>_('test').chain();
-result = <_.LoDashWrapper>_.chain(1);
-result = <_.LoDashWrapper>_(1).chain();
-result = <_.LoDashWrapper>_.chain(true);
-result = <_.LoDashWrapper>_(true).chain();
-result = <_.LoDashArrayWrapper>_.chain(['test1', 'test2']);
-result = <_.LoDashArrayWrapper>_(['test1', 'test2']).chain();
-result = <_.LoDashObjectWrapper<_.Dictionary>>_.chain(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' });
-result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).chain();
+ {
+ let result: _.LoDashImplicitWrapper;
+ result = _(42);
+ }
+
+ {
+ let result: _.LoDashImplicitWrapper;
+ result = _(true);
+ }
+
+ {
+ let result: _.LoDashImplicitArrayWrapper;
+ result = _(['']);
+ }
+
+ {
+ let result: _.LoDashImplicitObjectWrapper<{a: string}>;
+ result = _<{a: string}>({a: ''});
+ }
+}
//Wrapped array shortcut methods
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).concat(5, 6);
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).concat([5, 6]);
result = _([1, 2, 3, 4]).join(',');
result = _([1, 2, 3, 4]).pop();
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7);
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).reverse();
+result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7);
result = _([1, 2, 3, 4]).shift();
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1);
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1);
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6);
-
-result = _.tap([1, 2, 3, 4], function (array) { console.log(array); });
-result = <_.LoDashWrapper>_('test').tap(function (value) { console.log(value); });
-result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).tap(function (array) { console.log(array); });
-result = <_.LoDashObjectWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).tap(function (array) { console.log(array); });
+result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1);
+result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1);
+result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
+result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6);
result = _('test').toString();
result = _([1, 2, 3]).toString();
@@ -412,10 +409,10 @@ result = >_.flatten([1, [2], [[3]]], true);
result = >_.flatten([1, [2], [3, [[4]]]], true);
result = >_.flatten([1, [2], [3, [[false]]]], true);
-result = <_.LoDashArrayWrapper>_([[1, 2], [3, 4], 5, 6]).flatten();
-result = <_.LoDashArrayWrapper>>>_([1, [2], [3, [[4]]]]).flatten();
+result = <_.LoDashImplicitArrayWrapper>_([[1, 2], [3, 4], 5, 6]).flatten();
+result = <_.LoDashImplicitArrayWrapper>>>_([1, [2], [3, [[4]]]]).flatten();
-result = <_.LoDashArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true);
+result = <_.LoDashImplicitArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true);
// _.flattenDeep
module TestFlattenDeep {
@@ -1053,76 +1050,417 @@ result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1,
* Chain *
*********/
+// _.chain
+module TestChain {
+ {
+ let result: _.LoDashExplicitWrapper;
+
+ result = _.chain('');
+ result = _('').chain();
+
+ result = _.chain('').chain();
+ result = _('').chain().chain();
+ }
+
+ {
+ let result: _.LoDashExplicitWrapper;
+
+ result = _.chain(42);
+ result = _(42).chain();
+ }
+
+ {
+ let result: _.LoDashExplicitWrapper;
+
+ result = _.chain(true);
+ result = _(true).chain();
+ }
+
+ {
+ let result: _.LoDashExplicitArrayWrapper;
+
+ result = _.chain(['']);
+ result = _(['']).chain();
+ }
+
+ {
+ let result: _.LoDashExplicitObjectWrapper<{a: string}>;
+
+ result = _.chain<{a: string}>({a: ''});
+ result = _<{a: string}>({a: ''}).chain();
+ }
+}
+
+// _.tap
+module TestTap {
+ {
+ let interceptor: (value: string) => void;
+ let result: string;
+
+ _.tap('', interceptor);
+ _.tap('', interceptor, any);
+ }
+
+ {
+ let interceptor: (value: string[]) => void;
+ let result: _.LoDashImplicitArrayWrapper;
+
+ _.tap([''], interceptor);
+ _.tap([''], interceptor, any);
+ }
+
+ {
+ let interceptor: (value: {a: string}) => void;
+ let result: _.LoDashImplicitObjectWrapper<{a: string}>;
+
+ _.tap({a: ''}, interceptor);
+ _.tap({a: ''}, interceptor, any);
+ }
+
+ {
+ let interceptor: (value: string) => void;
+ let result: _.LoDashImplicitWrapper;
+
+ _.chain('').tap(interceptor, any);
+ _.chain('').tap(interceptor, any);
+
+ _('').tap(interceptor);
+ _('').tap(interceptor, any);
+ }
+
+ {
+ let interceptor: (value: string[]) => void;
+ let result: _.LoDashImplicitArrayWrapper;
+
+ _.chain(['']).tap(interceptor);
+ _.chain(['']).tap(interceptor, any);
+
+ _(['']).tap(interceptor);
+ _(['']).tap(interceptor, any);
+ }
+
+ {
+ let interceptor: (value: {a: string}) => void;
+ let result: _.LoDashImplicitObjectWrapper<{a: string}>;
+
+ _.chain({a: ''}).tap(interceptor);
+ _.chain({a: ''}).tap(interceptor, any);
+
+ _({a: ''}).tap(interceptor);
+ _({a: ''}).tap(interceptor, any);
+ }
+
+ {
+ let interceptor: (value: string) => void;
+ let result: _.LoDashExplicitWrapper;
+
+ _.chain('').tap(interceptor, any);
+ _.chain('').tap(interceptor, any);
+
+ _('').chain().tap(interceptor);
+ _('').chain().tap(interceptor, any);
+ }
+
+ {
+ let interceptor: (value: string[]) => void;
+ let result: _.LoDashExplicitArrayWrapper;
+
+ _.chain(['']).tap(interceptor);
+ _.chain(['']).tap(interceptor, any);
+
+ _(['']).chain().tap(interceptor);
+ _(['']).chain().tap(interceptor, any);
+ }
+
+ {
+ let interceptor: (value: {a: string}) => void;
+ let result: _.LoDashExplicitObjectWrapper<{a: string}>;
+
+ _.chain({a: ''}).tap(interceptor);
+ _.chain({a: ''}).tap(interceptor, any);
+
+ _({a: ''}).chain().tap(interceptor);
+ _({a: ''}).chain().tap(interceptor, any);
+ }
+}
+
// _.thru
-{
- let result: number;
- result = _.thru(1, (value: number) => value);
- result = _.thru(1, (value: number) => value, any);
-}
-{
- let result: _.LoDashWrapper;
- result = _(1).thru((value: number) => value);
- result = _(1).thru((value: number) => value, any);
-}
-{
- let result: _.LoDashWrapper;
- result = _('').thru((value: string) => value);
- result = _('').thru((value: string) => value, any);
-}
-{
- let result: _.LoDashWrapper;
- result = _(true).thru((value: boolean) => value);
- result = _(true).thru((value: boolean) => value, any);
-}
-{
- let result: _.LoDashObjectWrapper;
- result = _({}).thru