From dddf80ff37f9b046f573940e5a648278b6ca5296 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Sat, 23 Nov 2013 20:49:16 +1100 Subject: [PATCH 01/14] docs: minor casing fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92996a9ca8..84295923b7 100755 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ See the section: [How to contribute](https://github.com/borisyankov/DefinitelyTy Other means to get the definitions ---------------------------------- -* [NuGet packages](http://nuget.org/packages?q=Definitelytyped) +* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped) * [TypeScript definition package manager](https://github.com/Diullei/tsd) * [tsdpm](http://www.tsdpm.com/) - Online search From 21f83910f572d00f45204b46d714141477a18f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Oborn=C3=ADk?= Date: Sat, 23 Nov 2013 18:32:36 +0100 Subject: [PATCH 02/14] Added void return types for some methods. It alows compile with --noImplicitAny flag. --- gapi/gapi.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gapi/gapi.d.ts b/gapi/gapi.d.ts index e001bf8aa6..6da4200aa0 100644 --- a/gapi/gapi.d.ts +++ b/gapi/gapi.d.ts @@ -140,7 +140,7 @@ declare module gapi.client { status: number; statusText: string; } - ) => any); + ) => any):void; } /** * Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute. @@ -166,7 +166,7 @@ declare module gapi.client { */ rawBatchResponse: any ) => any - }); + }):void; /** * Executes all requests in the batch. The supplied callback is executed on success or failure. * @param callback The callback to execute when the batch returns. @@ -180,7 +180,7 @@ declare module gapi.client { * is the same response, but as an unparsed JSON-string. */ rawBatchResponse: string - ) => any); + ) => any):void; } /** @@ -201,7 +201,7 @@ declare module gapi.client { * is the same as jsonResp, except it is a raw string that has not been parsed. It is typically used when the response is not JSON. */ rawResp: string - ) => void ); + ) => void ):void; } } From 1de38a7ac8357b8a9269fad1e143d855cb559507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Oborn=C3=ADk?= Date: Sat, 23 Nov 2013 21:52:50 +0100 Subject: [PATCH 03/14] spin.js - added missed types for --noImplicitAny typescript compilation --- spin/spin.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spin/spin.d.ts b/spin/spin.d.ts index 88a45943a1..c7ceac2b6f 100644 --- a/spin/spin.d.ts +++ b/spin/spin.d.ts @@ -41,6 +41,6 @@ declare class Spinner { * Stopped spinners may be reused by calling spin() again. */ stop(): Spinner; - lines(el, o); - opacity(el, i, val); + lines(el:HTMLElement, o:SpinnerOptions):HTMLElement; + opacity(el:HTMLElement, i:number, val:number, o:SpinnerOptions):void; } From 5b9620556e27c8c8bd250a1749788c6fc29e040e Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Sat, 23 Nov 2013 16:31:40 -0600 Subject: [PATCH 04/14] Fixes for node definitions. setTimeout, setInterval, setImmediate are fixed to accept more arguments. setTimeout, setInterval, clearTimeout, clearInterval are changed to return and accept objects of the new Timer interface, which exposes the ref() and unref() methods. fs.readFileSync is changed so that it returns a string if it is passed an options parameter with an "encoding" property, and returns a NodeBuffer otherwise. fs.watchFile and fs.unwatchFile listener parameters are fixed. listener is a callback with two parameters, not an object with two properties. fs.watch is fixed so a listener parameter can be given without an options parameter. crypto.randomBytes is fixed so that it can be called synchronously, returning a NodeBuffer. crypto.pseudoRandomBytes is added. --- node/node.d.ts | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 0084aa3e3e..ef959a86b6 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -15,11 +15,11 @@ declare var global: any; declare var __filename: string; declare var __dirname: string; -declare function setTimeout(callback: () => void , ms: number): any; -declare function clearTimeout(timeoutId: any): void; -declare function setInterval(callback: () => void , ms: number): any; -declare function clearInterval(intervalId: any): void; -declare function setImmediate(callback: () => void ): any; +declare function setTimeout(callback: (...args: any[]) => void , ms: number , ...args: any[]): Timer; +declare function clearTimeout(timeoutId: Timer): void; +declare function setInterval(callback: (...args: any[]) => void , ms: number , ...args: any[]): Timer; +declare function clearInterval(intervalId: Timer): void; +declare function setImmediate(callback: (...args: any[]) => void , ...args: any[]): any; declare function clearImmediate(immediateId: any): void; declare var require: { @@ -195,6 +195,11 @@ interface NodeBuffer { INSPECT_MAX_BYTES: number; } +interface Timer { + ref() : void; + unref() : void; +} + /************************************************ * * * MODULES * @@ -799,8 +804,8 @@ declare module "fs" { export function readSync(fd: string, buffer: NodeBuffer, offset: number, length: number, position: number): any[]; export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: Error, data: any) => void): void; export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void ): void; - export function readFileSync(filename: string): NodeBuffer; - export function readFileSync(filename: string, options: { encoding?: string; flag?: string; }): any; + export function readFileSync(filename: string, options?: { flag?: string; }): NodeBuffer; + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: Error) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: Error) => void): void; @@ -811,10 +816,11 @@ declare module "fs" { export function appendFile(filename: string, data: any, callback?: (err: Error) => void): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void; - export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void; - export function unwatchFile(filename: string, listener?: Stats): void; - export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) =>any): FSWatcher; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats)=>void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats)=>void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats)=>void): void; + export function watch(filename: string, listener?: (event: string, filename: string) =>any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) =>any): FSWatcher; export function exists(path: string, callback?: (exists: boolean) => void): void; export function existsSync(path: string): boolean; export function createReadStream(path: string, options?: { @@ -1003,7 +1009,10 @@ declare module "crypto" { } export function getDiffieHellman(group_name: string): DiffieHellman; export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; - export function randomBytes(size: number, callback?: (err: Error, buf: NodeBuffer) =>void ): void; + export function randomBytes(size: number): NodeBuffer; + export function randomBytes(size: number, callback: (err: Error, buf: NodeBuffer) =>void ): void; + export function pseudoRandomBytes(size: number): NodeBuffer; + export function pseudoRandomBytes(size: number, callback: (err: Error, buf: NodeBuffer) =>void ): void; } declare module "stream" { From 09ad8f82835760b06782892e08d21426ac32339f Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Sat, 23 Nov 2013 16:36:50 -0600 Subject: [PATCH 05/14] Fixes for express definitions. app.listen is fixed so that it can be called with a port, hostname, and optional callback without a backlog parameter. app.listen is fixed so callback parameter is always optional. CSRF protection middleware definition is fixed so options parameter is optional. req.csrfToken method is added since the CSRF protection middleware has been updated. --- express/express.d.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/express/express.d.ts b/express/express.d.ts index a5dacc3a30..e23ee5302d 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -405,6 +405,12 @@ declare module "express" { //cookies: { string; remember: boolean; }; cookies: any; + /** + * Used to generate an anti-CSRF token. + * Placed by the CSRF protection middleware. + */ + csrfToken(): string; + method: string; params: any; @@ -1063,9 +1069,11 @@ declare module "express" { * http.createServer(app).listen(80); * https.createServer({ ... }, app).listen(443); */ - listen(port: number, hostname: string, backlog: number, callback: Function): void; + listen(port: number, hostname: string, backlog: number, callback?: Function): void; - listen(port: number, callback: Function): void; + listen(port: number, hostname: string, callback?: Function): void; + + listen(port: number, callback?: Function): void; listen(path: string, callback?: Function): void; @@ -1471,13 +1479,12 @@ declare module "express" { /** * Anti CSRF: * - * CRSF protection middleware. + * CSRF protection middleware. * - * By default this middleware generates a token named "_csrf" + * This middleware adds a `req.csrfToken()` function to make a token * which should be added to requests which mutate * state, within a hidden form field, query-string etc. This - * token is validated against the visitor's `req.session._csrf` - * property. + * token is validated against the visitor's session. * * The default `value` function checks `req.body` generated * by the `bodyParser()` middleware, `req.query` generated @@ -1488,11 +1495,11 @@ declare module "express" { * * Options: * - * - `value` a function accepting the request, returning the token + * - `value` a function accepting the request, returning the token * * @param options */ - export function csrf(options: any): Handler; + export function csrf(options?: {value?: Function}): Handler; /** * Directory: From db1a670dde9ddd18a8a82770b53850e8d289dd97 Mon Sep 17 00:00:00 2001 From: benjaminjackman Date: Sat, 23 Nov 2013 17:47:48 -0600 Subject: [PATCH 06/14] Update slickgrid to remove implicit anys --- slickgrid/SlickGrid.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 8459fbd9ea..becc6f6176 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -394,7 +394,7 @@ declare module Slick { * @param colDef * @return **/ - asyncPostRender?: (cellNode, row, dataContext, colDef) => void; + asyncPostRender?: (cellNode:any, row:any, dataContext:any, colDef:any) => void; /** * Used by the the slick.rowMoveManager.js plugin for moving rows. Has no effect without the plugin installed. @@ -1390,8 +1390,8 @@ declare module Slick { public init(): void; public destroy(): void; public focus(): void; - public loadValue(item): void; // todo: typeof(item) - public applyValue(item, state: string): void; // todo: typeof(item) + public loadValue(item:any): void; // todo: typeof(item) + public applyValue(item:any, state: string): void; // todo: typeof(item) public isValueChanged(): boolean; public serializeValue(): any; public validate(): ValidateResults; @@ -1483,7 +1483,7 @@ declare module Slick { public getPagingInfo(): PagingOptions; public getItems(): T[]; public setItems(data: T[], objectIdProperty?: string): void; - public setFilter(filterFn: (item: T, args) => boolean): void; // todo: typeof(args) + public setFilter(filterFn: (item: T, args:any) => boolean): void; // todo: typeof(args) public sort(comparer: Function, ascending: boolean): void; // todo: typeof(comparer), should be the same callback as Array.sort public fastSort(field: string, ascending: boolean): void; public fastSort(field: Function, ascending: boolean): void; // todo: typeof(field), should be the same callback as Array.sort @@ -1494,12 +1494,12 @@ declare module Slick { /** * @deprecated **/ - public groupBy(valueGetter, valueFormatter, sortComparer): void; + public groupBy(valueGetter:any, valueFormatter:any, sortComparer:any): void; /** * @deprecated **/ - public setAggregators(groupAggregators, includeCollapsed): void; + public setAggregators(groupAggregators:any, includeCollapsed:any): void; /** * @param level Optional level to collapse. If not specified, applies to all levels. @@ -1554,7 +1554,7 @@ declare module Slick { export interface GroupingOptions { getter: Function; // todo formatter: Formatter; - comparer: (a, b) => any; // todo + comparer: (a:any, b:any) => any; // todo predefinedValues: any[]; // todo aggregators: Aggregators.Aggregator[]; aggregateEmpty: boolean; From 89548662d0b9a5f651c8e43fad46f14cc582e1e5 Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Sat, 23 Nov 2013 18:07:17 -0600 Subject: [PATCH 07/14] express.d.ts: tabs -> spaces --- express/express.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/express/express.d.ts b/express/express.d.ts index e23ee5302d..35309fffcc 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -405,11 +405,11 @@ declare module "express" { //cookies: { string; remember: boolean; }; cookies: any; - /** + /** * Used to generate an anti-CSRF token. * Placed by the CSRF protection middleware. */ - csrfToken(): string; + csrfToken(): string; method: string; From c3541fe0b95cb3debef191a2467f43d991cb0775 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sun, 24 Nov 2013 01:44:37 +0300 Subject: [PATCH 08/14] Correct assert module --- node/node.d.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index ef959a86b6..f7e07a3658 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1075,10 +1075,21 @@ declare module "util" { } declare module "assert" { - function internal (booleanValue: boolean, message?: string): void; + function internal (value: any, message?: string): void; module internal { - export function fail(actual: any, expected: any, message: string, operator: string): void; - export function assert(value: any, message: string): void; + export class AssertionError implements Error { + name: string; + message: string; + actual: any; + expected: any; + operator: string; + generatedMessage: boolean; + + constructor(options?: {message?: string; actual?: any; expected?: any; + operator?: string; stackStartFunction?: Function}); + } + + export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; export function ok(value: any, message?: string): void; export function equal(actual: any, expected: any, message?: string): void; export function notEqual(actual: any, expected: any, message?: string): void; @@ -1086,8 +1097,10 @@ declare module "assert" { export function notDeepEqual(acutal: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; - export function throws(block: any, error?: any, messsage?: string): void; - export function doesNotThrow(block: any, error?: any, messsage?: string): void; + export function throws(block: Function, error?: Function, message?: string): void; + export function throws(block: Function, error?: RegExp, message?: string): void; + export function throws(block: Function, error?: (err: any) => boolean, message?: string): void; + export function doesNotThrow(block: Function, message?: string): void; export function ifError(value: any): void; } From f2a4348c200ad851b820e4fde801b076513a097e Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sun, 24 Nov 2013 01:51:59 +0300 Subject: [PATCH 09/14] Correct domain module --- node/node.d.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index f7e07a3658..3ae03b21f2 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1124,13 +1124,20 @@ declare module "tty" { declare module "domain" { import events = require("events"); - export interface Domain extends events.NodeEventEmitter { } + export class Domain extends events.EventEmitter { + run(fn: Function): void; + add(emitter: events.NodeEventEmitter): void; + remove(emitter: events.NodeEventEmitter): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + + addListener(event: string, listener: Function): Domain; + on(event: string, listener: Function): Domain; + once(event: string, listener: Function): Domain; + removeListener(event: string, listener: Function): Domain; + removeAllListeners(event?: string): Domain; + } export function create(): Domain; - export function run(fn: Function): void; - export function add(emitter: events.NodeEventEmitter): void; - export function remove(emitter: events.NodeEventEmitter): void; - export function bind(cb: (er: Error, data: any) =>any): any; - export function intercept(cb: (data: any) => any): any; - export function dispose(): void; } From 70a2f13438e09785c9212734f18a6a082314e959 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sun, 24 Nov 2013 18:00:30 +0400 Subject: [PATCH 10/14] Fix assert module --- node/node.d.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 3ae03b21f2..7b5c971193 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1097,10 +1097,20 @@ declare module "assert" { export function notDeepEqual(acutal: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; - export function throws(block: Function, error?: Function, message?: string): void; - export function throws(block: Function, error?: RegExp, message?: string): void; - export function throws(block: Function, error?: (err: any) => boolean, message?: string): void; - export function doesNotThrow(block: Function, message?: string): void; + export var throws: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + } + + export var doesNotThrow: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + } + export function ifError(value: any): void; } From 845ef3282686b4a1e24f1dd85679304582ff7dde Mon Sep 17 00:00:00 2001 From: chaosmail Date: Sun, 24 Nov 2013 17:15:01 +0100 Subject: [PATCH 11/14] Updated d3.d.ts fixed typo in scale threshold function --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index daa53f67c5..0244dc08ad 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -2405,7 +2405,7 @@ declare module D3 { /* * Construct a threshold scale with a discrete output range. */ - theshold(): ThresholdScale; + threshold(): ThresholdScale; } export interface Scale { From 00bf83cd8ebef2a360e75387a919db7b838fe92a Mon Sep 17 00:00:00 2001 From: Natan Vivo Date: Sun, 24 Nov 2013 17:30:32 -0200 Subject: [PATCH 12/14] Fix noConflict() definition to return typeof(Backbone), added declaration of Backbone.$; --- backbone/backbone.d.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 4e96ebef13..869cf7a060 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -330,12 +330,8 @@ declare module Backbone { var emulateJSONBackbone: boolean; // Utility - - // 0.9 cannot return modules anymore, and "typeof " is not compiling for some reason - // returning "any" until this is fixed - - //function noConflict(): typeof Backbone; - function noConflict(): any; - + function noConflict(): typeof Backbone; function setDomLibrary(jQueryNew: any): any; + + var $: JQueryStatic; } From 2e52be773f698acccf0318ef06aa67ffdc927c0a Mon Sep 17 00:00:00 2001 From: Natan Vivo Date: Sun, 24 Nov 2013 17:33:14 -0200 Subject: [PATCH 13/14] Fix space/tab issue. --- backbone/backbone.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 869cf7a060..32a3e9e369 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -333,5 +333,5 @@ declare module Backbone { function noConflict(): typeof Backbone; function setDomLibrary(jQueryNew: any): any; - var $: JQueryStatic; + var $: JQueryStatic; } From ee21e8494b0d1e81971cc1633562c67f430eda31 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 24 Nov 2013 15:36:02 -0600 Subject: [PATCH 14/14] makes ReadableStream the same as stream.ReadableStream by applying the pipe change from commit d0139df89deb691b3a25506e942d41707c8afce8 --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 0084aa3e3e..bcbef2ba11 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -95,7 +95,7 @@ interface ReadableStream extends EventEmitter { pause(): void; resume(): void; destroy(): void; - pipe(destination: WritableStream, options?: { end?: boolean; }): void; + pipe(destination: T, options?: { end?: boolean; }): T; } interface NodeProcess extends EventEmitter {