, componentClass: ReactComponentFactory): Component
;
+ scryRenderedComponentsWithType
(tree: ReactElement, componentClass: ReactComponentFactory): Component
[];
}
export interface SyntheticEventData {
diff --git a/socket.io-client/socket.io-client-commonjs-tests.ts b/socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts
similarity index 81%
rename from socket.io-client/socket.io-client-commonjs-tests.ts
rename to socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts
index 7b5f967473..beb8f0fad5 100644
--- a/socket.io-client/socket.io-client-commonjs-tests.ts
+++ b/socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts
@@ -1,10 +1,10 @@
-import io = require('socket.io-client');
-
-var socket = io.connect('http://localhost:80');
-
-socket.on('connect', function () {
- console.log('Connected!');
- socket.emit('event', 'some test data', function () {
- console.log('Sent some data.');
- });
-});
+import io = require('socket.io-client-0.9');
+
+var socket = io.connect('http://localhost:80');
+
+socket.on('connect', function () {
+ console.log('Connected!');
+ socket.emit('event', 'some test data', function () {
+ console.log('Sent some data.');
+ });
+});
diff --git a/socket.io-client/legacy/socket.io-client-0.9-tests.ts b/socket.io-client/legacy/socket.io-client-0.9-tests.ts
new file mode 100644
index 0000000000..7178306281
--- /dev/null
+++ b/socket.io-client/legacy/socket.io-client-0.9-tests.ts
@@ -0,0 +1,10 @@
+///
+
+var socket = io.connect('http://localhost:80');
+
+socket.on('connect', function () {
+ console.log('Connected!');
+ socket.emit('event', 'some test data', function () {
+ console.log('Sent some data.');
+ });
+});
diff --git a/socket.io-client/legacy/socket.io-client-0.9.d.ts b/socket.io-client/legacy/socket.io-client-0.9.d.ts
new file mode 100644
index 0000000000..0b3626e420
--- /dev/null
+++ b/socket.io-client/legacy/socket.io-client-0.9.d.ts
@@ -0,0 +1,40 @@
+// Type definitions for socket.io nodejs client
+// Project: http://socket.io/
+// Definitions by: Maido Kaara
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module "socket.io-client-0.9" {
+ export = io;
+}
+
+declare var io: SocketIOStatic;
+
+interface SocketIOStatic {
+ connect(host: string, details?: any): SocketIOClient.Socket;
+}
+
+declare module SocketIOClient {
+ interface EventEmitter {
+ emit(name: string, ...data: any[]): any;
+ on(ns: string, fn: Function): EventEmitter;
+ addListener(ns: string, fn: Function): EventEmitter;
+ removeListener(ns: string, fn: Function): EventEmitter;
+ removeAllListeners(ns: string): EventEmitter;
+ once(ns: string, fn: Function): EventEmitter;
+ listeners(ns: string): Function[];
+ }
+
+ interface SocketNamespace extends EventEmitter {
+ of(name: string): SocketNamespace;
+ send(data: any, fn: Function): SocketNamespace;
+ emit(name: string): SocketNamespace;
+ }
+
+ interface Socket extends EventEmitter {
+ of(name: string): SocketNamespace;
+ connect(fn: Function): Socket;
+ packet(data: any): Socket;
+ flushBuffer(): void;
+ disconnect(): Socket;
+ }
+}
diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts
index e1022c61af..215932c460 100644
--- a/socket.io-client/socket.io-client-tests.ts
+++ b/socket.io-client/socket.io-client-tests.ts
@@ -1,10 +1,57 @@
///
-var socket = io.connect('http://localhost:80');
-
-socket.on('connect', function () {
- console.log('Connected!');
- socket.emit('event', 'some test data', function () {
- console.log('Sent some data.');
+function testUsingWithNodeHTTPServer() {
+ var socket = io('http://localhost');
+ socket.on('news', function (data: any) {
+ console.log(data);
+ socket.emit('my other event', { my: 'data' });
});
-});
+}
+
+function testUsingWithExpress() {
+ var socket = io.connect('http://localhost');
+ socket.on('news', function (data: any) {
+ console.log(data);
+ socket.emit('my other event', { my: 'data' });
+ });
+}
+
+function testUsingWithTheExpressFramework() {
+ var socket = io.connect('http://localhost');
+ socket.on('news', function (data: any) {
+ console.log(data);
+ socket.emit('my other event', { my: 'data' });
+ });
+}
+
+function testRestrictingYourselfToANamespace() {
+ var chat = io.connect('http://localhost/chat')
+ , news = io.connect('http://localhost/news');
+
+ chat.on('connect', function () {
+ chat.emit('hi!');
+ });
+
+ news.on('news', function () {
+ news.emit('woot');
+ });
+}
+
+function testSendingAndGettingData() {
+ var socket = io();
+ socket.on('connect', function () {
+ socket.emit('ferret', 'tobi', function (data: any) {
+ console.log(data);
+ });
+ });
+}
+
+function testUsingItJustAsACrossBrowserWebSocket() {
+ var socket = io('http://localhost/');
+ socket.on('connect', function () {
+ socket.emit('hi');
+
+ socket.on('message', function (msg: any) {
+ });
+ });
+}
diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts
index 079ca7cbb8..b03cc830bc 100644
--- a/socket.io-client/socket.io-client.d.ts
+++ b/socket.io-client/socket.io-client.d.ts
@@ -1,40 +1,46 @@
-// Type definitions for socket.io nodejs client
+// Type definitions for socket.io-client 1.2.0
// Project: http://socket.io/
-// Definitions by: Maido Kaara
+// Definitions by: PROGRE
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-declare module "socket.io-client" {
- export = io;
+///
+
+declare var io: SocketIOClientStatic;
+
+declare module 'socket.io-client' {
+ export = io;
}
-declare var io: SocketIOStatic;
-
-interface SocketIOStatic {
+interface SocketIOClientStatic {
+ (host: string, details?: any): SocketIOClient.Socket;
+ (details?: any): SocketIOClient.Socket;
connect(host: string, details?: any): SocketIOClient.Socket;
+ connect(details?: any): SocketIOClient.Socket;
+ protocol: number;
+ Socket: { new (...args: any[]): SocketIOClient.Socket };
+ Manager: SocketIOClient.ManagerStatic;
}
declare module SocketIOClient {
- interface EventEmitter {
- emit(name: string, ...data: any[]): any;
- on(ns: string, fn: Function): EventEmitter;
- addListener(ns: string, fn: Function): EventEmitter;
- removeListener(ns: string, fn: Function): EventEmitter;
- removeAllListeners(ns: string): EventEmitter;
- once(ns: string, fn: Function): EventEmitter;
- listeners(ns: string): Function[];
+ interface Socket {
+ on(event: string, fn: Function): Socket;
+ once(event: string, fn: Function): Socket;
+ off(event: string, fn: Function): Socket;
+ emit(event: string, ...args: any[]): Socket;
+ listeners(event: string): Function[];
+ hasListeners(event: string): boolean;
}
- interface SocketNamespace extends EventEmitter {
- of(name: string): SocketNamespace;
- send(data: any, fn: Function): SocketNamespace;
- emit(name: string): SocketNamespace;
+ interface ManagerStatic {
+ (url: string, opts: any): SocketIOClient.Manager;
+ new (url: string, opts: any): SocketIOClient.Manager;
}
- interface Socket extends EventEmitter {
- of(name: string): SocketNamespace;
- connect(fn: Function): Socket;
- packet(data: any): Socket;
- flushBuffer(): void;
- disconnect(): Socket;
+ interface Manager {
+ reconnection(v: boolean): Manager;
+ reconnectionAttempts(v: boolean): Manager;
+ reconnectionDelay(v: boolean): Manager;
+ reconnectionDelayMax(v: boolean): Manager;
+ timeout(v: boolean): Manager;
}
}
diff --git a/socket.io/legacy/socket.io-0.9-tests.ts b/socket.io/legacy/socket.io-0.9-tests.ts
new file mode 100644
index 0000000000..0d7e12bb6d
--- /dev/null
+++ b/socket.io/legacy/socket.io-0.9-tests.ts
@@ -0,0 +1,24 @@
+import io = require('socket.io-0.9');
+
+var socketManager = io.listen(80);
+
+socketManager.sockets.on('connection', socket => {
+ socket.emit('news', { hello: 'world' });
+ socket.on('my other event', data => {
+ console.log(data);
+ });
+});
+
+// Storing data Associated to a client.
+// Server side sample
+io.listen(80).sockets.on('connection', function (socket) {
+ socket.on('set nickname', function (name) {
+ socket.set('nickname', name, function () { socket.emit('ready'); });
+ });
+
+ socket.on('msg', function () {
+ socket.get('nickname', function (err, name) {
+ console.log('Chat message by ', name);
+ });
+ });
+});
\ No newline at end of file
diff --git a/socket.io/socket.io-tests.ts.tscparams b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams
similarity index 50%
rename from socket.io/socket.io-tests.ts.tscparams
rename to socket.io/legacy/socket.io-0.9-tests.ts.tscparams
index d3f5a12faa..8b13789179 100644
--- a/socket.io/socket.io-tests.ts.tscparams
+++ b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams
@@ -1 +1 @@
-
+
diff --git a/socket.io/legacy/socket.io-0.9.d.ts b/socket.io/legacy/socket.io-0.9.d.ts
new file mode 100644
index 0000000000..5ead4abde5
--- /dev/null
+++ b/socket.io/legacy/socket.io-0.9.d.ts
@@ -0,0 +1,70 @@
+// Type definitions for socket.io
+// Project: http://socket.io/
+// Definitions by: William Orr
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+///
+
+declare module "socket.io-0.9" {
+ import http = require('http');
+
+ export function listen(server: http.Server, options: any, fn: Function): SocketManager;
+ export function listen(server: http.Server, fn?: Function): SocketManager;
+ export function listen(port: Number): SocketManager;
+
+
+ interface Socket {
+ id: string;
+ json:any;
+ log: any;
+ volatile: any;
+ broadcast: any;
+ handshake: any;
+ in(room: string): Socket;
+ to(room: string): Socket;
+ join(name: string, fn: Function): Socket;
+ leave(name: string, fn: Function): Socket;
+ set(key: string, value: any, fn: Function): Socket;
+ get(key: string, fn: Function): Socket;
+ has(key: string, fn: Function): Socket;
+ del(key: string, fn: Function): Socket;
+ disconnect(): Socket;
+ send(data: any, fn: Function): Socket;
+ emit(ev: any, ...data:any[]): Socket;
+ on(ns: string, fn: Function): Socket;
+ }
+
+ interface SocketNamespace {
+ clients(room: string): Socket[];
+ log: any;
+ store: any;
+ json: any;
+ volatile: any;
+ in(room: string): SocketNamespace;
+ on(evt: string, fn: (socket: Socket) => void): SocketNamespace;
+ to(room: string): SocketNamespace;
+ except(id: any): SocketNamespace;
+ send(data: any): any;
+ emit(ev: any, ...data:any[]): Socket;
+ socket(sid: any, readable: boolean): Socket;
+ authorization(fn: Function): SocketNamespace;
+ }
+
+ interface SocketManager {
+ get(key: any): any;
+ set(key: any, value: any): SocketManager;
+ enable(key: any): SocketManager;
+ disable(key: any): SocketManager;
+ enabled(key: any): boolean;
+ disabled(key: any): boolean;
+ configure(env: string, fn: Function): SocketManager;
+ configure(fn: Function): SocketManager;
+ of(nsp: string): SocketNamespace;
+ on(ns: string, fn: Function): SocketManager;
+ sockets: SocketNamespace;
+ }
+
+
+}
+
diff --git a/socket.io/socket.io-tests.ts b/socket.io/socket.io-tests.ts
index 0b29890ca1..442e677751 100644
--- a/socket.io/socket.io-tests.ts
+++ b/socket.io/socket.io-tests.ts
@@ -1,24 +1,145 @@
-import io = require('socket.io');
-
-var socketManager = io.listen(80);
-
-socketManager.sockets.on('connection', socket => {
- socket.emit('news', { hello: 'world' });
- socket.on('my other event', data => {
- console.log(data);
- });
-});
-
-// Storing data Associated to a client.
-// Server side sample
-io.listen(80).sockets.on('connection', function (socket) {
- socket.on('set nickname', function (name) {
- socket.set('nickname', name, function () { socket.emit('ready'); });
- });
-
- socket.on('msg', function () {
- socket.get('nickname', function (err, name) {
- console.log('Chat message by ', name);
- });
- });
-});
\ No newline at end of file
+import socketIO = require('socket.io');
+
+function testUsingWithNodeHTTPServer() {
+ var app = require('http').createServer(handler);
+ var io = socketIO(app);
+ var fs = require('fs');
+
+ app.listen(80);
+
+ function handler(req: any, res: any) {
+ fs.readFile(__dirname + '/index.html',
+ function (err: any, data: any) {
+ if (err) {
+ res.writeHead(500);
+ return res.end('Error loading index.html');
+ }
+
+ res.writeHead(200);
+ res.end(data);
+ });
+ }
+
+ io.on('connection', function (socket) {
+ socket.emit('news', { hello: 'world' });
+ socket.on('my other event', function (data: any) {
+ console.log(data);
+ });
+ });
+}
+
+function testUsingWithExpress() {
+ var app = require('express')();
+ var server = require('http').Server(app);
+ var io = socketIO(server);
+
+ server.listen(80);
+
+ app.get('/', function (req: any, res: any) {
+ res.sendfile(__dirname + '/index.html');
+ });
+
+ io.on('connection', function (socket) {
+ socket.emit('news', { hello: 'world' });
+ socket.on('my other event', function (data: any) {
+ console.log(data);
+ });
+ });
+}
+
+function testUsingWithTheExpressFramework() {
+ var app = require('express').createServer();
+ var io = socketIO(app);
+
+ app.listen(80);
+
+ app.get('/', function (req: any, res: any) {
+ res.sendfile(__dirname + '/index.html');
+ });
+
+ io.on('connection', function (socket) {
+ socket.emit('news', { hello: 'world' });
+ socket.on('my other event', function (data: any) {
+ console.log(data);
+ });
+ });
+}
+
+function testSendingAndReceivingEvents() {
+ var io = socketIO(80);
+
+ io.on('connection', function (socket) {
+ io.emit('this', { will: 'be received by everyone' });
+
+ socket.on('private message', function (from: any, msg: any) {
+ console.log('I received a private message by ', from, ' saying ', msg);
+ });
+
+ socket.on('disconnect', function () {
+ io.sockets.emit('user disconnected');
+ });
+ });
+}
+
+function testRestrictingYourselfToANamespace() {
+ var io = socketIO.listen(80);
+ var chat = io
+ .of('/chat')
+ .on('connection', function (socket) {
+ socket.emit('a message', {
+ that: 'only'
+ , '/chat': 'will get'
+ });
+ chat.emit('a message', {
+ everyone: 'in'
+ , '/chat': 'will get'
+ });
+ });
+
+ var news = io
+ .of('/news')
+ .on('connection', function (socket) {
+ socket.emit('item', { news: 'item' });
+ });
+}
+
+function testSendingVolatileMessages() {
+ var io = socketIO.listen(80);
+
+ io.sockets.on('connection', function (socket) {
+ var tweets = setInterval(function () {
+ socket.volatile.emit('bieber tweet', {});
+ }, 100);
+
+ socket.on('disconnect', function () {
+ clearInterval(tweets);
+ });
+ });
+}
+
+function testSendingAndGettingData() {
+ var io = socketIO.listen(80);
+
+ io.sockets.on('connection', function (socket) {
+ socket.on('ferret', function (name: any, fn: any) {
+ fn('woot');
+ });
+ });
+}
+
+function testBroadcastingMessages() {
+ var io = socketIO.listen(80);
+
+ io.sockets.on('connection', function (socket) {
+ socket.broadcast.emit('user connected');
+ });
+}
+
+function testUsingItJustAsACrossBrowserWebSocket() {
+ var io = socketIO.listen(80);
+
+ io.sockets.on('connection', function (socket) {
+ socket.on('message', function () { });
+ socket.on('disconnect', function () { });
+ });
+}
diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts
index 184468b127..b6aad32931 100644
--- a/socket.io/socket.io.d.ts
+++ b/socket.io/socket.io.d.ts
@@ -1,70 +1,76 @@
-// Type definitions for socket.io
-// Project: http://socket.io/
-// Definitions by: William Orr
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-
-///
-
-declare module "socket.io" {
- import http = require('http');
-
- export function listen(server: http.Server, options: any, fn: Function): SocketManager;
- export function listen(server: http.Server, fn?: Function): SocketManager;
- export function listen(port: Number): SocketManager;
-
-
- interface Socket {
- id: string;
- json:any;
- log: any;
- volatile: any;
- broadcast: any;
- handshake: any;
- in(room: string): Socket;
- to(room: string): Socket;
- join(name: string, fn: Function): Socket;
- leave(name: string, fn: Function): Socket;
- set(key: string, value: any, fn: Function): Socket;
- get(key: string, fn: Function): Socket;
- has(key: string, fn: Function): Socket;
- del(key: string, fn: Function): Socket;
- disconnect(): Socket;
- send(data: any, fn: Function): Socket;
- emit(ev: any, ...data:any[]): Socket;
- on(ns: string, fn: Function): Socket;
- }
-
- interface SocketNamespace {
- clients(room: string): Socket[];
- log: any;
- store: any;
- json: any;
- volatile: any;
- in(room: string): SocketNamespace;
- on(evt: string, fn: (socket: Socket) => void): SocketNamespace;
- to(room: string): SocketNamespace;
- except(id: any): SocketNamespace;
- send(data: any): any;
- emit(ev: any, ...data:any[]): Socket;
- socket(sid: any, readable: boolean): Socket;
- authorization(fn: Function): SocketNamespace;
- }
-
- interface SocketManager {
- get(key: any): any;
- set(key: any, value: any): SocketManager;
- enable(key: any): SocketManager;
- disable(key: any): SocketManager;
- enabled(key: any): boolean;
- disabled(key: any): boolean;
- configure(env: string, fn: Function): SocketManager;
- configure(fn: Function): SocketManager;
- of(nsp: string): SocketNamespace;
- on(ns: string, fn: Function): SocketManager;
- sockets: SocketNamespace;
- }
-
-
-}
-
+// Type definitions for socket.io 1.2.0
+// Project: http://socket.io/
+// Definitions by: PROGRE
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module 'socket.io' {
+ var server: SocketIOStatic;
+
+ export = server;
+}
+
+interface SocketIOStatic {
+ (): SocketIO.Server;
+ (srv: any, opts?: any): SocketIO.Server;
+ (port: number, opts?: any): SocketIO.Server;
+ (opts: any): SocketIO.Server;
+
+ listen: SocketIOStatic;
+}
+
+declare module SocketIO {
+ interface Server {
+ serveClient(v: boolean): Server;
+ path(v: string): Server;
+ adapter(v: any): Server;
+ origins(v: string): Server;
+ sockets: Namespace;
+ attach(srv: any, opts: any): Server;
+ attach(port: number, opts: any): Server;
+ listen(srv: any, opts: any): Server;
+ listen(port: number, opts: any): Server;
+ bind(srv: any): Server;
+ onconnection(socket: any): Server;
+ of(nsp: string): Namespace;
+ emit(name: string, ...args: any[]): Socket;
+ use(fn: Function): Namespace;
+
+ on(event: 'connection', listener: (socket: Socket) => void): any;
+ on(event: 'connect', listener: (socket: Socket) => void): any;
+ on(event: string, listener: Function): any;
+ }
+
+ interface Namespace extends NodeJS.EventEmitter {
+ name: string;
+ connected: { [id: number]: Socket };
+ use(fn: Function): Namespace
+
+ on(event: 'connection', listener: (socket: Socket) => void): any;
+ on(event: 'connect', listener: (socket: Socket) => void): any;
+ on(event: string, listener: Function): any;
+ }
+
+ interface Socket {
+ rooms: string[];
+ client: Client;
+ conn: Socket;
+ request: any;
+ id: string;
+ emit(name: string, ...args: any[]): Socket;
+ join(name: string, fn?: Function): Socket;
+ leave(name: string, fn?: Function): Socket;
+ to(room: string): Socket;
+ in(room: string): Socket;
+
+ on(event: string, listener: Function): any;
+ broadcast: Socket;
+ volatile: Socket;
+ }
+
+ interface Client {
+ conn: any;
+ request: any;
+ }
+}
diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts
index 9e6f9c4b5b..0abed74380 100644
--- a/superagent/superagent.d.ts
+++ b/superagent/superagent.d.ts
@@ -79,6 +79,8 @@ declare module "superagent" {
subscribe(url: string, callback?: (err: Error, res: Response) => void): Request;
unsubscribe(url: string, callback?: (err: Error, res: Response) => void): Request;
patch(url: string, callback?: (err: Error, res: Response) => void): Request;
+ search(url: string, callback?: (err: Error, res: Response) => void): Request;
+ connect(url: string, callback?: (err: Error, res: Response) => void): Request;
parse(fn: Function): Request;
saveCookies(res: Response): void;
attachCookies(req: Request): void;
diff --git a/supertest/supertest-tests.ts b/supertest/supertest-tests.ts
index c4bdfb2711..120cb43c00 100644
--- a/supertest/supertest-tests.ts
+++ b/supertest/supertest-tests.ts
@@ -29,4 +29,31 @@ request
req.expect(200, (err, res) => {
if (err) throw err;
});
- });
\ No newline at end of file
+ });
+
+// cookie scenario, new version
+var client = supertest.agent(app);
+client
+ .post('/login')
+ .end((err, res) => {
+ if (err) throw err;
+
+ client.get('/admin')
+ .expect(200, (err, res) => {
+ if (err) throw err;
+ });
+ });
+
+// functional expect
+supertest(app)
+ .get('/')
+ .expect(hasPreviousAndNextKeys)
+ .end((err, res) => {
+ if (err) throw err;
+ });
+
+function hasPreviousAndNextKeys(res: supertest.Response) {
+ if (!('next' in res.body)) return "missing next key";
+ if (!('prev' in res.body)) throw new Error("missing prev key");
+}
+
diff --git a/supertest/supertest.d.ts b/supertest/supertest.d.ts
index 9b60431f06..cb2bb78b30 100644
--- a/supertest/supertest.d.ts
+++ b/supertest/supertest.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for SuperTest 0.8.0
+// Type definitions for SuperTest 0.14.0
// Project: https://github.com/visionmedia/supertest
// Definitions by: Alex Varju
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -12,19 +12,32 @@ declare module "supertest" {
interface Test extends superagent.Request {
url: string;
serverAddress(app: any, path: string): string;
- expect(status: number, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(status: number, body: string, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(body: string, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(body: RegExp, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(body: Object, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(field: string, val: string, callback?: (err: Error, res: superagent.Response) => void): Test;
- expect(field: string, val: RegExp, callback?: (err: Error, res: superagent.Response) => void): Test;
+ expect(status: number, callback?: (err: Error, res: Response) => void): Test;
+ expect(status: number, body: string, callback?: (err: Error, res: Response) => void): Test;
+ expect(body: string, callback?: (err: Error, res: Response) => void): Test;
+ expect(body: RegExp, callback?: (err: Error, res: Response) => void): Test;
+ expect(body: Object, callback?: (err: Error, res: Response) => void): Test;
+ expect(field: string, val: string, callback?: (err: Error, res: Response) => void): Test;
+ expect(field: string, val: RegExp, callback?: (err: Error, res: Response) => void): Test;
+ expect(checker: (res: Response) => any): Test;
+
+ attach(field: string, file: string, filename: string): Test;
+ redirects(n: number): Test;
+ part(): Test;
set(field: string, val: string): Test;
set(field: Object): Test;
+ type(val: string): Test;
query(val: Object): Test;
send(data: string): Test;
send(data: Object): Test;
+ buffer(val: boolean): Test;
+ timeout(ms: number): Test;
+ clearTimeout(): Test;
+ auth(user: string, name: string): Test;
+ field(name: string, val: string): Test;
+ end(callback?: (err: Error, res: Response) => void): Test;
}
+ interface Response extends superagent.Response {}
interface SuperTest {
get(url: string): Test;
@@ -52,7 +65,34 @@ declare module "supertest" {
patch(url: string): Test;
}
- function agent(): superagent.Agent;
+ interface TestAgent extends superagent.Agent {
+ get(url: string, callback?: (err: Error, res: Response) => void): Test;
+ post(url: string, callback?: (err: Error, res: Response) => void): Test;
+ put(url: string, callback?: (err: Error, res: Response) => void): Test;
+ head(url: string, callback?: (err: Error, res: Response) => void): Test;
+ del(url: string, callback?: (err: Error, res: Response) => void): Test;
+ options(url: string, callback?: (err: Error, res: Response) => void): Test;
+ trace(url: string, callback?: (err: Error, res: Response) => void): Test;
+ copy(url: string, callback?: (err: Error, res: Response) => void): Test;
+ lock(url: string, callback?: (err: Error, res: Response) => void): Test;
+ mkcol(url: string, callback?: (err: Error, res: Response) => void): Test;
+ move(url: string, callback?: (err: Error, res: Response) => void): Test;
+ propfind(url: string, callback?: (err: Error, res: Response) => void): Test;
+ proppatch(url: string, callback?: (err: Error, res: Response) => void): Test;
+ unlock(url: string, callback?: (err: Error, res: Response) => void): Test;
+ report(url: string, callback?: (err: Error, res: Response) => void): Test;
+ mkactivity(url: string, callback?: (err: Error, res: Response) => void): Test;
+ checkout(url: string, callback?: (err: Error, res: Response) => void): Test;
+ merge(url: string, callback?: (err: Error, res: Response) => void): Test;
+ //m-search(url: string, callback?: (err: Error, res: Response) => void): Test;
+ notify(url: string, callback?: (err: Error, res: Response) => void): Test;
+ subscribe(url: string, callback?: (err: Error, res: Response) => void): Test;
+ unsubscribe(url: string, callback?: (err: Error, res: Response) => void): Test;
+ patch(url: string, callback?: (err: Error, res: Response) => void): Test;
+ search(url: string, callback?: (err: Error, res: Response) => void): Test;
+ connect(url: string, callback?: (err: Error, res: Response) => void): Test;
+ }
+ function agent(app?: any): supertest.TestAgent;
}
function supertest(app: any): supertest.SuperTest;
diff --git a/tv4/tv4.d.ts b/tv4/tv4.d.ts
index 702d3c3bc6..02b7ebba2f 100644
--- a/tv4/tv4.d.ts
+++ b/tv4/tv4.d.ts
@@ -43,5 +43,6 @@ interface TV4 {
errorCodes:TV4ErrorCodes;
}
declare module "tv4" {
-export = TV4;
+ var tv4: TV4
+ export = tv4;
}
diff --git a/yeoman-generator/yeoman-generator-tests.ts b/yeoman-generator/yeoman-generator-tests.ts
new file mode 100644
index 0000000000..84f0072065
--- /dev/null
+++ b/yeoman-generator/yeoman-generator-tests.ts
@@ -0,0 +1,114 @@
+///
+import yeoman = require('yeoman-generator');
+
+var base = yeoman.generators.Base;
+var namedBase = yeoman.generators.NamedBase;
+
+var generator = base.extend({
+ initializing: function() {
+ return;
+ },
+ writing: {
+ app: function() {
+ return;
+ },
+ other: function() {
+ return;
+ }
+ },
+ end: function() {
+ return;
+ }
+});
+
+generator.argument('name', {
+ desc: 'desc',
+ required: true,
+ optional: true,
+ type: 'any',
+ defaults: 'any',
+});
+
+var compose = generator.composeWith('namespace', 'any', {
+ local: 'local',
+ link: 'link'
+});
+
+compose.defaultFor('name');
+compose.destinationRoot('rootPath') === 'string';
+compose.determineAppname();
+compose.getCollisionFilter()('output');
+compose.hookFor('name', {
+ as: 'string',
+ args: 'any',
+ options: 'any'
+});
+compose.option('name', {
+ alias: 'string',
+ defaults: 'any',
+ desc: 'string',
+ hide: true,
+ type: 'any'
+});
+var returnString: boolean;
+returnString = compose.rootGeneratorName() === 'string';
+compose.run('args');
+compose.run('args', () => {
+ return;
+});
+compose.runHooks(() => {
+ return;
+});
+returnString = compose.sourceRoot('rootPath') === 'string';
+
+var assert = yeoman.assert;
+
+assert.file('path');
+assert.file(['paths', 'paths']);
+assert.fileContent('file', /.*/);
+assert.fileContent([
+ ['string', /.*/],
+ ['string', /.*/],
+ ['string', /.*/]
+]);
+assert.files([
+ ['string', /.*/],
+ 'string',
+ ['string', /.*/],
+ 'string'
+]);
+assert.implement('subject', 'methods');
+assert.noFile('file');
+assert.noFileContent('file', /.*/);
+assert.noFileContent([
+ ['string', /.*/],
+ ['string', /.*/],
+ ['string', /.*/]
+]);
+assert.noImplement('subject', 'methods');
+assert.textEqual('value', 'expected');
+
+var test = yeoman.test;
+var dummyGen = test.createDummyGenerator();
+dummyGen.determineAppname();
+
+var createdGen = test.createGenerator('name', ['any', 'amy'], 'args', 'options');
+createdGen.determineAppname();
+
+test.decorate('context', 'method', () => {
+ return; // replacement
+}, 'options');
+test.gruntfile('options', () => {
+ return; // done
+});
+test.mockPrompt(createdGen, 'answers');
+test.registerDependencies(['dependencies', 'dependencies']);
+test.restore();
+var runContext = test.run('generator');
+
+runContext.async()();
+runContext.inDir('dirPath')
+ .withArguments('args')
+ .withGenerators(['deps', 'deps'])
+ .withOptions('opts')
+ .withPrompts('answers');
diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts
new file mode 100644
index 0000000000..aed7a8f034
--- /dev/null
+++ b/yeoman-generator/yeoman-generator.d.ts
@@ -0,0 +1,141 @@
+// Type definitions for yeoman-generator
+// Project: https://github.com/yeoman/generator
+// Definitions by: Kentaro Okuno
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module yo {
+ export interface IYeomanGenerator {
+ argument(name: string, config: IArgumentConfig): void;
+ composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator;
+ defaultFor(name: string): void;
+ destinationRoot(rootPath: string): string;
+ determineAppname(): void;
+ getCollisionFilter(): (output: any) => void;
+ hookFor(name: string, config: IHookConfig): void;
+ option(name: string, config: IYeomanGeneratorOption): void;
+ rootGeneratorName(): string;
+ run(args?: any): void;
+ run(args: any, callback?: Function): void;
+ runHooks(callback?: Function): void;
+ sourceRoot(rootPath: string): string;
+ }
+
+ export interface IArgumentConfig {
+ desc: string;
+ required: boolean;
+ optional: boolean;
+ type: any;
+ defaults: any;
+ }
+
+ export interface IComposeSetting {
+ local?: string;
+ link?: string;
+ }
+
+ export interface IHookConfig {
+ as: string;
+ args: any;
+ options: any;
+ }
+
+ export interface IYeomanGeneratorOption {
+ alias: string;
+ defaults: any;
+ desc: string;
+ hide: boolean;
+ type: any;
+ }
+
+ export interface IQueueProps {
+ initializing: () => void;
+ prompting?: () => void;
+ configuring?: () => void;
+ default?: () => void;
+ writing: {
+ [target: string]: () => void;
+ };
+ conflicts?: () => void;
+ install?: () => void;
+ end: () => void;
+ }
+
+ export interface IBase {
+ new(args: string, options: any): IYeomanGenerator;
+ new(args: string[], options: any): IYeomanGenerator;
+ extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator;
+ }
+
+ export interface INamedBase {
+ new(args: string, options: any): IYeomanGenerator;
+ new(args: string[], options: any): IYeomanGenerator;
+ }
+
+ export interface IAssert {
+ file(path: string): void;
+ file(paths: string[]): void;
+ fileContent(file: string, reg: RegExp): void;
+
+ /** @param {[String, RegExp][]} pairs */
+ fileContent(pairs: any[][]): void;
+
+ /** @param {[String, RegExp][]|String[]} pairs */
+ files(pairs: any[]): void;
+
+ /**
+ * @param {Object} subject
+ * @param {Object|Array} methods
+ */
+ implement(subject: any, methods: any): void;
+ noFile(file: string): void;
+ noFileContent(file: string, reg: RegExp): void;
+
+ /** @param {[String, RegExp][]} pairs */
+ noFileContent(pairs: any[][]): void;
+
+ /**
+ * @param {Object} subject
+ * @param {Object|Array} methods
+ */
+ noImplement(subject: any, methods: any): void;
+
+ textEqual(value: string, expected: string): void;
+ }
+
+ export interface ITestHelper {
+ createDummyGenerator(): IYeomanGenerator;
+ createGenerator(name: string, dependencies: any[], args: any, options: any): IYeomanGenerator;
+ decorate(context: any, method: string, replacement: Function, options: any): void;
+ gruntfile(options: any, done: Function): void;
+ mockPrompt(generator: IYeomanGenerator, answers: any): void;
+ registerDependencies(dependencies: string[]): void;
+ restore(): void;
+
+ /** @param {String|Function} generator */
+ run(generator: any): IRunContext;
+ }
+
+ export interface IRunContext {
+ async(): Function;
+ inDir(dirPath: string): IRunContext;
+
+ /** @param {String|String[]} args */
+ withArguments(args: any): IRunContext;
+ withGenerators(dependencies: string[]): IRunContext;
+ withOptions(options: any): IRunContext;
+ withPrompts(answers: any): IRunContext;
+ }
+
+ /** @type file file-utils */
+ var file: any;
+ var assert: IAssert;
+ var test: ITestHelper;
+ var generators: {
+ Base: IBase;
+ NamedBase: INamedBase;
+ };
+}
+
+declare module "yeoman-generator" {
+ export = yo;
+}
diff --git a/yosay/yosay-tests.ts b/yosay/yosay-tests.ts
new file mode 100644
index 0000000000..257b546eae
--- /dev/null
+++ b/yosay/yosay-tests.ts
@@ -0,0 +1,3 @@
+///
+import yosay = require('yosay');
+yosay('Welcome to the generator!', {maxLength: 20});
\ No newline at end of file
diff --git a/yosay/yosay.d.ts b/yosay/yosay.d.ts
new file mode 100644
index 0000000000..a46049e102
--- /dev/null
+++ b/yosay/yosay.d.ts
@@ -0,0 +1,9 @@
+// Type definitions for yosay
+// Project: https://github.com/yeoman/yosay
+// Definitions by: Kentaro Okuno
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module 'yosay' {
+ function yosay(message?: string, options?: {maxLength: number}): string;
+ export = yosay;
+}
\ No newline at end of file
diff --git a/zepto/zepto.d.ts b/zepto/zepto.d.ts
index aa497b03f9..b01df91739 100644
--- a/zepto/zepto.d.ts
+++ b/zepto/zepto.d.ts
@@ -1580,13 +1580,20 @@ interface ZeptoAjaxSettings {
data?: any;
processData?: boolean;
contentType?: string;
+ mimeType?: string;
dataType?: string;
+ jsonp?: string;
+ jsonpCallback?: any; // string or Function
timeout?: number;
headers?: { [key: string]: string };
async?: boolean;
global?: boolean;
context?: any;
traditional?: boolean;
+ cache?: boolean;
+ xhrFields?: { [key: string]: any };
+ username?: string;
+ password?: string;
beforeSend?: (xhr: XMLHttpRequest, settings: ZeptoAjaxSettings) => boolean;
success?: (data: any, status: string, xhr: XMLHttpRequest) => void;
error?: (xhr: XMLHttpRequest, errorType: string, error: Error) => void;