Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Chris Smith
2013-11-25 00:40:50 -08:00
10 changed files with 123 additions and 67 deletions

View File

@@ -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

View File

@@ -330,12 +330,8 @@ declare module Backbone {
var emulateJSONBackbone: boolean;
// Utility
// 0.9 cannot return modules anymore, and "typeof <Module>" 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;
}

2
d3/d3.d.ts vendored
View File

@@ -2405,7 +2405,7 @@ declare module D3 {
/*
* Construct a threshold scale with a discrete output range.
*/
theshold(): ThresholdScale;
threshold(): ThresholdScale;
}
export interface Scale {

23
express/express.d.ts vendored
View File

@@ -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:

8
gapi/gapi.d.ts vendored
View File

@@ -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;
}
}

View File

@@ -3,6 +3,14 @@
// Official code sample from
// http://gruntjs.com/getting-started#an-example-gruntfile
interface MyTaskData {
repeat: number;
}
interface MyOptions {
sourceRoot: string;
}
// exports should work same as module.exports
exports = (grunt: IGrunt) => {
@@ -26,6 +34,17 @@ exports = (grunt: IGrunt) => {
// Default task(s).
grunt.registerTask('default', ['uglify']);
grunt.registerMultiTask('mytask', "short description", function() {
var currenttask: grunt.task.IMultiTask<MyTaskData> = this;
var options = currenttask.options<MyOptions>({
sourceRoot: "default"
});
var valid = false;
valid = valid && options.sourceRoot === "default";
valid = valid && currenttask.data.repeat > 0;
return valid;
});
// util methods
var testOneArg = (a: number) => a * 2;

19
gruntjs/gruntjs.d.ts vendored
View File

@@ -760,10 +760,6 @@ declare module grunt {
module task {
interface TaskFunction extends ITask {
(...args: any[]): boolean
}
/**
* {@link http://gruntjs.com/api/grunt.task}
*/
@@ -784,9 +780,9 @@ declare module grunt {
* Task-specific properties and methods are available inside the task function as properties
* of the this object. The task function can return false to indicate that the task has failed.
*
* @note taskFunction.apply(scope: grunt.task.IMultiTask, args: any[])
* @note taskFunction.apply(scope: grunt.task.ITask, args: any[])
*/
registerTask(taskName: string, description: string, taskFunction: TaskFunction): void
registerTask(taskName: string, description: string, taskFunction: Function): void
/**
* Register a "multi task." A multi task is a task that implicitly iterates over all of its
@@ -794,10 +790,10 @@ declare module grunt {
* In addition to the default properties and methods, extra multi task-specific properties
* are available inside the task function as properties of the this object.
*
* @note taskFunction.apply(scope: grunt.task.IMultiTask, args: any[])
* @note taskFunction.apply(scope: grunt.task.IMultiTask<any>, args: any[])
*/
registerMultiTask(taskName: string, taskFunction: grunt.task.ITask): void
registerMultiTask(taskName: string, taskDescription: string, taskFunction: TaskFunction): void
registerMultiTask(taskName: string, taskFunction: Function): void
registerMultiTask(taskName: string, taskDescription: string, taskFunction: Function): void
}
/**
@@ -917,9 +913,8 @@ declare module grunt {
* object properties, which will be further overridden in multi tasks by any target-level
* options object properties.
*/
// options<T>(defaultsObj: T): ITaskOptions
// options<T>(defaultsObj: T): T
options(defaultsObj: any): any
options(defaultsObj: any): ITaskOptions
options<T>(defaultsObj: T): T
}
/**

89
node/node.d.ts vendored
View File

@@ -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: {
@@ -95,7 +95,7 @@ interface ReadableStream extends EventEmitter {
pause(): void;
resume(): void;
destroy(): void;
pipe(destination: WritableStream, options?: { end?: boolean; }): void;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
}
interface NodeProcess extends EventEmitter {
@@ -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" {
@@ -1066,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;
@@ -1077,8 +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: any, error?: any, messsage?: string): void;
export function doesNotThrow(block: any, error?: any, messsage?: 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;
}
@@ -1102,13 +1134,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;
}

View File

@@ -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<T> {
getter: Function; // todo
formatter: Formatter<T>;
comparer: (a, b) => any; // todo
comparer: (a:any, b:any) => any; // todo
predefinedValues: any[]; // todo
aggregators: Aggregators.Aggregator<T>[];
aggregateEmpty: boolean;

4
spin/spin.d.ts vendored
View File

@@ -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;
}