diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js index d0a23087a7..3b896c84f6 100644 --- a/_infrastructure/tests/runner.js +++ b/_infrastructure/tests/runner.js @@ -800,7 +800,7 @@ var DefinitelyTyped; SyntaxCheking.prototype.run = function (it, file, len, maxLen, callback) { var _this = this; - if (!endsWith(file, '-tests.ts')) { + if (!endsWith(file.toUpperCase(), '-TESTS.TS') && file.indexOf('../_infrastructure') < 0) { new Test(file).run(function (o) { var failed = false; @@ -915,7 +915,7 @@ var DefinitelyTyped; TestEval.prototype.run = function (it, file, len, maxLen, callback) { var _this = this; - if (endsWith(file, '-tests.ts')) { + if (endsWith(file.toUpperCase(), '-TESTS.TS')) { new Test(file).run(function (o) { var failed = false; diff --git a/_infrastructure/tests/runner.ts b/_infrastructure/tests/runner.ts index 8d0eeae142..d6e58ff3bc 100644 --- a/_infrastructure/tests/runner.ts +++ b/_infrastructure/tests/runner.ts @@ -291,8 +291,8 @@ module DefinitelyTyped { } } - private run(it, file, len, maxLen, callback: Function) { - if (!endsWith(file, '-tests.ts')) { + private run(it, file, len, maxLen, callback: Function) { + if (!endsWith(file.toUpperCase(), '-TESTS.TS') && file.indexOf('../_infrastructure') < 0) { new Test(file).run((o) => { var failed = false; @@ -408,7 +408,7 @@ module DefinitelyTyped { } private run(it, file, len, maxLen, callback: Function) { - if (endsWith(file, '-tests.ts')) { + if (endsWith(file.toUpperCase(), '-TESTS.TS')) { new Test(file).run((o) => { var failed = false; diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index cfc3c3d2f1..aa8488beac 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -295,6 +295,7 @@ declare module Backbone { collection: Collection; make(tagName: string, attrs?, opts?): View; setElement(element: HTMLElement, delegate?: boolean); + setElement(element: JQuery, delegate?: boolean); id: string; cid: string; className: string; diff --git a/breeze/breeze-1.0.d.ts b/breeze/breeze-1.0.d.ts index 8a6458498d..5669e85f17 100644 --- a/breeze/breeze-1.0.d.ts +++ b/breeze/breeze-1.0.d.ts @@ -183,7 +183,7 @@ declare module Breeze { parseDateFromServer(date: any): Date; } - declare var DataType: DataType; + var DataType: DataType; class EntityActionSymbol extends BreezeCore.EnumSymbol { } diff --git a/colors/colors-test.ts b/colors/colors-tests.ts similarity index 100% rename from colors/colors-test.ts rename to colors/colors-tests.ts diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index a8f49f83cb..609922068e 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -484,7 +484,7 @@ declare module createjs { y: number; // methods - constructor (x: number, y: number); + constructor (x?: number, y?: number); clone(): Point; toString(): string; } @@ -498,7 +498,7 @@ declare module createjs { height: number; // methods - constructor (x: number, y: number, width: number, height: number); + constructor (x?: number, y?: number, width?: number, height?: number); clone(): Rectangle; toString(): string; } diff --git a/extjs/ExtJS-4.2.0.d.ts b/extjs/ExtJS-4.2.0.d.ts index c5a6c37d4e..1a26c781a2 100644 --- a/extjs/ExtJS-4.2.0.d.ts +++ b/extjs/ExtJS-4.2.0.d.ts @@ -164,9 +164,9 @@ declare module Ext { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Template method called after a Component has been positioned @@ -2063,9 +2063,9 @@ declare module Ext.chart { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] set the store after rendering the chart */ afterRender?(): void; /** [Method] Binds a store to this instance @@ -3419,9 +3419,9 @@ declare module Ext { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Invoked after the Component has been hidden * @param callback Function * @param scope Object @@ -3482,7 +3482,7 @@ declare module Ext { focus?( selectText?:bool, delay?:bool ): Ext.IComponent; focus?( selectText?:bool, delay?:number ): Ext.IComponent; /** [Method] Implements an upward event bubbling policy */ - getBubbleTarget?(): void; + getBubbleTarget? (): Ext.IContainer; /** [Method] Retrieves the top level element representing this component */ getEl?(): Ext.dom.IElement; /** [Method] Retrieves the id of this component */ @@ -3710,9 +3710,9 @@ declare module Ext.container { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Invoked after the Container has laid out and rendered if necessary its child Components * @param layout Ext.layout.container.IContainer */ @@ -14114,7 +14114,7 @@ declare module Ext.form.field { /** [Method] Returns the name attribute of the field */ getName?(): string; /** [Method] Returns the raw value of the field without performing any normalization conversion or validation */ - getRawValue?(): string; + getRawValue?(): any; /** [Method] Creates and returns the data object to be used when rendering the fieldSubTpl */ getSubTplData?(): any; /** [Method] Gets the markup to be inserted into the outer template s bodyEl */ @@ -16469,7 +16469,7 @@ declare module Ext.form.field { /** [Method] Returns the value s that should be saved to the Ext data Model instance for this field when Ext form Basic updateRe */ getModelData?(): any; /** [Method] Returns the submit value for the checkbox which can be used when submitting forms */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Method to manage awareness of when components are removed from their respective Container firing a removed event * @param destroying Boolean Will be passed as true if the Container performing the remove operation will delete this Component upon remove. */ @@ -16495,7 +16495,7 @@ declare module Ext.form { /** [Method] Returns the value s that should be saved to the Ext data Model instance for this field when Ext form Basic updateRe */ getModelData?(): any; /** [Method] Returns the submit value for the checkbox which can be used when submitting forms */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Method to manage awareness of when components are removed from their respective Container firing a removed event * @param destroying Boolean Will be passed as true if the Container performing the remove operation will delete this Component upon remove. */ @@ -16655,9 +16655,9 @@ declare module Ext.form.field { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Applies the state to the object @@ -16774,9 +16774,9 @@ declare module Ext.form { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Applies the state to the object @@ -16893,9 +16893,9 @@ declare module Ext.form { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Applies the state to the object @@ -18825,9 +18825,9 @@ declare module Ext.grid.column { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Sizes this Column to fit the max content width @@ -18968,9 +18968,9 @@ declare module Ext.grid { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Sizes this Column to fit the max content width @@ -20200,9 +20200,9 @@ declare module Ext.grid { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; } } declare module Ext.grid { @@ -20751,8 +20751,8 @@ declare module Ext { * @param version any The version, for example: '1.2.3alpha', '2.4.0-dev' */ export function setVersion( packageName?:any, version?:any ): any; - export function setVersion( packageName?:string, version?:string ): Ext; - export function setVersion( packageName?:string, version?:Ext.IVersion ): Ext; + export function setVersion( packageName?:string, version?:string ): any; + export function setVersion( packageName?:string, version?:Ext.IVersion ): any; /** [Method] */ export function suspendLayouts(): void; /** [Method] Synchronously loads all classes by the given names and all their direct dependencies optionally executes the given c @@ -25432,7 +25432,7 @@ declare module Ext.slider { /** [Method] private override Creates and returns the data object to be used when rendering the fieldSubTpl */ getSubTplData?(): any; /** [Method] Returns the value that would be included in a standard form submit for this field */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Returns the current value of the slider * @param index Number The index of the thumb to return a value for */ @@ -25523,7 +25523,7 @@ declare module Ext.slider { /** [Method] private override Creates and returns the data object to be used when rendering the fieldSubTpl */ getSubTplData?(): any; /** [Method] Returns the value that would be included in a standard form submit for this field */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Returns the current value of the slider * @param index Number The index of the thumb to return a value for */ @@ -26130,9 +26130,9 @@ declare module Ext.tab { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Invoked after the Container has laid out and rendered if necessary its child Components * @param layout Ext.layout.container.IContainer */ @@ -26427,7 +26427,10 @@ declare module Ext.tip { cancelShow?( el?:HTMLElement ): void; cancelShow?( el?:Ext.IElement ): void; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] The initComponent template method is an important initialization step for a Component */ initComponent?(): void; /** [Method] Configures a new quick tip instance and assigns it to a target element @@ -26435,7 +26438,9 @@ declare module Ext.tip { */ register?( config?:any ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; /** [Method] Removes this quick tip from its element and destroys it * @param el String The element from which the quick tip is to be removed or ID of the element. */ @@ -26459,7 +26464,10 @@ declare module Ext { cancelShow?( el?:HTMLElement ): void; cancelShow?( el?:Ext.IElement ): void; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] The initComponent template method is an important initialization step for a Component */ initComponent?(): void; /** [Method] Configures a new quick tip instance and assigns it to a target element @@ -26467,7 +26475,9 @@ declare module Ext { */ register?( config?:any ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; /** [Method] Removes this quick tip from its element and destroys it * @param el String The element from which the quick tip is to be removed or ID of the element. */ @@ -26608,7 +26618,10 @@ declare module Ext.tip { /** [Method] Invoked before the Component is destroyed */ beforeDestroy?(): void; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] The initComponent template method is an important initialization step for a Component */ initComponent?(): void; /** [Method] Allows addition of behavior to the destroy operation */ @@ -26642,7 +26655,9 @@ declare module Ext.tip { setTarget?( t?:HTMLElement ): void; setTarget?( t?:Ext.IElement ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; } } declare module Ext { @@ -26674,7 +26689,10 @@ declare module Ext { /** [Method] Invoked before the Component is destroyed */ beforeDestroy?(): void; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] The initComponent template method is an important initialization step for a Component */ initComponent?(): void; /** [Method] Allows addition of behavior to the destroy operation */ @@ -26708,7 +26726,9 @@ declare module Ext { setTarget?( t?:HTMLElement ): void; setTarget?( t?:Ext.IElement ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; } } declare module Ext.toolbar { @@ -27359,9 +27379,9 @@ declare module Ext.tree { * @param oldHeight Number The old height, or undefined if this was the initial layout. */ afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Collapses a record that is loaded in the view diff --git a/extjs/ExtJS.d.ts b/extjs/ExtJS.d.ts index 42b3d3a035..27d53b6896 100644 --- a/extjs/ExtJS.d.ts +++ b/extjs/ExtJS.d.ts @@ -173,9 +173,9 @@ declare module Ext { */ afterComponentLayout?( width?:any, height?:any, oldWidth?:any, oldHeight?:any ): any; afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:number ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:undefined ): void; - afterComponentLayout?( width?:number, height?:number, oldWidth?:undefined, oldHeight?:undefined ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:number ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:number, oldHeight?:any ): void; + afterComponentLayout?( width?:number, height?:number, oldWidth?:any, oldHeight?:any ): void; /** [Method] Allows addition of behavior after rendering is complete */ afterRender?(): void; /** [Method] Template method called after a Component has been positioned @@ -3996,7 +3996,7 @@ declare module Ext { focus?( selectText?:bool, delay?:bool, callback?:any, scope?:any ): Ext.IComponent; focus?( selectText?:bool, delay?:number, callback?:any, scope?:any ): Ext.IComponent; /** [Method] Implements an upward event bubbling policy */ - getBubbleTarget?(): void; + getBubbleTarget? (): Ext.container.IContainer; /** [Method] Retrieves the top level element representing this component */ getEl?(): Ext.dom.IElement; /** [Method] Retrieves the id of this component */ @@ -18229,7 +18229,7 @@ declare module Ext.form.field { /** [Method] Returns the name attribute of the field */ getName?(): string; /** [Method] Returns the raw value of the field without performing any normalization conversion or validation */ - getRawValue?(): string; + getRawValue?(): any; /** [Method] Creates and returns the data object to be used when rendering the fieldSubTpl */ getSubTplData?(): any; /** [Method] Gets the markup to be inserted into the outer template s bodyEl */ @@ -19611,7 +19611,7 @@ declare module Ext.form.field { /** [Method] Returns the value s that should be saved to the Ext data Model instance for this field when Ext form Basic updateRe */ getModelData?(): any; /** [Method] Returns the name attribute of the field */ - getName?(): any; + getName?(): string; /** [Method] Returns the parameter s that would be included in a standard form submit for this field */ getSubmitData?(): any; /** [Method] Returns the current data value of the field */ @@ -20480,7 +20480,7 @@ declare module Ext.form.field { /** [Method] Returns the value s that should be saved to the Ext data Model instance for this field when Ext form Basic updateRe */ getModelData?(): any; /** [Method] Returns the submit value for the checkbox which can be used when submitting forms */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Method to manage awareness of when components are removed from their respective Container firing a removed event */ onRemoved?(): void; /** [Method] Sets either the checked unchecked status of this Radio or if a string value is passed checks a sibling Radio of th @@ -20504,7 +20504,7 @@ declare module Ext.form { /** [Method] Returns the value s that should be saved to the Ext data Model instance for this field when Ext form Basic updateRe */ getModelData?(): any; /** [Method] Returns the submit value for the checkbox which can be used when submitting forms */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Method to manage awareness of when components are removed from their respective Container firing a removed event */ onRemoved?(): void; /** [Method] Sets either the checked unchecked status of this Radio or if a string value is passed checks a sibling Radio of th @@ -25343,8 +25343,8 @@ declare module Ext { * @param version String/Ext.Version The version, for example: '1.2.3alpha', '2.4.0-dev' */ export function setVersion( packageName?:any, version?:any ): any; - export function setVersion( packageName?:string, version?:string ): Ext; - export function setVersion( packageName?:string, version?:Ext.IVersion ): Ext; + export function setVersion( packageName?:string, version?:string ): any; + export function setVersion( packageName?:string, version?:Ext.IVersion ): any; /** [Method] Old alias to Ext Array sum * @param array Array The Array to calculate the sum value of. */ @@ -32643,7 +32643,7 @@ declare module Ext.slider { /** [Method] private override */ getSubTplData?(): any; /** [Method] Returns the value that would be included in a standard form submit for this field */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Returns the current value of the slider * @param index Number The index of the thumb to return a value for */ @@ -32731,7 +32731,7 @@ declare module Ext.slider { /** [Method] private override */ getSubTplData?(): any; /** [Method] Returns the value that would be included in a standard form submit for this field */ - getSubmitValue?(): any; + getSubmitValue?(): string; /** [Method] Returns the current value of the slider * @param index Number The index of the thumb to return a value for */ @@ -33971,7 +33971,10 @@ declare module Ext.tip { /** [Property] (HTMLElement) */ triggerElement?: HTMLElement; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] Binds this ToolTip to the specified element * @param t String/HTMLElement/Ext.Element The Element, HtmlElement, or ID of an element to bind to */ @@ -33980,7 +33983,9 @@ declare module Ext.tip { setTarget?( t?:HTMLElement ): void; setTarget?( t?:Ext.IElement ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; } } declare module Ext { @@ -34010,7 +34015,10 @@ declare module Ext { /** [Property] (HTMLElement) */ triggerElement?: HTMLElement; /** [Method] Hides this tooltip if visible */ - hide?(): void; + hide? (animateTarget?: any, callback?: any, scope?: any): any; + hide? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; + hide? (animateTarget?: Ext.IComponent, callback?: any, scope?: any): Ext.IComponent; /** [Method] Binds this ToolTip to the specified element * @param t String/HTMLElement/Ext.Element The Element, HtmlElement, or ID of an element to bind to */ @@ -34019,7 +34027,9 @@ declare module Ext { setTarget?( t?:HTMLElement ): void; setTarget?( t?:Ext.IElement ): void; /** [Method] Shows this tooltip at the current event target XY position */ - show?(): void; + show? (animateTarget?: any, callback?: any, scope?: any): any; + show? (animateTarget?: string, callback?: any, scope?: any): Ext.IComponent; + show? (animateTarget?: Ext.IElement, callback?: any, scope?: any): Ext.IComponent; } } declare module Ext.toolbar { diff --git a/highcharts/highcharts-test.ts b/highcharts/highcharts-tests.ts similarity index 96% rename from highcharts/highcharts-test.ts rename to highcharts/highcharts-tests.ts index 1aab23a19c..0e951dbbd2 100644 --- a/highcharts/highcharts-test.ts +++ b/highcharts/highcharts-tests.ts @@ -1,99 +1,99 @@ -/// - - -var animate: HighchartsBoolOrAnimation; -animate = true; -animate = { duration: 200, easing: "linear" }; - - -var gradient: HighchartsColorOrGradient; -gradient = { - linearGradient: { x0: 0, y0: 0, x1: 500, y1: 500 }, - stops: [ - [0, 'rgb(255, 255, 255)'], - [1, 'rgb(200, 200, 255)'] - ] -} - -var color = "#fcfcff"; - -var backgound: HighchartsColorOrGradient; - -backgound = gradient; -backgound = color; - -var chart1 = new Highcharts.Chart({ - chart: { - renderTo: "container" - }, - xAxis: [{ - }], - series: [{ - data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] - }] -}); - -var chart2 = new Highcharts.Chart({ - chart: { - renderTo: 'container', - width: 400, - height: 400, - spacingRight: 20 - }, - xAxis: [{ - type: 'logarithmic', - min: 1, - max: 1000, - endOnTick: true, - tickInterval: 1, - minorTickInterval: 0.1, - gridLineWidth: 1 - }], - yAxis: [{ - type: 'logarithmic', - min: 1, - max: 1000, - tickInterval: 1, - minorTickInterval: 0.1, - title: { - text: null - } - }], - legend: { - enabled: false - }, - series: [{ - data: [ - [550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144], - [581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730], - [374, 358], [440, 69], [704, 318], [646, 506], [238, 662], [233, 56], - [622, 572], [563, 903], [744, 672], [904, 646], [390, 325], [536, 491], - [676, 186], [467, 145], [790, 114], [437, 793], [853, 243], [947, 196], - [395, 728], [527, 148], [516, 675], [632, 562], [52, 552], [605, 580], - [790, 865], [156, 87], [584, 290], [339, 921], [383, 633], [106, 373], - [762, 863], [424, 149], [608, 959], [574, 711], [468, 664], [268, 77], - [894, 850], [171, 102], [203, 565], [592, 549], [86, 486], [526, 244], - [323, 575], [488, 842], [401, 618], [148, 43], [828, 314], [554, 711], - [685, 868], [387, 435], [469, 828], [623, 506], [436, 184], [450, 156], - [805, 517], [465, 997], [728, 802], [231, 438], [935, 438], [519, 856], - [378, 579], [73, 765], [223, 219], [359, 317], [686, 742], [17, 790], - [20, 35], [410, 644], [984, 325], [503, 882], [900, 187], [578, 968], - [27, 718], [355, 704], [395, 332], [641, 548], [964, 374], [215, 472], - [323, 66], [882, 542], [671, 327], [650, 193], [828, 632], [760, 929], - [607, 335], [928, 826], [462, 598], [631, 411] - ], - type: 'scatter' - }] -}); - -chart1.exportChart(null, { - chart: { - backgroundColor: '#FFFFFF' - } -}); - - -var div: HTMLDivElement; -var r = new Highcharts.Renderer(div, 20, 30); -var box = r.text("Hello", 10, 10).getBBox(); - +/// + + +var animate: HighchartsBoolOrAnimation; +animate = true; +animate = { duration: 200, easing: "linear" }; + + +var gradient: HighchartsColorOrGradient; +gradient = { + linearGradient: { x0: 0, y0: 0, x1: 500, y1: 500 }, + stops: [ + [0, 'rgb(255, 255, 255)'], + [1, 'rgb(200, 200, 255)'] + ] +} + +var color = "#fcfcff"; + +var backgound: HighchartsColorOrGradient; + +backgound = gradient; +backgound = color; + +var chart1 = new Highcharts.Chart({ + chart: { + renderTo: "container" + }, + xAxis: [{ + }], + series: [{ + data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] + }] +}); + +var chart2 = new Highcharts.Chart({ + chart: { + renderTo: 'container', + width: 400, + height: 400, + spacingRight: 20 + }, + xAxis: [{ + type: 'logarithmic', + min: 1, + max: 1000, + endOnTick: true, + tickInterval: 1, + minorTickInterval: 0.1, + gridLineWidth: 1 + }], + yAxis: [{ + type: 'logarithmic', + min: 1, + max: 1000, + tickInterval: 1, + minorTickInterval: 0.1, + title: { + text: null + } + }], + legend: { + enabled: false + }, + series: [{ + data: [ + [550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144], + [581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730], + [374, 358], [440, 69], [704, 318], [646, 506], [238, 662], [233, 56], + [622, 572], [563, 903], [744, 672], [904, 646], [390, 325], [536, 491], + [676, 186], [467, 145], [790, 114], [437, 793], [853, 243], [947, 196], + [395, 728], [527, 148], [516, 675], [632, 562], [52, 552], [605, 580], + [790, 865], [156, 87], [584, 290], [339, 921], [383, 633], [106, 373], + [762, 863], [424, 149], [608, 959], [574, 711], [468, 664], [268, 77], + [894, 850], [171, 102], [203, 565], [592, 549], [86, 486], [526, 244], + [323, 575], [488, 842], [401, 618], [148, 43], [828, 314], [554, 711], + [685, 868], [387, 435], [469, 828], [623, 506], [436, 184], [450, 156], + [805, 517], [465, 997], [728, 802], [231, 438], [935, 438], [519, 856], + [378, 579], [73, 765], [223, 219], [359, 317], [686, 742], [17, 790], + [20, 35], [410, 644], [984, 325], [503, 882], [900, 187], [578, 968], + [27, 718], [355, 704], [395, 332], [641, 548], [964, 374], [215, 472], + [323, 66], [882, 542], [671, 327], [650, 193], [828, 632], [760, 929], + [607, 335], [928, 826], [462, 598], [631, 411] + ], + type: 'scatter' + }] +}); + +chart1.exportChart(null, { + chart: { + backgroundColor: '#FFFFFF' + } +}); + + +var div: HTMLDivElement; +var r = new Highcharts.Renderer(div, 20, 30); +var box = r.text("Hello", 10, 10).getBBox(); + diff --git a/jquerymobile/jquerymobile.d.ts b/jquerymobile/jquerymobile.d.ts index 2d6fa744a1..84c27ba41a 100644 --- a/jquerymobile/jquerymobile.d.ts +++ b/jquerymobile/jquerymobile.d.ts @@ -291,11 +291,8 @@ interface JQueryMobile extends JQueryMobileOptions { showPageLoadingMsg(); hidePageLoadingMsg(); loader; - loading; - loadPage; page; - silentScroll; touchOverflow; showCategory; path; diff --git a/jsoneditoronline/jsoneditoronline.d.ts b/jsoneditoronline/jsoneditoronline.d.ts index 7bdacf0ac7..4b46f4ec03 100644 --- a/jsoneditoronline/jsoneditoronline.d.ts +++ b/jsoneditoronline/jsoneditoronline.d.ts @@ -12,7 +12,7 @@ interface JSONEditorOptions { search?: bool; } -class JSONEditorHistory { +declare class JSONEditorHistory { constructor(editor: JSONEditor); onChange(): void; add(action: string, params: Object); @@ -40,7 +40,7 @@ interface JSONEditorConstructorParams { value?: any; } -class JSONEditorNode { +declare class JSONEditorNode { constructor(editor: JSONEditor, params: JSONEditorConstructorParams); setParent(parent: JSONEditorNode): void; getParent(): JSONEditorNode; @@ -77,7 +77,7 @@ class JSONEditorNode { getAppend(): HTMLElement; } -class JSONEditorAppendNode extends JSONEditorNode { +declare class JSONEditorAppendNode extends JSONEditorNode { constructor(editor: JSONEditor); } @@ -92,7 +92,7 @@ interface JSONEditorShowDropDownListParams { callback: (value: any) => void; } -class JSONEditorSearchBox { +declare class JSONEditorSearchBox { constructor(editor: JSONEditor, container: HTMLElement); next(): void; previous(): void; @@ -126,7 +126,7 @@ interface JSONEditorActionParams { newType?: JSONEditorNodeType; } -class JSONEditor { +declare class JSONEditor { constructor(container: HTMLElement, options?: JSONEditorOptions, json?: any); set(json: Object, name?: string): void; setName(name?: string): void; @@ -170,7 +170,7 @@ interface JSONFormatterOptions { indentation?: number; } -class JSONFormatter { +declare class JSONFormatter { constructor(container: HTMLElement, options?: JSONFormatterOptions, json?: any); set(json: Object); get(): Object; diff --git a/jstorage/jstorage-tests.ts b/jstorage/jstorage-tests.ts index a8bd01af42..e86e9ffd43 100644 --- a/jstorage/jstorage-tests.ts +++ b/jstorage/jstorage-tests.ts @@ -1,3 +1,4 @@ +/// /// // Test set first overload diff --git a/jstorage/jstorage.d.ts b/jstorage/jstorage.d.ts index 0acc93fbd1..8e99a08a7f 100644 --- a/jstorage/jstorage.d.ts +++ b/jstorage/jstorage.d.ts @@ -3,15 +3,15 @@ // Definitions by: Danil Flores // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module $.jStorage { +interface JStorageOptions { + TTL: number; +} - class IStorageOptions { - TTL: number; - } +interface JStorageReadonlyStore { + [key: string]: any; +} - interface IJStorage { - [key: string]: any; - } +interface JStorageStatic { /** * Sets a key's value. @@ -24,7 +24,7 @@ declare module $.jStorage { * @param [options.TTL] - optional TTL value * @return the used value */ - function set (key: string, value: TValue, options?: IStorageOptions): TValue; + set(key: string, value: TValue, options?: JStorageOptions): TValue; /** * Looks up a key in cache @@ -33,7 +33,7 @@ declare module $.jStorage { * @param defaultIfNotFound - Default value to return, if key didn't exist. * @return the key value, default value or null */ - function get (key: string, defaultIfNotFound?: TValue): TValue; + get (key: string, defaultIfNotFound?: TValue): TValue; /** * Deletes a key from cache. @@ -41,7 +41,7 @@ declare module $.jStorage { * @param key - Key to delete. * @return true if key existed or false if it didn't */ - function deleteKey(key: string): boolean; + deleteKey(key: string): boolean; /** * Sets a TTL for a key, or remove it if ttl value is 0 or below @@ -50,7 +50,7 @@ declare module $.jStorage { * @param ttl - TTL timeout in milliseconds * @return true if key existed or false if it didn't */ - function setTTL(key: string, ttl: number): boolean; + setTTL(key: string, ttl: number): boolean; /** * Gets remaining TTL (in milliseconds) for a key or 0 when no TTL has been set @@ -58,21 +58,21 @@ declare module $.jStorage { * @param key Key to check * @return Remaining TTL in milliseconds */ - function getTTL(key: string): number; + getTTL(key: string): number; /** * Deletes everything in cache. * * @return Always true */ - function flush(): boolean; + flush(): boolean; /** * Returns a read-only copy of _storage * * @return Read-only copy of _storage */ - function storageObj(): IJStorage + storageObj(): JStorageReadonlyStore /** * Returns an index of all used keys as an array @@ -80,7 +80,7 @@ declare module $.jStorage { * * @return Used keys */ - function index(): string[]; + index(): string[]; /** * How much space in bytes does the storage take? @@ -88,21 +88,21 @@ declare module $.jStorage { * @return Storage size in chars (not the same as in bytes, * since some chars may take several bytes) */ - function storageSize(): number; + storageSize(): number; /** * Which backend is currently in use? * * @return Backend name */ - function currentBackend(): Storage; + currentBackend(): Storage; /** * Test if storage is available * * @return True if storage can be used */ - function storageAvailable(): boolean; + storageAvailable(): boolean; /** * Register change listeners @@ -110,7 +110,7 @@ declare module $.jStorage { * @param key Key name * @param callback Function to run when the key changes */ - function listenKeyChange(key: string, callback: (key: string, value: any) => void ): void; + listenKeyChange(key: string, callback: (key: string, value: any) => void ): void; /** * Register change listeners @@ -118,7 +118,7 @@ declare module $.jStorage { * @param key Key name * @param callback Function to run when the key changes */ - function listenKeyChange(key: string, callback: (key: string, value: TValue) => void ): void; + listenKeyChange(key: string, callback: (key: string, value: TValue) => void ): void; /** * Remove change listeners @@ -126,7 +126,7 @@ declare module $.jStorage { * @param key Key name to unregister listeners against * @param [callback] If set, unregister the callback, if not - unregister all */ - function stopListening(key: string, callback?: Function): void; + stopListening(key: string, callback?: Function): void; /** * Subscribe to a Publish/Subscribe event stream @@ -134,7 +134,7 @@ declare module $.jStorage { * @param channel Channel name * @param callback Function to run when the something is published to the channel */ - function subscribe(channel: string, callback: (channel: string, value: any) => void ): void; + subscribe(channel: string, callback: (channel: string, value: any) => void ): void; /** * Subscribe to a Publish/Subscribe event stream @@ -142,7 +142,7 @@ declare module $.jStorage { * @param channel Channel name * @param callback Function to run when the something is published to the channel */ - function subscribe(channel: string, callback: (channel: string, value: TValue) => void ): void; + subscribe(channel: string, callback: (channel: string, value: TValue) => void ): void; /** * Publish data to an event stream @@ -150,10 +150,14 @@ declare module $.jStorage { * @param channel Channel name * @param payload Payload to deliver */ - function publish(channel: string, payload: any): void; + publish(channel: string, payload: any): void; /** * Reloads the data from browser storage */ - function reInit(): void; + reInit(): void; +} + +interface JQueryStatic { + jStorage: JStorageStatic; } \ No newline at end of file diff --git a/kolite/kolite.d.ts b/kolite/kolite.d.ts index c6c5ec35e5..d86573116f 100644 --- a/kolite/kolite.d.ts +++ b/kolite/kolite.d.ts @@ -41,7 +41,7 @@ interface JQuery { // DirtyFlag ///////////////////////////////////////////// interface DirtyFlag { - isDirty: KnockoutComputed; + isDirty: KnockoutComputed; new (objectToTrack: any, isInitiallyDirty?: bool, hashFunction?: () => any); reset(): void; } @@ -54,7 +54,7 @@ interface KnockoutStatic { // Command ///////////////////////////////////////////// interface KoliteCommand { - canExecute: KnockoutComputed; + canExecute: KnockoutComputed; execute(...args: any[]): any; } diff --git a/logg/logg-test.ts b/logg/logg-tests.ts similarity index 100% rename from logg/logg-test.ts rename to logg/logg-tests.ts diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 044bd890b5..9e524719ff 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -5,11 +5,15 @@ declare module "marked" { - export function (src: string, opt?: Options): string; - export function lexer(src: string, opt?: Options): any[]; - export function parser(src: any[], opt?: Options): string; - export function parse(src: string, opt?: Options): string; - export function setOptions(opt: Options): void; + function marked(src: string, opt?: Options): string; + module marked { + export function lexer(src: string, opt?: Options): any[]; + export function parser(src: any[], opt?: Options): string; + export function parse(src: string, opt?: Options): string; + export function setOptions(opt: Options): void; + } + + export = marked; } interface Options { diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 152b8a9f8a..968d2143f2 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -12,17 +12,6 @@ declare var process: NodeProcess; declare var global: any; -declare var console: { - log(...data: any[]): void; - info(...data: any[]): void; - error(...data: any[]): void; - warn(...data: any[]): void; - dir(obj: any): void; - timeEnd(label: string): void; - trace(label: string): void; - assert(expression: any, ...message: string[]): void; -} - declare var __filename: string; declare var __dirname: string; @@ -309,7 +298,7 @@ declare module "cluster" { } export interface Worker { id: string; - process: child_process; + process: child_process.ChildProcess; suicide: bool; send(message: any, sendHandle?: any): void; destroy(): void; @@ -1015,19 +1004,23 @@ declare module "util" { } declare module "assert" { - export function (booleanValue: bool, message?: string); - export function fail(actual: any, expected: any, message: string, operator: string): void; - export function assert(value: any, message: 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; - export function deepEqual(actual: any, expected: any, message?: string): void; - 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 ifError(value: any): void; + function internal(booleanValue: boolean, 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 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; + export function deepEqual(actual: any, expected: any, message?: string): void; + 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 ifError(value: any): void; + } + + export = internal; } declare module "tty" { diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index 681dd089b0..7d62b7fa56 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -4,7 +4,7 @@ // Definitions by: Vincent Bortone // Definitions: https://github.com/borisyankov/DefinitelyTyped -class Transport { +declare class Transport { static transports: { SMTP: Transport; SES: Transport; @@ -47,7 +47,7 @@ interface DKIMOptions{ privateKey: any; } -class XOAuthGenerator { +declare class XOAuthGenerator { constructor(options: XOAuthGeneratorOptions); generate(callback: () => any): string; } diff --git a/pouchDB/pouch.d.ts b/pouchDB/pouch.d.ts index 0fa6a1eb26..44730ca4dd 100644 --- a/pouchDB/pouch.d.ts +++ b/pouchDB/pouch.d.ts @@ -215,7 +215,7 @@ interface Pouch extends PouchApi { destroy(name: string, callback: (err: PouchError) => void): void; } -var Pouch: Pouch; +declare var Pouch: Pouch; // // emit is the function that the PouchFilter.map function should call in order to add a particular item to // a filter view. diff --git a/preloadjs/preloadjs.d.ts b/preloadjs/preloadjs.d.ts index 16d939e20b..1b882f9cfe 100644 --- a/preloadjs/preloadjs.d.ts +++ b/preloadjs/preloadjs.d.ts @@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -module createjs { +declare module createjs { export class AbstractLoader { // properties canceled: bool; diff --git a/pubsubjs/pubsub.d.ts b/pubsubjs/pubsub.d.ts index f7bbbbf872..ae5b960f93 100644 --- a/pubsubjs/pubsub.d.ts +++ b/pubsubjs/pubsub.d.ts @@ -1,6 +1,6 @@ // Type definitions for PubSubJS 1.3.5 -module PubSubJS { +declare module PubSubJS { interface Base extends Publish, Subscribe, Unsubscribe { version: string; name: string; diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 78f7e2808e..641c378871 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -12,4 +12,4 @@ interface Route { toURL(params: any): string; } -function routie(path: string, fn: Function): void; \ No newline at end of file +declare function routie(path: string, fn: Function): void; \ No newline at end of file diff --git a/sencha_touch/SenchaTouch.d.ts b/sencha_touch/SenchaTouch.d.ts index 2c2ed1e245..c2d13a06c6 100644 --- a/sencha_touch/SenchaTouch.d.ts +++ b/sencha_touch/SenchaTouch.d.ts @@ -69,7 +69,8 @@ declare module Ext { /** [Method] Returns the value of baseCls */ getBaseCls?(): string; /** [Method] Returns the value of bottom */ - getBottom?(): number; + getBottom? (): any; + getBottom? (): number; /** [Method] Returns the value of defaultType */ getDefaultType?(): string; /** [Method] Returns the value of height */ @@ -2294,7 +2295,7 @@ declare module Ext.carousel { /** [Config Option] (Boolean) */ indicator?: bool; /** [Method] Returns the value of indicator */ - getIndicator?(): any; + getIndicator?(): boolean; /** [Method] Returns the value of innerItemConfig */ getInnerItemConfig?(): any; /** [Method] Returns the value of maxItemIndex */ @@ -3943,7 +3944,7 @@ declare module Ext.chart { */ clear?( category?:string ): void; /** [Method] Not supported */ - getBBox?(): undefined; + getBBox?(): any; /** [Method] * @param category String * @param index Mixed @@ -4331,7 +4332,8 @@ declare module Ext.chart.series { /** [Method] Returns the value of donut */ getDonut?(): number; /** [Method] Returns the value of hidden */ - getHidden?(): any[]; + getHidden? (): boolean; + getHidden? (): any[]; /** [Method] For a given x y point relative to the main region find a corresponding item from this series if any * @param x Object * @param y Object @@ -5253,6 +5255,7 @@ declare module Ext.chart.series { /** [Config Option] (Boolean) */ stacked?: bool; /** [Method] Returns the value of hidden */ + getHidden? (): boolean; getHidden?(): any[]; /** [Method] For a given x y point relative to the main region find a corresponding item from this series if any * @param x Object @@ -7024,7 +7027,7 @@ declare module Ext.data.association { /** [Method] Returns the value of associationKey */ getAssociationKey?(): string; /** [Method] Returns the value of name */ - getName?(): any; + getName?(): string; /** [Method] Returns the value of ownerModel */ getOwnerModel?(): Ext.data.IModel; /** [Method] Returns the value of ownerModel */ @@ -7100,7 +7103,7 @@ declare module Ext.data { /** [Method] Returns the value of associationKey */ getAssociationKey?(): string; /** [Method] Returns the value of name */ - getName?(): any; + getName?(): string; /** [Method] Returns the value of ownerModel */ getOwnerModel?(): Ext.data.IModel; /** [Method] Returns the value of ownerModel */ @@ -8655,7 +8658,7 @@ declare module Ext.data { /** [Method] Marks this Record as dirty */ setDirty?(): void; /** [Method] Updates the collection of Fields that all instances of this Model use */ - setFields?(): any[]; + setFields? (fields?: any[]): void; /** [Method] Sets the value of hasMany * @param hasMany String/Object/String[]/Object[] */ @@ -11310,9 +11313,9 @@ declare module Ext.data.reader { /** [Config Option] (String) */ totalProperty?: string; /** [Method] Returns the value of successProperty */ - getSuccessProperty?(): any; + getSuccessProperty?(): string; /** [Method] Returns the value of totalProperty */ - getTotalProperty?(): any; + getTotalProperty?(): string; /** [Method] Sets the value of successProperty * @param successProperty Object */ @@ -11330,9 +11333,9 @@ declare module Ext.data { /** [Config Option] (String) */ totalProperty?: string; /** [Method] Returns the value of successProperty */ - getSuccessProperty?(): any; + getSuccessProperty?(): string; /** [Method] Returns the value of totalProperty */ - getTotalProperty?(): any; + getTotalProperty?(): string; /** [Method] Sets the value of successProperty * @param successProperty Object */ @@ -14605,6 +14608,7 @@ declare module Ext.dataview.component { /** [Method] Returns the value of record */ getRecord?(): Ext.data.IModel; /** [Method] Returns the value of width */ + getWidth? (): number; getWidth?(): string; /** [Method] Sets the value of baseCls * @param baseCls String @@ -14659,9 +14663,15 @@ declare module Ext.dataview.component { /** [Method] Returns the value of header */ getHeader?(): any; /** [Method] Returns the value of items */ - getItems?(): any; + getItems? (): any[]; /** [Method] Returns the value of tpl */ - getTpl?(): any; + getTpl? (): string; + /** [Method] Returns the value of tpl */ + getTpl? (): string[]; + /** [Method] Returns the value of tpl */ + getTpl? (): Ext.ITemplate[]; + /** [Method] Returns the value of tpl */ + getTpl? (): Ext.IXTemplate[]; /** [Method] Sets the value of baseCls * @param baseCls String */ @@ -15609,7 +15619,7 @@ declare module Ext.dataview { /** [Method] Returns all the items that are docked in the scroller in this list */ getScrollDockedItems?(): any[]; /** [Method] Returns the value of scrollable */ - getScrollable?(): any; + getScrollable?(): boolean; /** [Method] Returns the value of striped */ getStriped?(): bool; /** [Method] Returns the value of ui */ @@ -15767,7 +15777,7 @@ declare module Ext { /** [Method] Returns all the items that are docked in the scroller in this list */ getScrollDockedItems?(): any[]; /** [Method] Returns the value of scrollable */ - getScrollable?(): any; + getScrollable?(): boolean; /** [Method] Returns the value of striped */ getStriped?(): bool; /** [Method] Returns the value of ui */ @@ -15965,7 +15975,7 @@ declare module Ext.dataview { /** [Method] Returns the value of toolbar */ getToolbar?(): any; /** [Method] Returns the value of ui */ - getUi?(): any; + getUi?(): string; /** [Method] Returns the value of updateTitleText */ getUpdateTitleText?(): bool; /** [Method] Returns the value of useSimpleItems */ @@ -16176,7 +16186,7 @@ declare module Ext { /** [Method] Returns the value of toolbar */ getToolbar?(): any; /** [Method] Returns the value of ui */ - getUi?(): any; + getUi?(): string; /** [Method] Returns the value of updateTitleText */ getUpdateTitleText?(): bool; /** [Method] Returns the value of useSimpleItems */ @@ -19574,8 +19584,8 @@ declare module Ext.direct { /** [Method] Removes the provider * @param provider String/Ext.direct.Provider The provider instance or the id of the provider. */ - static removeProvider( provider?:string ): undefined; - static removeProvider( provider?:Ext.direct.IProvider ): undefined; + static removeProvider( provider?:string ): any; + static removeProvider( provider?:Ext.direct.IProvider ): any; /** [Method] Resumes firing events see suspendEvents * @param discardQueuedEvents Boolean Pass as true to discard any queued events. */ @@ -19853,8 +19863,8 @@ declare module Ext { /** [Method] Removes the provider * @param provider String/Ext.direct.Provider The provider instance or the id of the provider. */ - static removeProvider( provider?:string ): undefined; - static removeProvider( provider?:Ext.direct.IProvider ): undefined; + static removeProvider( provider?:string ): any; + static removeProvider( provider?:Ext.direct.IProvider ): any; /** [Method] Resumes firing events see suspendEvents * @param discardQueuedEvents Boolean Pass as true to discard any queued events. */ @@ -20211,7 +20221,7 @@ declare module Ext.direct { /** [Method] Returns the value of len */ getLen?(): any; /** [Method] Returns the value of name */ - getName?(): any; + getName?(): string; /** [Method] Returns the value of ordered */ getOrdered?(): bool; /** [Method] Returns the value of params */ @@ -20488,10 +20498,10 @@ declare module Ext.dom { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 50 || document.body) * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Looks at parent nodes for a match of the passed simple selector e g * @param simpleSelector String The simple selector to test. * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). @@ -20507,12 +20517,25 @@ declare module Ext.dom { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; - /** [Method] Returns the first Element */ - first?(): Ext.dom.IElement; + findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): any; /** [Method] Gets the x y coordinates to align this element with another element * @param element Mixed The element to align to. * @param position String The position to align to. @@ -20682,9 +20705,22 @@ declare module Ext.dom { /** [Method] Returns a flyweight Element of the dom element object at the specified index * @param index Number */ - item?( index?:number ): Ext.dom.IElement; - /** [Method] Returns the last Element */ - last?(): Ext.dom.IElement; + item? (index?: number): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): any; /** [Method] Puts a mask over this element to disable user interaction */ mask?(): void; /** [Method] Gets the next sibling skipping text nodes @@ -20701,7 +20737,7 @@ declare module Ext.dom { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw dom node instead of an Ext.dom.Element. */ - next?( selector?:string, returnDom?:bool ): undefined; + next?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the parent node for this element optionally chaining up trying to match a selector * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. @@ -20716,7 +20752,7 @@ declare module Ext.dom { * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - parent?( selector?:string, returnDom?:bool ): undefined; + parent?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the previous sibling skipping text nodes * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element @@ -20731,7 +20767,7 @@ declare module Ext.dom { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element */ - prev?( selector?:string, returnDom?:bool ): undefined; + prev?( selector?:string, returnDom?:bool ): any; /** [Method] Removes all listeners for this object */ purgeAllListeners?(): void; /** [Method] Selects child nodes based on the passed CSS selector the selector should not contain an id @@ -20947,10 +20983,10 @@ declare module Ext.dom { * @param simpleSelector String The simple selector to test * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). */ - up?( simpleSelector?:string, maxDepth?:number ): undefined; - up?( simpleSelector?:string, maxDepth?:string ): undefined; - up?( simpleSelector?:string, maxDepth?:HTMLElement ): undefined; - up?( simpleSelector?:string, maxDepth?:Ext.IElement ): undefined; + up?( simpleSelector?:string, maxDepth?:number ): any; + up?( simpleSelector?:string, maxDepth?:string ): any; + up?( simpleSelector?:string, maxDepth?:HTMLElement ): any; + up?( simpleSelector?:string, maxDepth?:Ext.IElement ): any; /** [Method] Sets the innerHTML of this element * @param html String The new HTML. */ @@ -21081,10 +21117,10 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 50 || document.body) * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Looks at parent nodes for a match of the passed simple selector e g * @param simpleSelector String The simple selector to test. * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). @@ -21100,12 +21136,25 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; - /** [Method] Returns the first Element */ - first?(): Ext.dom.IElement; + findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParentNode? (simpleSelector?: string, maxDepth?: Ext.IElement, returnEl?: bool): any; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): any; /** [Method] Gets the x y coordinates to align this element with another element * @param element Mixed The element to align to. * @param position String The position to align to. @@ -21275,9 +21324,22 @@ declare module Ext { /** [Method] Returns a flyweight Element of the dom element object at the specified index * @param index Number */ - item?( index?:number ): Ext.dom.IElement; - /** [Method] Returns the last Element */ - last?(): Ext.dom.IElement; + item? (index?: number): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): any; /** [Method] Puts a mask over this element to disable user interaction */ mask?(): void; /** [Method] Gets the next sibling skipping text nodes @@ -21294,7 +21356,7 @@ declare module Ext { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw dom node instead of an Ext.dom.Element. */ - next?( selector?:string, returnDom?:bool ): undefined; + next?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the parent node for this element optionally chaining up trying to match a selector * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. @@ -21309,7 +21371,7 @@ declare module Ext { * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - parent?( selector?:string, returnDom?:bool ): undefined; + parent?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the previous sibling skipping text nodes * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element @@ -21324,7 +21386,7 @@ declare module Ext { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element */ - prev?( selector?:string, returnDom?:bool ): undefined; + prev?( selector?:string, returnDom?:bool ): any; /** [Method] Removes all listeners for this object */ purgeAllListeners?(): void; /** [Method] Selects child nodes based on the passed CSS selector the selector should not contain an id @@ -21540,10 +21602,10 @@ declare module Ext { * @param simpleSelector String The simple selector to test * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). */ - up?( simpleSelector?:string, maxDepth?:number ): undefined; - up?( simpleSelector?:string, maxDepth?:string ): undefined; - up?( simpleSelector?:string, maxDepth?:HTMLElement ): undefined; - up?( simpleSelector?:string, maxDepth?:Ext.IElement ): undefined; + up?( simpleSelector?:string, maxDepth?:number ): any; + up?( simpleSelector?:string, maxDepth?:string ): any; + up?( simpleSelector?:string, maxDepth?:HTMLElement ): any; + up?( simpleSelector?:string, maxDepth?:Ext.IElement ): any; /** [Method] Sets the innerHTML of this element * @param html String The new HTML. */ @@ -21674,10 +21736,10 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 50 || document.body) * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Looks at parent nodes for a match of the passed simple selector e g * @param simpleSelector String The simple selector to test. * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). @@ -21693,12 +21755,25 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; - /** [Method] Returns the first Element */ - first?(): Ext.dom.IElement; + findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParentNode? (simpleSelector?: string, maxDepth?: Ext.IElement, returnEl?: bool): any; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the first child skipping text nodes + * @param selector String Find the next sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + first? (selector?: string, returnDom?: bool): any; /** [Method] Gets the x y coordinates to align this element with another element * @param element Mixed The element to align to. * @param position String The position to align to. @@ -21868,9 +21943,22 @@ declare module Ext { /** [Method] Returns a flyweight Element of the dom element object at the specified index * @param index Number */ - item?( index?:number ): Ext.dom.IElement; - /** [Method] Returns the last Element */ - last?(): Ext.dom.IElement; + item? (index?: number): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): Ext.dom.IElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): HTMLElement; + /** [Method] Gets the last child skipping text nodes + * @param selector String Find the previous sibling that matches the passed simple selector. + * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. + */ + last? (selector?: string, returnDom?: bool): any; /** [Method] Puts a mask over this element to disable user interaction */ mask?(): void; /** [Method] Gets the next sibling skipping text nodes @@ -21887,7 +21975,7 @@ declare module Ext { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw dom node instead of an Ext.dom.Element. */ - next?( selector?:string, returnDom?:bool ): undefined; + next?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the parent node for this element optionally chaining up trying to match a selector * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. @@ -21902,7 +21990,7 @@ declare module Ext { * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - parent?( selector?:string, returnDom?:bool ): undefined; + parent?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the previous sibling skipping text nodes * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element @@ -21917,7 +22005,7 @@ declare module Ext { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element */ - prev?( selector?:string, returnDom?:bool ): undefined; + prev?( selector?:string, returnDom?:bool ): any; /** [Method] Removes all listeners for this object */ purgeAllListeners?(): void; /** [Method] Selects child nodes based on the passed CSS selector the selector should not contain an id @@ -22133,10 +22221,10 @@ declare module Ext { * @param simpleSelector String The simple selector to test * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). */ - up?( simpleSelector?:string, maxDepth?:number ): undefined; - up?( simpleSelector?:string, maxDepth?:string ): undefined; - up?( simpleSelector?:string, maxDepth?:HTMLElement ): undefined; - up?( simpleSelector?:string, maxDepth?:Ext.IElement ): undefined; + up?( simpleSelector?:string, maxDepth?:number ): any; + up?( simpleSelector?:string, maxDepth?:string ): any; + up?( simpleSelector?:string, maxDepth?:HTMLElement ): any; + up?( simpleSelector?:string, maxDepth?:Ext.IElement ): any; /** [Method] Sets the innerHTML of this element * @param html String The new HTML. */ @@ -22289,10 +22377,10 @@ declare module Ext.dom { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 50 || document.body) * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Looks at parent nodes for a match of the passed simple selector e g * @param simpleSelector String The simple selector to test. * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). @@ -22308,10 +22396,10 @@ declare module Ext.dom { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Fires the specified event with the passed parameters and execute a function action at the end if there are no liste * @param eventName String The name of the event to fire. * @param args Array Arguments to pass to handers. @@ -22338,7 +22426,7 @@ declare module Ext.dom { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - first?( selector?:string, returnDom?:bool ): undefined; + first?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the x y coordinates to align this element with another element * @param element Mixed The element to align to. * @param position String The position to align to. @@ -22519,7 +22607,7 @@ declare module Ext.dom { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - last?( selector?:string, returnDom?:bool ): undefined; + last?( selector?:string, returnDom?:bool ): any; /** [Method] Puts a mask over this element to disable user interaction */ mask?(): void; /** [Method] Alias for addManagedListener @@ -22555,7 +22643,7 @@ declare module Ext.dom { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw dom node instead of an Ext.dom.Element. */ - next?( selector?:string, returnDom?:bool ): undefined; + next?( selector?:string, returnDom?:bool ): any; /** [Method] Alias for addListener * @param eventName String/String[]/Object The name of the event to listen for. May also be an object who's property names are event names. * @param fn Function/String The method the event invokes. Will be called with arguments given to fireEvent plus the options parameter described below. @@ -22596,7 +22684,7 @@ declare module Ext.dom { * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - parent?( selector?:string, returnDom?:bool ): undefined; + parent?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the previous sibling skipping text nodes * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element @@ -22611,7 +22699,7 @@ declare module Ext.dom { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element */ - prev?( selector?:string, returnDom?:bool ): undefined; + prev?( selector?:string, returnDom?:bool ): any; /** [Method] Removes all listeners for this object */ purgeAllListeners?(): void; /** [Method] Selects child nodes based on the passed CSS selector the selector should not contain an id @@ -22879,10 +22967,10 @@ declare module Ext.dom { * @param simpleSelector String The simple selector to test * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). */ - up?( simpleSelector?:string, maxDepth?:number ): undefined; - up?( simpleSelector?:string, maxDepth?:string ): undefined; - up?( simpleSelector?:string, maxDepth?:HTMLElement ): undefined; - up?( simpleSelector?:string, maxDepth?:Ext.IElement ): undefined; + up?( simpleSelector?:string, maxDepth?:number ): any; + up?( simpleSelector?:string, maxDepth?:string ): any; + up?( simpleSelector?:string, maxDepth?:HTMLElement ): any; + up?( simpleSelector?:string, maxDepth?:Ext.IElement ): any; /** [Method] Sets the innerHTML of this element * @param html String The new HTML. */ @@ -23085,10 +23173,10 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 50 || document.body) * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParent?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParent?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Looks at parent nodes for a match of the passed simple selector e g * @param simpleSelector String The simple selector to test. * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). @@ -23104,10 +23192,10 @@ declare module Ext { * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). * @param returnEl Boolean true to return a Ext.Element object instead of DOM node. */ - findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): undefined; - findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): undefined; + findParentNode?( simpleSelector?:string, maxDepth?:number, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:string, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:HTMLElement, returnEl?:bool ): any; + findParentNode?( simpleSelector?:string, maxDepth?:Ext.IElement, returnEl?:bool ): any; /** [Method] Fires the specified event with the passed parameters and execute a function action at the end if there are no liste * @param eventName String The name of the event to fire. * @param args Array Arguments to pass to handers. @@ -23134,7 +23222,7 @@ declare module Ext { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - first?( selector?:string, returnDom?:bool ): undefined; + first?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the x y coordinates to align this element with another element * @param element Mixed The element to align to. * @param position String The position to align to. @@ -23315,7 +23403,7 @@ declare module Ext { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - last?( selector?:string, returnDom?:bool ): undefined; + last?( selector?:string, returnDom?:bool ): any; /** [Method] Puts a mask over this element to disable user interaction */ mask?(): void; /** [Method] Alias for addManagedListener @@ -23351,7 +23439,7 @@ declare module Ext { * @param selector String Find the next sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw dom node instead of an Ext.dom.Element. */ - next?( selector?:string, returnDom?:bool ): undefined; + next?( selector?:string, returnDom?:bool ): any; /** [Method] Alias for addListener * @param eventName String/String[]/Object The name of the event to listen for. May also be an object who's property names are event names. * @param fn Function/String The method the event invokes. Will be called with arguments given to fireEvent plus the options parameter described below. @@ -23392,7 +23480,7 @@ declare module Ext { * @param selector String Find a parent node that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element. */ - parent?( selector?:string, returnDom?:bool ): undefined; + parent?( selector?:string, returnDom?:bool ): any; /** [Method] Gets the previous sibling skipping text nodes * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element @@ -23407,7 +23495,7 @@ declare module Ext { * @param selector String Find the previous sibling that matches the passed simple selector. * @param returnDom Boolean true to return a raw DOM node instead of an Ext.dom.Element */ - prev?( selector?:string, returnDom?:bool ): undefined; + prev?( selector?:string, returnDom?:bool ): any; /** [Method] Removes all listeners for this object */ purgeAllListeners?(): void; /** [Method] Selects child nodes based on the passed CSS selector the selector should not contain an id @@ -23675,10 +23763,10 @@ declare module Ext { * @param simpleSelector String The simple selector to test * @param maxDepth Number/String/HTMLElement/Ext.Element The max depth to search as a number or element (defaults to 10 || document.body). */ - up?( simpleSelector?:string, maxDepth?:number ): undefined; - up?( simpleSelector?:string, maxDepth?:string ): undefined; - up?( simpleSelector?:string, maxDepth?:HTMLElement ): undefined; - up?( simpleSelector?:string, maxDepth?:Ext.IElement ): undefined; + up?( simpleSelector?:string, maxDepth?:number ): any; + up?( simpleSelector?:string, maxDepth?:string ): any; + up?( simpleSelector?:string, maxDepth?:HTMLElement ): any; + up?( simpleSelector?:string, maxDepth?:Ext.IElement ): any; /** [Method] Sets the innerHTML of this element * @param html String The new HTML. */ @@ -24348,7 +24436,8 @@ declare module Ext.draw { /** [Method] Returns the value of background */ getBackground?(): any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of fitSurface */ getFitSurface?(): bool; /** [Method] Returns the value of resizeHandler */ @@ -25118,9 +25207,9 @@ declare module Ext.draw { */ rotate?( angle?:any, rcx?:any, rcy?:any, prepend?:any ): any; rotate?( angle?:number, rcx?:number, rcy?:number, prepend?:bool ): Ext.draw.IMatrix; - rotate?( angle?:number, rcx?:undefined, rcy?:number, prepend?:bool ): Ext.draw.IMatrix; - rotate?( angle?:number, rcx?:number, rcy?:undefined, prepend?:bool ): Ext.draw.IMatrix; - rotate?( angle?:number, rcx?:undefined, rcy?:undefined, prepend?:bool ): Ext.draw.IMatrix; + rotate?( angle?:number, rcx?:any, rcy?:number, prepend?:bool ): Ext.draw.IMatrix; + rotate?( angle?:number, rcx?:number, rcy?:any, prepend?:bool ): Ext.draw.IMatrix; + rotate?( angle?:number, rcx?:any, rcy?:any, prepend?:bool ): Ext.draw.IMatrix; /** [Method] Rotate the matrix by the angle of a vector * @param x Number * @param y Number @@ -26094,7 +26183,7 @@ declare module Ext.draw.sprite { /** [Method] Removes the sprite and clears all listeners */ destroy?(): void; /** [Method] Not supported */ - getBBox?(): undefined; + getBBox?(): any; /** [Method] Returns the bounding box for the instance at the given index * @param index Number The index of the instance. * @param isWithoutTransform Boolean 'true' to not apply sprite transforms to the bounding box. @@ -28195,7 +28284,8 @@ declare module Ext.field { /** [Method] Returns the checked value of this field */ getChecked?(): any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of disabled */ getDisabled?(): bool; /** [Method] Returns the value of focusCls */ @@ -28826,7 +28916,8 @@ declare module Ext.field { /** [Config Option] (Number/Number[]) */ values?: any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of increment */ getIncrement?(): number; /** [Method] Returns the value of maxValue */ @@ -28836,7 +28927,7 @@ declare module Ext.field { /** [Method] Returns the value of readOnly */ getReadOnly?(): bool; /** [Method] Returns the value of tabIndex */ - getTabIndex?(): any; + getTabIndex?(): number; /** [Method] Returns the value of value */ getValue?(): number; /** [Method] Returns the value of value */ @@ -28902,7 +28993,8 @@ declare module Ext.form { /** [Config Option] (Number/Number[]) */ values?: any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of increment */ getIncrement?(): number; /** [Method] Returns the value of maxValue */ @@ -28912,7 +29004,7 @@ declare module Ext.form { /** [Method] Returns the value of readOnly */ getReadOnly?(): bool; /** [Method] Returns the value of tabIndex */ - getTabIndex?(): any; + getTabIndex? (): number; /** [Method] Returns the value of value */ getValue?(): number; /** [Method] Returns the value of value */ @@ -28986,7 +29078,8 @@ declare module Ext.field { /** [Method] Returns the value of accelerateOnTapHold */ getAccelerateOnTapHold?(): bool; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of component */ getComponent?(): any; /** [Method] Returns the value of cycle */ @@ -29072,7 +29165,8 @@ declare module Ext.form { /** [Method] Returns the value of accelerateOnTapHold */ getAccelerateOnTapHold?(): bool; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of component */ getComponent?(): any; /** [Method] Returns the value of cycle */ @@ -29166,7 +29260,8 @@ declare module Ext.field { /** [Method] Returns the value of autoCorrect */ getAutoCorrect?(): bool; /** [Method] Returns the value of bubbleEvents */ - getBubbleEvents?(): any[]; + getBubbleEvents? (): string; + getBubbleEvents?(): string[]; /** [Method] Returns the value of clearIcon */ getClearIcon?(): bool; /** [Method] Returns the value of component */ @@ -29266,7 +29361,8 @@ declare module Ext.form { /** [Method] Returns the value of autoCorrect */ getAutoCorrect?(): bool; /** [Method] Returns the value of bubbleEvents */ - getBubbleEvents?(): any[]; + getBubbleEvents? (): string; + getBubbleEvents? (): string[]; /** [Method] Returns the value of clearIcon */ getClearIcon?(): bool; /** [Method] Returns the value of component */ @@ -29422,7 +29518,8 @@ declare module Ext.field { /** [Property] (String) */ toggleOnLabel?: string; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of labelAlign */ getLabelAlign?(): string; /** [Method] Returns the value of maxValueCls */ @@ -29472,7 +29569,8 @@ declare module Ext.form { /** [Property] (String) */ toggleOnLabel?: string; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of labelAlign */ getLabelAlign?(): string; /** [Method] Returns the value of maxValueCls */ @@ -34516,7 +34614,8 @@ declare module Ext.picker { /** [Method] Returns the value of baseCls */ getBaseCls?(): string; /** [Method] Returns the value of bottom */ - getBottom?(): number; + getBottom? (): number; + getBottom? (): string; /** [Method] Returns the value of cancelButton */ getCancelButton?(): string; /** [Method] Returns the value of cancelButton */ @@ -34528,13 +34627,16 @@ declare module Ext.picker { /** [Method] Returns the value of doneButton */ getDoneButton?(): any; /** [Method] Returns the value of height */ - getHeight?(): number; + getHeight? (): number; + getHeight? (): string; /** [Method] Returns the value of layout */ getLayout?(): any; /** [Method] Returns the value of left */ - getLeft?(): number; + getLeft? (): number; + getLeft? (): string; /** [Method] Returns the value of right */ - getRight?(): number; + getRight? (): number; + getRight? (): string; /** [Method] Returns the value of slots */ getSlots?(): any[]; /** [Method] Returns the value of toolbar */ @@ -34655,7 +34757,8 @@ declare module Ext { /** [Method] Returns the value of baseCls */ getBaseCls?(): string; /** [Method] Returns the value of bottom */ - getBottom?(): number; + getBottom? (): number; + getBottom? (): string; /** [Method] Returns the value of cancelButton */ getCancelButton?(): string; /** [Method] Returns the value of cancelButton */ @@ -34667,13 +34770,16 @@ declare module Ext { /** [Method] Returns the value of doneButton */ getDoneButton?(): any; /** [Method] Returns the value of height */ - getHeight?(): number; + getHeight? (): number; + getHeight? (): string; /** [Method] Returns the value of layout */ getLayout?(): any; /** [Method] Returns the value of left */ - getLeft?(): number; + getLeft? (): number; + getLeft? (): string; /** [Method] Returns the value of right */ - getRight?(): number; + getRight? (): number; + getRight? (): string; /** [Method] Returns the value of slots */ getSlots?(): any[]; /** [Method] Returns the value of toolbar */ @@ -34780,9 +34886,13 @@ declare module Ext.picker { /** [Method] Returns the value of align */ getAlign?(): string; /** [Method] Returns the value of displayField */ - getDisplayField?(): string; + getDisplayField? (): string; /** [Method] Returns the value of itemTpl */ - getItemTpl?(): string; + getItemTpl? (): string; + /** [Method] Returns the value of itemTpl */ + getItemTpl? (): string[]; + /** [Method] Returns the value of itemTpl */ + getItemTpl? (): Ext.IXTemplate; /** [Method] Returns the value of name */ getName?(): string; /** [Method] Returns the value of title */ @@ -35040,7 +35150,8 @@ declare module Ext.scroll.indicator { /** [Config Option] (String/String[]) */ cls?: any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Sets the value of cls * @param cls String */ @@ -35060,7 +35171,8 @@ declare module Ext.scroll.indicator { /** [Config Option] (String/String[]) */ cls?: any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Sets the value of cls * @param cls String */ @@ -35072,7 +35184,8 @@ declare module Ext.scroll.indicator { /** [Config Option] (String/String[]) */ cls?: any; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Sets the value of cls * @param cls String */ @@ -35377,11 +35490,13 @@ declare module Ext { /** [Method] Returns the value of exit */ getExit?(): string; /** [Method] Returns the value of hideAnimation */ + getHideAnimation? (): string; getHideAnimation?(): any; /** [Method] Returns the value of modal */ getModal?(): bool; /** [Method] Returns the value of showAnimation */ - getShowAnimation?(): any; + getShowAnimation? (): any; + getShowAnimation? (): string; /** [Method] Returns the value of stretchX */ getStretchX?(): bool; /** [Method] Returns the value of stretchY */ @@ -35595,7 +35710,8 @@ declare module Ext { /** [Method] Returns the value of flex */ getFlex?(): number; /** [Method] Returns the value of width */ - getWidth?(): number; + getWidth? (): number; + getWidth? (): string; /** [Method] Sets the value of flex * @param flex Number */ @@ -35762,7 +35878,8 @@ declare module Ext.tab { */ doTabChange?( tabBar?:any, newTab?:any ): bool; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of layout */ getLayout?(): any; /** [Method] Returns the value of tabBar */ @@ -35820,7 +35937,8 @@ declare module Ext { */ doTabChange?( tabBar?:any, newTab?:any ): bool; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of layout */ getLayout?(): any; /** [Method] Returns the value of tabBar */ @@ -36161,13 +36279,15 @@ declare module Ext { /** [Method] Returns the value of baseCls */ getBaseCls?(): string; /** [Method] Returns the value of cls */ - getCls?(): string; + getCls? (): string; + getCls? (): string[]; /** [Method] Returns the value of defaultType */ getDefaultType?(): string; /** [Method] Returns the value of items */ getItems?(): any; /** [Method] Returns the value of minHeight */ - getMinHeight?(): string; + getMinHeight? (): string; + getMinHeight? (): number; /** [Method] Returns the value of title */ getTitle?(): string; /** [Method] Returns the value of ui */ @@ -36231,7 +36351,8 @@ declare module Ext { /** [Method] Returns the value of layout */ getLayout?(): any; /** [Method] Returns the value of minHeight */ - getMinHeight?(): string; + getMinHeight? (): string; + getMinHeight? (): number; /** [Method] Returns an Ext Title component */ getTitle?(): Ext.ITitle; /** [Method] Returns the value of ui */ @@ -38821,8 +38942,8 @@ declare module Ext { * @param version String/Ext.Version The version, for example: '1.2.3alpha', '2.4.0-dev'. */ setVersion?( packageName?:any, version?:any ): any; - setVersion?( packageName?:string, version?:string ): Ext; - setVersion?( packageName?:string, version?:Ext.IVersion ): Ext; + setVersion?( packageName?:string, version?:string ): any; + setVersion?( packageName?:string, version?:Ext.IVersion ): any; /** [Method] Returns this format major minor patch build release */ toArray?(): number[]; /** [Method] @@ -38853,7 +38974,8 @@ declare module Ext { /** [Method] Returns the value of url */ getUrl?(): string; /** [Method] Returns the value of url */ - getUrl?(): any[]; + getUrl? (): any[]; + getCls? (): string[]; /** [Method] Allows addition of behavior to the rendering phase */ initialize?(): void; /** [Method] Sets the value of cls diff --git a/swipeview/swipeview.d.ts b/swipeview/swipeview.d.ts index f9be1cb2db..dd77b7c610 100644 --- a/swipeview/swipeview.d.ts +++ b/swipeview/swipeview.d.ts @@ -20,7 +20,7 @@ interface PageHTMLElement extends HTMLElement { dataset: any; } -class SwipeView { +declare class SwipeView { masterPages: PageHTMLElement[]; currentMasterPage: number; diff --git a/tween.js/tween.js.d.ts b/tween.js/tween.js.d.ts index 348adf3c14..77aab07290 100644 --- a/tween.js/tween.js.d.ts +++ b/tween.js/tween.js.d.ts @@ -3,7 +3,7 @@ // Definitions by: https://github.com/sunetos // Definitions: https://github.com/borisyankov/DefinitelyTyped -module TWEEN { +declare module TWEEN { export var REVISION: string; export function getAll(): Tween[]; export function removeAll(): void; @@ -24,7 +24,7 @@ module TWEEN { onUpdate(callback:Function): Tween; onComplete(callback:Function): Tween; update(time:number): bool; - }; + } export var Easing: TweenEasing; export var Interpolation: TweenInterpolation; } diff --git a/underscore/underscore-typed-1.4.2.d.ts b/underscore/underscore-typed-1.4.2.d.ts deleted file mode 100644 index 510176117e..0000000000 --- a/underscore/underscore-typed-1.4.2.d.ts +++ /dev/null @@ -1,2008 +0,0 @@ -/* -underscore-1.4.2.d.ts may be freely distributed under the MIT license. - -Copyright (c) 2012 Josh Baldwin https://github.com/jbaldwin/underscore.d.ts - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -interface Underscore { - - /************** - * Collections * - **************/ - - /** - * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is - * bound to the context object, if one is passed. Each invocation of iterator is called with three - * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be - * (value, key, object). Delegates to the native forEach function if it exists. - * @param list Iterates over this list of elements. - * @param iterator Iterator function for each element `list`. - * @param context 'this' object in `iterator`, optional. - **/ - each( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is - * bound to the context object, if one is passed. Each invocation of iterator is called with three - * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be - * (value, key, object). Delegates to the native forEach function if it exists. - * @param obj Iterators over this object's properties. - * @param iterator Iterator function for each property on `obj`. - * @param context `this` object in the `iterator`, optional. - **/ - each( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Alias for 'each'. - * @see each - **/ - forEach( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Alias for 'each'. - * @see each - **/ - forEach( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Produces a new array of values by mapping each value in list through a transformation function - * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript - * object, iterator's arguments will be (value, key, object). - * @param list Maps the elements of this array. - * @param iterator Map iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The mapped array result. - **/ - map( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Produces a new array of values by mapping each value in list through a transformation function - * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript - * object, iterator's arguments will be (value, key, object). - * @param list Maps the properties of this object. - * @param iterator Map iterator function for each property on `obj`. - * @param context `this` object in `iterator`, optional. - * @return The mapped object result. - **/ - map( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Alias for 'map'. - * @see map - **/ - collect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Alias for 'map'. - * @see map - **/ - collect( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Also known as inject and foldl, reduce boils down a list of values into a single value. - * Memo is the initial state of the reduction, and each successive step of it should be - * returned by iterator. The iterator is passed four arguments: the memo, then the value - * and index (or key) of the iteration, and finally a reference to the entire list. - * @param list Reduces the elements of this array. - * @param iterator Reduce iterator function for each element in `list`. - * @param memo Initial reduce state. - * @param context `this` object in `iterator`, optional. - * @return Reduced object result. - **/ - reduce( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - inject( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - foldl( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * The right-associative version of reduce. Delegates to the JavaScript 1.8 version of - * reduceRight, if it exists. Foldr is not as useful in JavaScript as it would be in a - * language with lazy evaluation. - * @param list Reduces the elements of this array. - * @param iterator Reduce iterator function for each element in `list`. - * @param memo Initial reduce state. - * @param context `this` object in `iterator`, optional. - * @return Reduced object result. - **/ - reduceRight( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduceRight'. - * @see reduceRight - **/ - foldr( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Looks through each value in the list, returning the first one that passes a truth - * test (iterator). The function returns as soon as it finds an acceptable element, - * and doesn't traverse the entire list. - * @param list Searches for a value in this list. - * @param iterator Search iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The first acceptable found element in `list`, if nothing is found undefined/null is returned. - **/ - find( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - /** - * Alias for 'find'. - * @see find - **/ - detect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - - /** - * Looks through each value in the list, returning an array of all the values that pass a truth - * test (iterator). Delegates to the native filter method, if it exists. - * @param list Filter elements out of this list. - * @param iterator Filter iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The filtered list of elements. - **/ - filter( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Alias for 'filter'. - * @see filter - **/ - select( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Looks through each value in the list, returning an array of all the values that contain all - * of the key-value pairs listed in properties. - * @param list List to match elements again `properties`. - * @param properties The properties to check for on each element within `list`. - * @return The elements within `list` that contain the required `properties`. - **/ - where(list: any[], properties: any): any[]; - - /** - * Returns the values in list without the elements that the truth test (iterator) passes. - * The opposite of filter. - * Return all the elements for which a truth test fails. - * @param list Reject elements within this list. - * @param iterator Reject iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The rejected list of elements. - **/ - reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Returns true if all of the values in the list pass the iterator truth test. Delegates to the - * native method every, if present. - * @param list Truth test against all elements within this list. - * @param iterator Trust test iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return True if all elements passed the truth test, otherwise false. - **/ - all( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'all'. - * @see all - **/ - every( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Returns true if any of the values in the list pass the iterator truth test. Short-circuits and - * stops traversing the list if a true element is found. Delegates to the native method some, if present. - * @param list Truth test against all elements within this list. - * @param iterator Trust test iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return True if any elements passed the truth test, otherwise false. - **/ - any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'any'. - * @see any - **/ - some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Returns true if the value is present in the list. Uses indexOf internally, - * if list is an Array. - * @param list Checks each element to see if `value` is present. - * @param value The value to check for within `list`. - * @return True if `value` is present in `list`, otherwise false. - **/ - contains(list: any[], value: any): bool; - - /** - * Alias for 'contains'. - * @see contains - **/ - include(list: any[], value: any): bool; - - /** - * Calls the method named by methodName on each value in the list. Any extra arguments passed to - * invoke will be forwarded on to the method invocation. - * @param list The element's in this list will each have the method `methodName` invoked. - * @param methodName The method's name to call on each element within `list`. - * @param arguments Additional arguments to pass to the method `methodName`. - **/ - invoke(list: any[], methodName: string, ...arguments: any[]): void; - - /** - * A convenient version of what is perhaps the most common use-case for map: extracting a list of - * property values. - * @param list The list to pluck elements out of that have the property `propertyName`. - * @param propertyName The property to look for on each element within `list`. - * @return The list of elements within `list` that have the property `propertyName`. - **/ - pluck(list: any[], propertyName: string): any[]; - - /** - * Returns the maximum value in list. - * @param list Finds the maximum value in this list. - * @return Maximum value in `list`. - **/ - max(list: number[]): number; - /** - * Returns the maximum value in list. If iterator is passed, it will be used on each value to generate - * the criterion by which the value is ranked. - * @param list Finds the maximum value in this list. - * @param iterator Compares each element in `list` to find the maximum value. - * @param context `this` object in `iterator`, optional. - * @return The maximum element within `list`. - **/ - max( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Returns the minimum value in list. - * @param list Finds the minimum value in this list. - * @return Minimum value in `list`. - **/ - min(list: number[]): number; - /** - * Returns the minimum value in list. If iterator is passed, it will be used on each value to generate - * the criterion by which the value is ranked. - * @param list Finds the minimum value in this list. - * @param iterator Compares each element in `list` to find the minimum value. - * @param context `this` object in `iterator`, optional. - * @return The minimum element within `list`. - **/ - min( - list: any[], - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Returns a sorted copy of list, ranked in ascending order by the results of running each value - * through iterator. Iterator may also be the string name of the property to sort by (eg. length). - * @param list Sorts this list. - * @param iterator Sort iterator for each element within `list`. - * @param context `this` object in `iterator`, optional. - * @return A sorted copy of `list`. - **/ - sortBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any[]; - /** - * Returns a sorted copy of list, ranked in ascending order by the results of running each value - * through iterator. Iterator may also be the string name of the property to sort by (eg. length). - * @param list Sorts this list. - * @param iterator Sort iterator for each element within `list`. - * @param context `this` object in `iterator`, optional. - * @return A sorted copy of `list`. - **/ - sortBy( - list: any[], - iterator: string, - context?: any): any[]; - - /** - * Splits a collection into sets, grouped by the result of running each value through iterator. - * If iterator is a string instead of a function, groups by the property named by iterator on - * each of the values. - * @param list Groups this list. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the grouped elements from `list`. - **/ - groupBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: any[]; }; - /** - * Splits a collection into sets, grouped by the result of running each value through iterator. - * If iterator is a string instead of a function, groups by the property named by iterator on - * each of the values. - * @param list Groups this list. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the grouped elements from `list`. - **/ - groupBy( - list: any[], - iterator: string, - context?: any): { [key: string]: any[]; }; - - /** - * Sorts a list into groups and returns a count for the number of objects in each group. Similar - * to groupBy, but instead of returning a list of values, returns a count for the number of values - * in that group. - * @param list Group elements in this list and then count the number of elements in each group. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the number of elements in that group. - **/ - countBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: number; }; - /** - * Sorts a list into groups and returns a count for the number of objects in each group. Similar - * to groupBy, but instead of returning a list of values, returns a count for the number of values - * in that group. - * @param list Group elements in this list and then count the number of elements in each group. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the number of elements in that group. - **/ - countBy( - list: any[], - iterator: string, - context?: any): { [key: string]: number; }; - - /** - * Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle. - * @param list List to shuffle. - * @return Shuffled copy of `list`. - **/ - shuffle(list: any[]): any[]; - - /** - * Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting - * the arguments object. - * @param list object to transform into an array. - * @return `list` as an array. - **/ - toArray(list: any): any[]; - - /** - * Return the number of values in the list. - * @param list Count the number of values/elements in this list. - * @return Number of values in `list`. - **/ - size(list: any): number; - - /********* - * Arrays * - **********/ - - /** - * Returns the first element of an array. Passing n will return the first n elements of the array. - * @param array Retrieves the first element of this array. - * @return Returns the first element of `array`. - **/ - first(array: any[]): any; - /** - * Returns the first element of an array. Passing n will return the first n elements of the array. - * @param array Retreives the first `n` elements of this array. - * @param n Return more than one element from `array`. - * @return Returns the first `n` elements from `array. - **/ - first(array: any[], n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - head(array: any[]): any; - /** - * Alias for 'first'. - * @see first - **/ - head(array: any[], n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - take(array: any[]): any; - /** - * Alias for 'first'. - * @see first - **/ - take(array: any[], n: number): any[]; - - /** - * Returns everything but the last entry of the array. Especially useful on the arguments object. - * Pass n to exclude the last n elements from the result. - * @param array Retreive all elements except the last `n`. - * @param n Leaves this many elements behind, optional. - * @return Returns everything but the last `n` elements of `array`. - **/ - initial(array: any[], n?: number): any[]; - - /** - * Returns the last element of an array. Passing n will return the last n elements of the array. - * @param array Retrieves the last element of this array. - * @return Returns the last element of `array`. - **/ - last(array: any[]): any; - /** - * Returns the last element of an array. Passing n will return the last n elements of the array. - * @param array Retreives the last `n` elements of this array. - * @param n Return more than one element from `array`. - * @return Returns the last `n` elements from `array. - **/ - last(array: any[], n: number): any[]; - - /** - * Returns the rest of the elements in an array. Pass an index to return the values of the array - * from that index onward. - * @param array The array to retrieve all but the first `index` elements. - * @param index The index to start retrieving elements forward from, optional, default = 1. - * @return Returns the elements of `array` from `index` to the end of `array`. - **/ - rest(array: any[], index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - tail(array: any[], index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - drop(array: any[], index?: number): any[]; - - /** - * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "", - * undefined and NaN are all falsy. - * @param array Array to compact. - * @return Copy of `array` without false values. - **/ - compact(array: any[]): any[]; - - /** - * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will - * only be flattened a single level. - * @param array The array to flatten. - * @param shallow If true then only flatten one level, optional, default = false. - * @return `array` flattened. - **/ - flatten(array: any, shallow?: bool): any; - - /** - * Returns a copy of the array with all instances of the values removed. - * @param array The array to remove `values` from. - * @param values The values to remove from `array`. - * @return Copy of `array` without `values`. - **/ - without(array: any[], ...values: any[]): any[]; - - /** - * Computes the union of the passed-in arrays: the list of unique items, in order, that are - * present in one or more of the arrays. - * @param arrays Array of arrays to compute the union of. - * @return The union of elements within `arrays`. - **/ - union(...arrays: any[][]): any[]; - - /** - * Computes the list of values that are the intersection of all the arrays. Each value in the result - * is present in each of the arrays. - * @param arrays Array of arrays to compute the intersection of. - * @return The intersection of elements within `arrays`. - **/ - intersection(...arrays: any[][]): any[]; - - /** - * Similar to without, but returns the values from array that are not present in the other arrays. - * @param array Keeps values that are within `others`. - * @param others The values to keep within `array`. - * @return Copy of `array` with only `others` values. - **/ - difference(array: any[], ...others: any[]): any[]; - - /** - * Produces a duplicate-free version of the array, using === to test object equality. If you know in - * advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If - * you want to compute unique items based on a transformation, pass an iterator function. - * @param array Array to remove duplicates from. - * @param isSorted True if `array` is already sorted, optiona, default = false. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @return Copy of `array` where all elements are unique. - **/ - uniq( - array: any[], - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Alias for 'uniq'. - * @see uniq - **/ - unique(array: any[], - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Merges together the values of each of the arrays with the values at the corresponding position. - * Useful when you have separate data sources that are coordinated through matching array indexes. - * If you're working with a matrix of nested arrays, zip.apply can transpose the matrix in a similar fashion. - * @param arrays The arrays to merge/zip. - * @return Zipped version of `arrays`. - **/ - zip(...arrays: any[][]): any[][]; - - /** - * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a - * list of keys, and a list of values. - * @param keys Key array. - * @param values Value array. - * @return An object containing the `keys` as properties and `values` as the property values. - **/ - object(keys: string[], values: any[]): any; - /** - * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a - * list of keys, and a list of values. - * @param keyValuePairs Array of [key, value] pairs. - * @return An object containing the `keys` as properties and `values` as the property values. - **/ - object(...keyValuePairs: any[][]): any; - - /** - * Returns the index at which value can be found in the array, or -1 if value is not present in the array. - * Uses the native indexOf function unless it's missing. If you're working with a large array, and you know - * that the array is already sorted, pass true for isSorted to use a faster binary search ... or, pass a number - * as the third argument in order to look for the first matching value in the array after the given index. - * @param array The array to search for the index of `value`. - * @param value The value to search for within `array`. - * @param isSorted True if the array is already sorted, optional, default = false. - * @return The index of `value` within `array`. - **/ - indexOf(array: any[], value: any, isSorted?: bool): number; - - /** - * Returns the index of the last occurrence of value in the array, or -1 if value is not present. Uses the - * native lastIndexOf function if possible. Pass fromIndex to start your search at a given index. - * @param array The array to search for the last index of `value`. - * @param value The value to search for within `array`. - * @param from The starting index for the search, optional. - * @return The index of the last occurance of `value` within `array`. - **/ - lastIndexOf(array: any[], value: any, from?: number): number; - - /** - * Uses a binary search to determine the index at which the value should be inserted into the list in order - * to maintain the list's sorted order. If an iterator is passed, it will be used to compute the sort ranking - * of each value, including the value you pass. - * @param list The sorted list. - * @param value The value to determine its index within `list`. - * @param iterator Iterator to compute the sort ranking of each value, optional. - * @return The index where `value` should be inserted into `list`. - **/ - sortedIndex(list: any[], value: any, iterator?: (element: any) => number): number; - - /** - * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, - * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented) - * by step, exclusive. - * @param start Start here. - * @param stop Stop here. - * @param step The number to count up by each iteration, optional, default = 1. - * @return Array of numbers from `start` to `stop` with increments of `step`. - **/ - range(start: number, stop: number, step?: number): number[]; - /** - * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, - * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented) - * by step, exclusive. - * @param stop Stop here. - * @return Array of numbers from 0 to `stop` with increments of 1. - * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0) - **/ - range(stop: number): number[]; - - /************ - * Functions * - *************/ - - /** - * Bind a function to an object, meaning that whenever the function is called, the value of this will - * be the object. Optionally, bind arguments to the function to pre-fill them, also known as partial application. - * @param fn The function to bind `this` to `object`. - * @param object The `this` pointer whenever `fn` is called. - * @param arguments Additional arguments to pass to `fn` when called. - * @return `fn` with `this` bound to `object`. - **/ - bind(fn: Function, object: any, ...arguments: any[]): Function; - - - /** - * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object - * whenever they are invoked. Very handy for binding functions that are going to be used as event handlers, - * which would otherwise be invoked with a fairly useless this. If no methodNames are provided, all of the - * object's function properties will be bound to it. - * @param object The object to bind the methods `methodName` to. - * @param methodNames The methods to bind to `object`, optional and if not provided all of `object`'s - * methods are bound. - **/ - bindAll(object: any, ...methodNames: string[]): void; - - /** - * Memoizes a given function by caching the computed result. Useful for speeding up slow-running computations. - * If passed an optional hashFunction, it will be used to compute the hash key for storing the result, based - * on the arguments to the original function. The default hashFunction just uses the first argument to the - * memoized function as the key. - * @param fn Computationally expensive function that will now memoized results. - * @param hashFn Hash function for storing the result of `fn`. - * @return Memoized version of `fn`. - **/ - memoize(fn: Function, hashFn?: (n: any) => string): Function; - - /** - * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, - * they will be forwarded on to the function when it is invoked. - * @param fn Function to delay `waitMS` amount of ms. - * @param waitMS The amount of milliseconds to delay `fn`. - * @arguments Additional arguments to pass to `fn`. - **/ - delay(fn: Function, waitMS: number, ...arguments: any[]): void; - - /** - * Defers invoking the function until the current call stack has cleared, similar to using setTimeout - * with a delay of 0. Useful for performing expensive computations or HTML rendering in chunks without - * blocking the UI thread from updating. If you pass the optional arguments, they will be forwarded on - * to the function when it is invoked. - * @param fn The function to defer. - * @param arguments Additional arguments to pass to `fn`. - **/ - defer(fn: Function, ...arguments: any[]): void; - - /** - * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, - * will only actually call the original function at most once per every wait milliseconds. Useful for - * rate-limiting events that occur faster than you can keep up with. - * @param fn Function to throttle `waitMS` ms. - * @param waitMS The number of milliseconds to wait before `fn` can be invoked again. - * @return `fn` with a throttle of `waitMS`. - **/ - throttle(fn: Function, waitMS: number): Function; - - /** - * Creates and returns a new debounced version of the passed function that will postpone its execution - * until after wait milliseconds have elapsed since the last time it was invoked. Useful for implementing - * behavior that should only happen after the input has stopped arriving. For example: rendering a preview - * of a Markdown comment, recalculating a layout after the window has stopped being resized, and so on. - * - * Pass true for the immediate parameter to cause debounce to trigger the function on the leading instead - * of the trailing edge of the wait interval. Useful in circumstances like preventing accidental double - *-clicks on a "submit" button from firing a second time. - * @param fn Function to debounce `waitMS` ms. - * @param waitMS The number of milliseconds to wait before `fn` can be invoked again. - * @param immediate True if `fn` should be invoked on the leading edge of `waitMS` instead of the trailing edge. - * @return Debounced version of `fn` that waits `waitMS` ms when invoked. - **/ - debounce(fn: Function, waitMS: number, immediate?: bool): Function; - - /** - * Creates a version of the function that can only be called one time. Repeated calls to the modified - * function will have no effect, returning the value from the original call. Useful for initialization - * functions, instead of having to set a boolean flag and then check it later. - * @param fn Function to only execute once. - * @return Copy of `fn` that can only be invoked once. - **/ - once(fn: Function): Function; - - /** - * Creates a version of the function that will only be run after first being called count times. Useful - * for grouping asynchronous responses, where you want to be sure that all the async calls have finished, - * before proceeding. - * @param count Number of times to be called before actually executing. - * @fn The function to defer execution `count` times. - * @return Copy of `fn` that will not execute until it is invoked `count` times. - **/ - after(count: number, fn: Function): Function; - - /** - * Wraps the first function inside of the wrapper function, passing it as the first argument. This allows - * the wrapper to execute code before and after the function runs, adjust the arguments, and execute it - * conditionally. - * @param fn Function to wrap. - * @param wrapper The function that will wrap `fn`. - * @return Wrapped version of `fn. - **/ - wrap(fn: Function, wrapper: (fn: Function, ...args: any[]) => any): Function; - - /** - * Returns the composition of a list of functions, where each function consumes the return value of the - * function that follows. In math terms, composing the functions f(), g(), and h() produces f(g(h())). - * @param functions List of functions to compose. - * @return Composition of `functions`. - **/ - compose(...functions: Function[]): Function; - - /********** - * Objects * - ***********/ - - /** - * Retrieve all the names of the object's properties. - * @param object Retreive the key or property names from this object. - * @return List of all the property names on `object`. - **/ - keys(object: any): string[]; - - /** - * Return all of the values of the object's properties. - * @param object Retreive the values of all the properties on this object. - * @return List of all the values on `object`. - **/ - values(object: any): any[]; - - /** - * Convert an object into a list of [key, value] pairs. - * @param object Convert this object to a list of [key, value] pairs. - * @return List of [key, value] pairs on `object`. - **/ - pairs(object: any): any[][]; - - /** - * Returns a copy of the object where the keys have become the values and the values the keys. - * For this to work, all of your object's values should be unique and string serializable. - * @param object Object to invert key/value pairs. - * @return An inverted key/value paired version of `object`. - **/ - invert(object: any): any; - - /** - * Returns a sorted list of the names of every method in an object — that is to say, - * the name of every function property of the object. - * @param object Object to pluck all function property names from. - * @return List of all the function names on `object`. - **/ - functions(object: any): string[]; - - /** - * Copy all of the properties in the source objects over to the destination object, and return - * the destination object. It's in-order, so the last source will override properties of the - * same name in previous arguments. - * @param destination Object to extend all the properties from `sources`. - * @param sources Extends `destination` with all properties from these source objects. - * @return `destination` extended with all the properties from the `sources` objects. - **/ - extend(destination: any, ...sources: any[]): any; - - /** - * Return a copy of the object, filtered to only have values for the whitelisted keys - * (or array of valid keys). - * @param object Object to strip unwanted key/value pairs. - * @keys The key/value pairs to keep on `object`. - * @return Copy of `object` with only the `keys` properties. - **/ - pick(object: any, ...keys: string[]): any; - - /** - * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). - * @param object Object to strip unwanted key/value pairs. - * @param keys The key/value pairs to remove on `object`. - * @return Copy of `object` without the `keys` properties. - **/ - omit(object: any, ...keys: string[]): any; - - /** - * Fill in null and undefined properties in object with values from the defaults objects, - * and return the object. As soon as the property is filled, further defaults will have no effect. - * @param object Fill this object with default values. - * @param defaults The default values to add to `object`. - * @return `object` with added `defaults` values. - **/ - defaults(object: any, ...defaults: any[]): any; - - /** - * Create a shallow-copied clone of the object. - * Any nested objects or arrays will be copied by reference, not duplicated. - * @param object Object to clone. - * @return Copy of `object`. - **/ - clone(object: any): any; - /** - * Create a shallow-copied clone of the object. - * Any nested objects or arrays will be copied by reference, not duplicated. - * @param list List to clone. - * @return Copy of `list`. - **/ - clone(list: any[]): any[]; - - /** - * Invokes interceptor with the object, and then returns object. The primary purpose of this method - * is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. - * @param object Argument to `interceptor`. - * @param intercepter The function to modify `object` before continuing the method chain. - * @return Modified `object`. - **/ - tap(object: any, intercepter: Function): any; - - /** - * Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe - * reference to the hasOwnProperty function, in case it's been overridden accidentally. - * @param object Object to check for `key`. - * @param key The key to check for on `object`. - * @return True if `key` is a property on `object`, otherwise false. - **/ - has(object: any, key: string): bool; - - /** - * Performs an optimized deep comparison between the two objects, - * to determine if they should be considered equal. - * @param object Compare to `other`. - * @param other Compare to `object`. - * @return True if `object` is equal to `other`. - **/ - isEqual(object: any, other: any): bool; - - /** - * Returns true if object contains no values. - * @param object Check if this object has no properties or values. - * @return True if `object` is empty. - **/ - isEmpty(object: any): bool; - /** - * Returns true if the list contains no values. - * @param object Check if this list has no elements. - * @return True if `list` is empty. - **/ - isEmpty(list: any[]): bool; - - /** - * Returns true if object is a DOM element. - * @param object Check if this object is a DOM element. - * @return True if `object` is a DOM element, otherwise false. - **/ - isElement(object: any): bool; - - /** - * Returns true if object is an Array. - * @param object Check if this object is an Array. - * @return True if `object` is an Array, otherwise false. - **/ - isArray(object: any): bool; - - /** - * Returns true if value is an Object. Note that JavaScript arrays and functions are objects, - * while (normal) strings and numbers are not. - * @param object Check if this object is an Object. - * @return True of `object` is an Object, otherwise false. - **/ - isObject(object: any): bool; - - /** - * Returns true if object is an Arguments object. - * @param object Check if this object is an Arguments object. - * @return True if `object` is an Arguments object, otherwise false. - **/ - isArguments(object: any): bool; - - /** - * Returns true if object is a Function. - * @param object Check if this object is a Function. - * @return True if `object` is a Function, otherwise false. - **/ - isFunction(object: any): bool; - - /** - * Returns true if object is a String. - * @param object Check if this object is a String. - * @return True if `object` is a String, otherwise false. - **/ - isString(object: any): bool; - - /** - * Returns true if object is a Number (including NaN). - * @param object Check if this object is a Number. - * @return True if `object` is a Number, otherwise false. - **/ - isNumber(object: any): bool; - - /** - * Returns true if object is a finite Number. - * @param object Check if this object is a finite Number. - * @return True if `object` is a finite Number. - **/ - isFinite(object: any): bool; - - /** - * Returns true if object is either true or false. - * @param object Check if this object is a bool. - * @return True if `object` is a bool, otherwise false. - **/ - isBoolean(object: any): bool; - - /** - * Returns true if object is a Date. - * @param object Check if this object is a Date. - * @return True if `object` is a Date, otherwise false. - **/ - isDate(object: any): bool; - - /** - * Returns true if object is a RegExp. - * @param object Check if this object is a RegExp. - * @return True if `object` is a RegExp, otherwise false. - **/ - isRegExp(object: any): bool; - - /** - * Returns true if object is NaN. - * Note: this is not the same as the native isNaN function, - * which will also return true if the variable is undefined. - * @param object Check if this object is NaN. - * @return True if `object` is NaN, otherwise false. - **/ - isNaN(object: any): bool; - - /** - * Returns true if the value of object is null. - * @param object Check if this object is null. - * @return True if `object` is null, otherwise false. - **/ - isNull(object: any): bool; - - /** - * Returns true if value is undefined. - * @param object Check if this object is undefined. - * @return True if `object` is undefined, otherwise false. - **/ - isUndefined(object: any): bool; - - /********** - * Utility * - ***********/ - - /** - * Give control of the "_" variable back to its previous owner. - * Returns a reference to the Underscore object. - * @return Underscore object reference. - **/ - noConflict(): Underscore; - - /** - * Returns the same value that is used as the argument. In math: f(x) = x - * This function looks useless, but is used throughout Underscore as a default iterator. - * @param value Identity of this object. - * @return `value`. - **/ - identity(value: any): any; - - /** - * Invokes the given iterator function n times. - * Each invocation of iterator is called with an index argument - * @param n Number of times to invoke `iterator`. - * @param iterator Function iterator to invoke `n` times. - * @param context `this` object in `iterator`, optional. - **/ - times(n: number, iterator: (n: number) => void , context?: any): void; - - /** - * Returns a random integer between min and max, inclusive. If you only pass one argument, - * it will return a number between 0 and that number. - * @param max The maximum random number. - * @return A random number between 0 and `max`. - **/ - random(max: number): number; - /** - * Returns a random integer between min and max, inclusive. If you only pass one argument, - * it will return a number between 0 and that number. - * @param min The minimum random number. - * @param max The maximum random number. - * @return A random number between `min` and `max`. - **/ - random(min: number, max: number): number; - - /** - * Allows you to extend Underscore with your own utility functions. Pass a hash of - * {name: function} definitions to have your functions added to the Underscore object, - * as well as the OOP wrapper. - * @param object Mixin object containing key/function pairs to add to the Underscore object. - **/ - mixin(object: any): void; - - /** - * Generate a globally-unique id for client-side models or DOM elements that need one. - * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. - * @return Unique number ID. - **/ - uniqueId(): number; - /** - * Generate a globally-unique id for client-side models or DOM elements that need one. - * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. - * @param prefix A prefix string to start the unique ID with. - * @return Unique string ID beginning with `prefix`. - **/ - uniqueId(prefix: string): string; - - /** - * Escapes a string for insertion into HTML, replacing &, <, >, ", ', and / characters. - * @param str Raw string to escape. - * @return `str` HTML escaped. - **/ - escape(str: string): string; - - /** - * If the value of the named property is a function then invoke it; otherwise, return it. - * @param object Object to maybe invoke function `property` on. - * @param property The function by name to invoke on `object`. - * @return The result of invoking the function `property` on `object. - **/ - result(object: any, property: string): any; - - /** - * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful - * for rendering complicated bits of HTML from JSON data sources. Template functions can both - * interpolate variables, using <%= … %>, as well as execute arbitrary JavaScript code, with - * <% … %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- … %> When - * you evaluate a template function, pass in a data object that has properties corresponding to - * the template's free variables. If you're writing a one-off, you can pass the data object as - * the second parameter to template in order to render immediately instead of returning a template - * function. The settings argument should be a hash containing any _.templateSettings that should - * be overridden. - * @param templateString Underscore HTML template. - * @param data Data to use when compiling `templateString`. - * @param settings Settings to use while compiling. - * @return Returns the compiled Underscore HTML template. - **/ - template(templateString: string, data?: any, settings?: UnderscoreTemplateSettings): any; - - /** - * By default, Underscore uses ERB-style template delimiters, change the - * following template settings to use alternative delimiters. - **/ - templateSettings: UnderscoreTemplateSettings; - - /*********** - * Chaining * - ************/ - - /** - * Returns a wrapped object. Calling methods on this object will continue to return wrapped objects - * until value() is used. - * @param obj Object to chain. - * @return Wrapped `obj`. - **/ - chain(obj: any): any; - - /** - * Extracts the value of a wrapped object. - * @param obj Wrapped object to extract the value from. - * @return Value of `obj`. - **/ - value(obj: any): any; - - /************** - * OOP Wrapper * - **************/ - - /** - * Underscore OOP Wrapper, all Underscore functions that take an object - * as the first parameter can be invoked through this function. - * @param key First argument to Underscore object functions. - **/ - (obj: any): UnderscoreOOPWrapper; -} - -/** -* underscore.js template settings, set templateSettings or pass as an argument -* to 'template()' to overide defaults. -**/ -interface UnderscoreTemplateSettings { - /** - * Default value is '/<%([\s\S]+?)%>/g'. - **/ - evaluate?: RegExp; - - /** - * Default value is '/<%=([\s\S]+?)%>/g'. - **/ - interpolate?: RegExp; - - /** - * Default value is '/<%-([\s\S]+?)%>/g'. - **/ - escape?: RegExp; -} - -interface UnderscoreOOPWrapper { - - /************** - * Collections * - **************/ - - /** - * Wrapped type `any[]`. - * @see _.each - **/ - each( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Wrapped type `object`. - * @see _.each - **/ - each( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Alias for 'each'. - * @see each - **/ - forEach( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Alias for 'each'. - * @see each - **/ - forEach( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Wrapped type `any[]`. - * @see _.map - **/ - map( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Wrapped type `object`. - * @see _.map - **/ - map( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Alias for 'map'. - * @see map - **/ - collect( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Alias for 'map'. - * @see map - **/ - collect( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.reduce - **/ - reduce( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - inject( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - foldl( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.reduceRight - **/ - reduceRight( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduceRight'. - * @see reduceRight - **/ - foldr( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.find - **/ - find( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - /** - * Alias for 'find'. - * @see find - **/ - detect( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - - /** - * Wrapped type `any[]`. - * @see _.filter - **/ - filter( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Alias for 'filter'. - * @see filter - **/ - select( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.where - **/ - where(list: any[], properties: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.reject - **/ - reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.all - **/ - all( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'all'. - * @see all - **/ - every( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.any - **/ - any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'any'. - * @see any - **/ - some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.contains - **/ - contains(value: any): bool; - - /** - * Alias for 'contains'. - * @see contains - **/ - include(value: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.invoke - **/ - invoke(methodName: string, ...arguments: any[]): void; - - /** - * Wrapped type `any[]`. - * @see _.pluck - **/ - pluck(propertyName: string): any[]; - - /** - * Wrapped type `number[]`. - * @see _.max - **/ - max(): number; - /** - * Wrapped type `any[]`. - * @see _.max - **/ - max( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Wrapped type `number[]`. - * @see _.min - **/ - min(): number; - /** - * Wrapped type `any[]`. - * @see _.min - **/ - min( - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.sortBy - **/ - sortBy( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any[]; - /** - * Wrapped type `any[]`. - * @see _.sortBy - **/ - sortBy( - iterator: string, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ - groupBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: any[]; }; - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ - groupBy( - iterator: string, - context?: any): { [key: string]: any[]; }; - - /** - * Wrapped type `any[]`. - * @see _.countBy - **/ - countBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: number; }; - /** - * Wrapped type `any[]`. - * @see _.countBy - **/ - countBy( - iterator: string, - context?: any): { [key: string]: number; }; - - /** - * Wrapped type `any[]`. - * @see _.shuffle - **/ - shuffle(): any[]; - - /** - * Wrapped type `any`. - * @see _.toArray - **/ - toArray(): any[]; - - /** - * Wrapped type `any`. - * @see _.size - **/ - size(): number; - - /********* - * Arrays * - **********/ - - /** - * Wrapped type `any[]`. - * @see _.first - **/ - first(): any; - /** - * Wrapped type `any[]`. - * @see _.first - **/ - first(n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - head(): any; - /** - * Alias for 'first'. - * @see first - **/ - head(n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - take(): any; - /** - * Alias for 'first'. - * @see first - **/ - take(n: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.initial - **/ - initial(n?: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.last - **/ - last(): any; - /** - * Wrapped type `any[]`. - * @see _.last - **/ - last(n: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.rest - **/ - rest(index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - tail(index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - drop(index?: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.compact - **/ - compact(): any[]; - - /** - * Wrapped type `any`. - * @see _.flatten - **/ - flatten(shallow?: bool): any; - - /** - * Wrapped type `any[]`. - * @see _.without - **/ - without(...values: any[]): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.union - **/ - union(...arrays: any[][]): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.intersection - **/ - intersection(...arrays: any[][]): any[]; - - /** - * Wrapped type `any[]`. - * @see _.difference - **/ - difference(...others: any[]): any[]; - - /** - * Wrapped type `any[]`. - * @see _.uniq - **/ - uniq( - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Alias for 'uniq'. - * @see uniq - **/ - unique( - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.zip - **/ - zip(...arrays: any[][]): any[][]; - - /** - * Wrapped type `any[][]`. - * @see _.object - **/ - object(...keyValuePairs: any[][]): any; - - /** - * Wrapped type `any[]`. - * @see _.indexOf - **/ - indexOf(value: any, isSorted?: bool): number; - - /** - * Wrapped type `any[]`. - * @see _.lastIndexOf - **/ - lastIndexOf(value: any, from?: number): number; - - /** - * Wrapped type `any[]`. - * @see _.sortedIndex - **/ - sortedIndex(value: any, iterator?: (element: any) => number): number; - - /** - * Wrapped type `number`. - * @see _.range - **/ - range(stop: number, step?: number): number[]; - /** - * Wrapped type `number`. - * @see _.range - **/ - range(): number[]; - - /************ - * Functions * - *************/ - - /** - * Wrapped type `Function`. - * @see _.bind - **/ - bind(object: any, ...arguments: any[]): Function; - - - /** - * Wrapped type `object`. - * @see _.bindAll - **/ - bindAll(...methodNames: string[]): void; - - /** - * Wrapped type `Function`. - * @see _.memoize - **/ - memoize(hashFn?: (n: any) => string): Function; - - /** - * Wrapped type `Function`. - * @see _.delay - **/ - delay(waitMS: number, ...arguments: any[]): void; - - /** - * Wrapped type `Function`. - * @see _.defer - **/ - defer(...arguments: any[]): void; - - /** - * Wrapped type `Function`. - * @see _.throttle - **/ - throttle(waitMS: number): Function; - - /** - * Wrapped type `Function`. - * @see _.debounce - **/ - debounce(waitMS: number, immediate?: bool): Function; - - /** - * Wrapped type `Function`. - * @see _.once - **/ - once(): Function; - - /** - * Wrapped type `number`. - * @see _.after - **/ - after(fn: Function): Function; - - /** - * Wrapped type `Function`. - * @see _.wrap - **/ - wrap(wrapper: (fn: Function, ...args: any[]) => any): Function; - - /** - * Wrapped type `Function[]`. - * @see _.compose - **/ - compose(...functions: Function[]): Function; - - /********** - * Objects * - ***********/ - - /** - * Wrapped type `object`. - * @see _.keys - **/ - keys(): string[]; - - /** - * Wrapped type `object`. - * @see _.values - **/ - values(): any[]; - - /** - * Wrapped type `object`. - * @see _.pairs - **/ - pairs(): any[][]; - - /** - * Wrapped type `object`. - * @see _.invert - **/ - invert(): any; - - /** - * Wrapped type `object`. - * @see _.functions - **/ - functions(): string[]; - - /** - * Wrapped type `object`. - * @see _.extend - **/ - extend(...sources: any[]): any; - - /** - * Wrapped type `object`. - * @see _.pick - **/ - pick(...keys: string[]): any; - - /** - * Wrapped type `object`. - * @see _.omit - **/ - omit(...keys: string[]): any; - - /** - * Wrapped type `object`. - * @see _.defaults - **/ - defaults(...defaults: any[]): any; - - /** - * Wrapped type `object`. - * @see _.clone - **/ - clone(object: any): any; - /** - * Wrapped type `any[]`. - * @see _.clone - **/ - clone(list: any[]): any[]; - - /** - * Wrapped type `object`. - * @see _.tap - **/ - tap(intercepter: Function): any; - - /** - * Wrapped type `object`. - * @see _.has - **/ - has(key: string): bool; - - /** - * Wrapped type `object`. - * @see _.isEqual - **/ - isEqual(other: any): bool; - - /** - * Wrapped type `object`. - * @see _.isEmpty - **/ - isEmpty(object: any): bool; - /** - * Wrapped type `any[]`. - * @see _.isEmpty - **/ - isEmpty(list: any[]): bool; - - /** - * Wrapped type `object`. - * @see _.isElement - **/ - isElement(): bool; - - /** - * Wrapped type `object`. - * @see _.isArray - **/ - isArray(): bool; - - /** - * Wrapped type `object`. - * @see _.isObject - **/ - isObject(): bool; - - /** - * Wrapped type `object`. - * @see _.isArguments - **/ - isArguments(): bool; - - /** - * Wrapped type `object`. - * @see _.isFunction - **/ - isFunction(): bool; - - /** - * Wrapped type `object`. - * @see _.isString - **/ - isString(): bool; - - /** - * Wrapped type `object`. - * @see _.isNumber - **/ - isNumber(): bool; - - /** - * Wrapped type `object`. - * @see _.isFinite - **/ - isFinite(): bool; - - /** - * Wrapped type `object`. - * @see _.isBoolean - **/ - isBoolean(): bool; - - /** - * Wrapped type `object`. - * @see _.isDate - **/ - isDate(): bool; - - /** - * Wrapped type `object`. - * @see _.isRegExp - **/ - isRegExp(): bool; - - /** - * Wrapped type `object`. - * @see _.isNaN - **/ - isNaN(): bool; - - /** - * Wrapped type `object`. - * @see _.isNull - **/ - isNull(): bool; - - /** - * Wrapped type `object`. - * @see _.isUndefined - **/ - isUndefined(): bool; - - /********** - * Utility * - ***********/ - - /** - * Wrapped type `any`. - * @see _.identity - **/ - identity(): any; - - /** - * Wrapped type `number`. - * @see _.times - **/ - times(iterator: (n: number) => void , context?: any): void; - - /** - * Wrapped type `number`. - * @see _.random - **/ - random(): number; - /** - * Wrapped type `number`. - * @see _.random - **/ - random(max: number): number; - - /** - * Wrapped type `object`. - * @see _.mixin - **/ - mixin(): void; - - /** - * Wrapped type `string`. - * @see _.uniqueId - **/ - uniqueId(): string; - - /** - * Wrapped type `string`. - * @see _.escape - **/ - escape(): string; - - /** - * Wrapped type `object`. - * @see _.result - **/ - result(property: string): any; - - /** - * Wrapped type `string`. - * @see _.template - **/ - template(data?: any, settings?: UnderscoreTemplateSettings): any; - - /*********** - * Chaining * - ************/ - - /** - * Wrapped type `any`. - * @see _.chain - **/ - chain(): any; - - /** - * Wrapped type `any`. - * @see _.value - **/ - value(): any; -} - -declare var _: Underscore; diff --git a/underscore/underscore-typed-1.4.3.d.ts b/underscore/underscore-typed-1.4.3.d.ts deleted file mode 100644 index 56fe7583ab..0000000000 --- a/underscore/underscore-typed-1.4.3.d.ts +++ /dev/null @@ -1,2031 +0,0 @@ -/* -underscore-1.4.3.d.ts may be freely distributed under the MIT license. - -Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/underscore.d.ts - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ - -interface Underscore { - - /************** - * Collections * - **************/ - - /** - * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is - * bound to the context object, if one is passed. Each invocation of iterator is called with three - * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be - * (value, key, object). Delegates to the native forEach function if it exists. - * @param list Iterates over this list of elements. - * @param iterator Iterator function for each element `list`. - * @param context 'this' object in `iterator`, optional. - **/ - each( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is - * bound to the context object, if one is passed. Each invocation of iterator is called with three - * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be - * (value, key, object). Delegates to the native forEach function if it exists. - * @param obj Iterators over this object's properties. - * @param iterator Iterator function for each property on `obj`. - * @param context `this` object in the `iterator`, optional. - **/ - each( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Alias for 'each'. - * @see each - **/ - forEach( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Alias for 'each'. - * @see each - **/ - forEach( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Produces a new array of values by mapping each value in list through a transformation function - * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript - * object, iterator's arguments will be (value, key, object). - * @param list Maps the elements of this array. - * @param iterator Map iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The mapped array result. - **/ - map( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Produces a new array of values by mapping each value in list through a transformation function - * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript - * object, iterator's arguments will be (value, key, object). - * @param list Maps the properties of this object. - * @param iterator Map iterator function for each property on `obj`. - * @param context `this` object in `iterator`, optional. - * @return The mapped object result. - **/ - map( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Alias for 'map'. - * @see map - **/ - collect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Alias for 'map'. - * @see map - **/ - collect( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Also known as inject and foldl, reduce boils down a list of values into a single value. - * Memo is the initial state of the reduction, and each successive step of it should be - * returned by iterator. The iterator is passed four arguments: the memo, then the value - * and index (or key) of the iteration, and finally a reference to the entire list. - * @param list Reduces the elements of this array. - * @param iterator Reduce iterator function for each element in `list`. - * @param memo Initial reduce state. - * @param context `this` object in `iterator`, optional. - * @return Reduced object result. - **/ - reduce( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - inject( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - foldl( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * The right-associative version of reduce. Delegates to the JavaScript 1.8 version of - * reduceRight, if it exists. Foldr is not as useful in JavaScript as it would be in a - * language with lazy evaluation. - * @param list Reduces the elements of this array. - * @param iterator Reduce iterator function for each element in `list`. - * @param memo Initial reduce state. - * @param context `this` object in `iterator`, optional. - * @return Reduced object result. - **/ - reduceRight( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduceRight'. - * @see reduceRight - **/ - foldr( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Looks through each value in the list, returning the first one that passes a truth - * test (iterator). The function returns as soon as it finds an acceptable element, - * and doesn't traverse the entire list. - * @param list Searches for a value in this list. - * @param iterator Search iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The first acceptable found element in `list`, if nothing is found undefined/null is returned. - **/ - find( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - /** - * Alias for 'find'. - * @see find - **/ - detect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - - /** - * Looks through each value in the list, returning an array of all the values that pass a truth - * test (iterator). Delegates to the native filter method, if it exists. - * @param list Filter elements out of this list. - * @param iterator Filter iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The filtered list of elements. - **/ - filter( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Alias for 'filter'. - * @see filter - **/ - select( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Looks through each value in the list, returning an array of all the values that contain all - * of the key-value pairs listed in properties. - * @param list List to match elements again `properties`. - * @param properties The properties to check for on each element within `list`. - * @return The elements within `list` that contain the required `properties`. - **/ - where(list: any[], properties: any): any[]; - - /** - * Returns the values in list without the elements that the truth test (iterator) passes. - * The opposite of filter. - * Return all the elements for which a truth test fails. - * @param list Reject elements within this list. - * @param iterator Reject iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return The rejected list of elements. - **/ - reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Returns true if all of the values in the list pass the iterator truth test. Delegates to the - * native method every, if present. - * @param list Truth test against all elements within this list. - * @param iterator Trust test iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return True if all elements passed the truth test, otherwise false. - **/ - all( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'all'. - * @see all - **/ - every( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Returns true if any of the values in the list pass the iterator truth test. Short-circuits and - * stops traversing the list if a true element is found. Delegates to the native method some, if present. - * @param list Truth test against all elements within this list. - * @param iterator Trust test iterator function for each element in `list`. - * @param context `this` object in `iterator`, optional. - * @return True if any elements passed the truth test, otherwise false. - **/ - any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'any'. - * @see any - **/ - some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Returns true if the value is present in the list. Uses indexOf internally, - * if list is an Array. - * @param list Checks each element to see if `value` is present. - * @param value The value to check for within `list`. - * @return True if `value` is present in `list`, otherwise false. - **/ - contains(list: any[], value: any): bool; - - /** - * Alias for 'contains'. - * @see contains - **/ - include(list: any[], value: any): bool; - - /** - * Calls the method named by methodName on each value in the list. Any extra arguments passed to - * invoke will be forwarded on to the method invocation. - * @param list The element's in this list will each have the method `methodName` invoked. - * @param methodName The method's name to call on each element within `list`. - * @param arguments Additional arguments to pass to the method `methodName`. - **/ - invoke(list: any[], methodName: string, ...arguments: any[]): void; - - /** - * A convenient version of what is perhaps the most common use-case for map: extracting a list of - * property values. - * @param list The list to pluck elements out of that have the property `propertyName`. - * @param propertyName The property to look for on each element within `list`. - * @return The list of elements within `list` that have the property `propertyName`. - **/ - pluck(list: any[], propertyName: string): any[]; - - /** - * Returns the maximum value in list. - * @param list Finds the maximum value in this list. - * @return Maximum value in `list`. - **/ - max(list: number[]): number; - /** - * Returns the maximum value in list. If iterator is passed, it will be used on each value to generate - * the criterion by which the value is ranked. - * @param list Finds the maximum value in this list. - * @param iterator Compares each element in `list` to find the maximum value. - * @param context `this` object in `iterator`, optional. - * @return The maximum element within `list`. - **/ - max( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Returns the minimum value in list. - * @param list Finds the minimum value in this list. - * @return Minimum value in `list`. - **/ - min(list: number[]): number; - /** - * Returns the minimum value in list. If iterator is passed, it will be used on each value to generate - * the criterion by which the value is ranked. - * @param list Finds the minimum value in this list. - * @param iterator Compares each element in `list` to find the minimum value. - * @param context `this` object in `iterator`, optional. - * @return The minimum element within `list`. - **/ - min( - list: any[], - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Returns a sorted copy of list, ranked in ascending order by the results of running each value - * through iterator. Iterator may also be the string name of the property to sort by (eg. length). - * @param list Sorts this list. - * @param iterator Sort iterator for each element within `list`. - * @param context `this` object in `iterator`, optional. - * @return A sorted copy of `list`. - **/ - sortBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any[]; - /** - * Returns a sorted copy of list, ranked in ascending order by the results of running each value - * through iterator. Iterator may also be the string name of the property to sort by (eg. length). - * @param list Sorts this list. - * @param iterator Sort iterator for each element within `list`. - * @param context `this` object in `iterator`, optional. - * @return A sorted copy of `list`. - **/ - sortBy( - list: any[], - iterator: string, - context?: any): any[]; - - /** - * Splits a collection into sets, grouped by the result of running each value through iterator. - * If iterator is a string instead of a function, groups by the property named by iterator on - * each of the values. - * @param list Groups this list. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the grouped elements from `list`. - **/ - groupBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: any[]; }; - /** - * Splits a collection into sets, grouped by the result of running each value through iterator. - * If iterator is a string instead of a function, groups by the property named by iterator on - * each of the values. - * @param list Groups this list. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the grouped elements from `list`. - **/ - groupBy( - list: any[], - iterator: string, - context?: any): { [key: string]: any[]; }; - - /** - * Sorts a list into groups and returns a count for the number of objects in each group. Similar - * to groupBy, but instead of returning a list of values, returns a count for the number of values - * in that group. - * @param list Group elements in this list and then count the number of elements in each group. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the number of elements in that group. - **/ - countBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: number; }; - /** - * Sorts a list into groups and returns a count for the number of objects in each group. Similar - * to groupBy, but instead of returning a list of values, returns a count for the number of values - * in that group. - * @param list Group elements in this list and then count the number of elements in each group. - * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the number of elements in that group. - **/ - countBy( - list: any[], - iterator: string, - context?: any): { [key: string]: number; }; - - /** - * Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle. - * @param list List to shuffle. - * @return Shuffled copy of `list`. - **/ - shuffle(list: any[]): any[]; - - /** - * Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting - * the arguments object. - * @param list object to transform into an array. - * @return `list` as an array. - **/ - toArray(list: any): any[]; - - /** - * Return the number of values in the list. - * @param list Count the number of values/elements in this list. - * @return Number of values in `list`. - **/ - size(list: any): number; - - /********* - * Arrays * - **********/ - - /** - * Returns the first element of an array. Passing n will return the first n elements of the array. - * @param array Retrieves the first element of this array. - * @return Returns the first element of `array`. - **/ - first(array: any[]): any; - /** - * Returns the first element of an array. Passing n will return the first n elements of the array. - * @param array Retreives the first `n` elements of this array. - * @param n Return more than one element from `array`. - * @return Returns the first `n` elements from `array. - **/ - first(array: any[], n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - head(array: any[]): any; - /** - * Alias for 'first'. - * @see first - **/ - head(array: any[], n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - take(array: any[]): any; - /** - * Alias for 'first'. - * @see first - **/ - take(array: any[], n: number): any[]; - - /** - * Returns everything but the last entry of the array. Especially useful on the arguments object. - * Pass n to exclude the last n elements from the result. - * @param array Retreive all elements except the last `n`. - * @param n Leaves this many elements behind, optional. - * @return Returns everything but the last `n` elements of `array`. - **/ - initial(array: any[], n?: number): any[]; - - /** - * Returns the last element of an array. Passing n will return the last n elements of the array. - * @param array Retrieves the last element of this array. - * @return Returns the last element of `array`. - **/ - last(array: any[]): any; - /** - * Returns the last element of an array. Passing n will return the last n elements of the array. - * @param array Retreives the last `n` elements of this array. - * @param n Return more than one element from `array`. - * @return Returns the last `n` elements from `array. - **/ - last(array: any[], n: number): any[]; - - /** - * Returns the rest of the elements in an array. Pass an index to return the values of the array - * from that index onward. - * @param array The array to retrieve all but the first `index` elements. - * @param index The index to start retrieving elements forward from, optional, default = 1. - * @return Returns the elements of `array` from `index` to the end of `array`. - **/ - rest(array: any[], index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - tail(array: any[], index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - drop(array: any[], index?: number): any[]; - - /** - * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "", - * undefined and NaN are all falsy. - * @param array Array to compact. - * @return Copy of `array` without false values. - **/ - compact(array: any[]): any[]; - - /** - * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will - * only be flattened a single level. - * @param array The array to flatten. - * @param shallow If true then only flatten one level, optional, default = false. - * @return `array` flattened. - **/ - flatten(array: any, shallow?: bool): any; - - /** - * Returns a copy of the array with all instances of the values removed. - * @param array The array to remove `values` from. - * @param values The values to remove from `array`. - * @return Copy of `array` without `values`. - **/ - without(array: any[], ...values: any[]): any[]; - - /** - * Computes the union of the passed-in arrays: the list of unique items, in order, that are - * present in one or more of the arrays. - * @param arrays Array of arrays to compute the union of. - * @return The union of elements within `arrays`. - **/ - union(...arrays: any[][]): any[]; - - /** - * Computes the list of values that are the intersection of all the arrays. Each value in the result - * is present in each of the arrays. - * @param arrays Array of arrays to compute the intersection of. - * @return The intersection of elements within `arrays`. - **/ - intersection(...arrays: any[][]): any[]; - - /** - * Similar to without, but returns the values from array that are not present in the other arrays. - * @param array Keeps values that are within `others`. - * @param others The values to keep within `array`. - * @return Copy of `array` with only `others` values. - **/ - difference(array: any[], ...others: any[]): any[]; - - /** - * Produces a duplicate-free version of the array, using === to test object equality. If you know in - * advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If - * you want to compute unique items based on a transformation, pass an iterator function. - * @param array Array to remove duplicates from. - * @param isSorted True if `array` is already sorted, optiona, default = false. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @param context 'this' object in `iterator`, optional. - * @return Copy of `array` where all elements are unique. - **/ - uniq( - array: any[], - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Produces a duplicate-free version of the array, using === to test object equality. If you know in - * advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If - * you want to compute unique items based on a transformation, pass an iterator function. - * @param array Array to remove duplicates from. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @param context 'this' object in `iterator`, optional. - * @return Copy of `array` where all elements are unique. - **/ - uniq( - array: any[], - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - - /** - * Alias for 'uniq'. - * @see uniq - **/ - unique(array: any[], - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Merges together the values of each of the arrays with the values at the corresponding position. - * Useful when you have separate data sources that are coordinated through matching array indexes. - * If you're working with a matrix of nested arrays, zip.apply can transpose the matrix in a similar fashion. - * @param arrays The arrays to merge/zip. - * @return Zipped version of `arrays`. - **/ - zip(...arrays: any[][]): any[][]; - - /** - * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a - * list of keys, and a list of values. - * @param keys Key array. - * @param values Value array. - * @return An object containing the `keys` as properties and `values` as the property values. - **/ - object(keys: string[], values: any[]): any; - /** - * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a - * list of keys, and a list of values. - * @param keyValuePairs Array of [key, value] pairs. - * @return An object containing the `keys` as properties and `values` as the property values. - **/ - object(...keyValuePairs: any[][]): any; - - /** - * Returns the index at which value can be found in the array, or -1 if value is not present in the array. - * Uses the native indexOf function unless it's missing. If you're working with a large array, and you know - * that the array is already sorted, pass true for isSorted to use a faster binary search ... or, pass a number - * as the third argument in order to look for the first matching value in the array after the given index. - * @param array The array to search for the index of `value`. - * @param value The value to search for within `array`. - * @param isSorted True if the array is already sorted, optional, default = false. - * @return The index of `value` within `array`. - **/ - indexOf(array: any[], value: any, isSorted?: bool): number; - - /** - * Returns the index of the last occurrence of value in the array, or -1 if value is not present. Uses the - * native lastIndexOf function if possible. Pass fromIndex to start your search at a given index. - * @param array The array to search for the last index of `value`. - * @param value The value to search for within `array`. - * @param from The starting index for the search, optional. - * @return The index of the last occurance of `value` within `array`. - **/ - lastIndexOf(array: any[], value: any, from?: number): number; - - /** - * Uses a binary search to determine the index at which the value should be inserted into the list in order - * to maintain the list's sorted order. If an iterator is passed, it will be used to compute the sort ranking - * of each value, including the value you pass. - * @param list The sorted list. - * @param value The value to determine its index within `list`. - * @param iterator Iterator to compute the sort ranking of each value, optional. - * @return The index where `value` should be inserted into `list`. - **/ - sortedIndex(list: any[], value: any, iterator?: (element: any) => number): number; - - /** - * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, - * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented) - * by step, exclusive. - * @param start Start here. - * @param stop Stop here. - * @param step The number to count up by each iteration, optional, default = 1. - * @return Array of numbers from `start` to `stop` with increments of `step`. - **/ - range(start: number, stop: number, step?: number): number[]; - /** - * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, - * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented) - * by step, exclusive. - * @param stop Stop here. - * @return Array of numbers from 0 to `stop` with increments of 1. - * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0) - **/ - range(stop: number): number[]; - - /************ - * Functions * - *************/ - - /** - * Bind a function to an object, meaning that whenever the function is called, the value of this will - * be the object. Optionally, bind arguments to the function to pre-fill them, also known as partial application. - * @param fn The function to bind `this` to `object`. - * @param object The `this` pointer whenever `fn` is called. - * @param arguments Additional arguments to pass to `fn` when called. - * @return `fn` with `this` bound to `object`. - **/ - bind(fn: Function, object: any, ...arguments: any[]): Function; - - - /** - * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object - * whenever they are invoked. Very handy for binding functions that are going to be used as event handlers, - * which would otherwise be invoked with a fairly useless this. If no methodNames are provided, all of the - * object's function properties will be bound to it. - * @param object The object to bind the methods `methodName` to. - * @param methodNames The methods to bind to `object`, optional and if not provided all of `object`'s - * methods are bound. - **/ - bindAll(object: any, ...methodNames: string[]): void; - - /** - * Memoizes a given function by caching the computed result. Useful for speeding up slow-running computations. - * If passed an optional hashFunction, it will be used to compute the hash key for storing the result, based - * on the arguments to the original function. The default hashFunction just uses the first argument to the - * memoized function as the key. - * @param fn Computationally expensive function that will now memoized results. - * @param hashFn Hash function for storing the result of `fn`. - * @return Memoized version of `fn`. - **/ - memoize(fn: Function, hashFn?: (n: any) => string): Function; - - /** - * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, - * they will be forwarded on to the function when it is invoked. - * @param fn Function to delay `waitMS` amount of ms. - * @param waitMS The amount of milliseconds to delay `fn`. - * @arguments Additional arguments to pass to `fn`. - **/ - delay(fn: Function, waitMS: number, ...arguments: any[]): void; - - /** - * Defers invoking the function until the current call stack has cleared, similar to using setTimeout - * with a delay of 0. Useful for performing expensive computations or HTML rendering in chunks without - * blocking the UI thread from updating. If you pass the optional arguments, they will be forwarded on - * to the function when it is invoked. - * @param fn The function to defer. - * @param arguments Additional arguments to pass to `fn`. - **/ - defer(fn: Function, ...arguments: any[]): void; - - /** - * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, - * will only actually call the original function at most once per every wait milliseconds. Useful for - * rate-limiting events that occur faster than you can keep up with. - * @param fn Function to throttle `waitMS` ms. - * @param waitMS The number of milliseconds to wait before `fn` can be invoked again. - * @return `fn` with a throttle of `waitMS`. - **/ - throttle(fn: Function, waitMS: number): Function; - - /** - * Creates and returns a new debounced version of the passed function that will postpone its execution - * until after wait milliseconds have elapsed since the last time it was invoked. Useful for implementing - * behavior that should only happen after the input has stopped arriving. For example: rendering a preview - * of a Markdown comment, recalculating a layout after the window has stopped being resized, and so on. - * - * Pass true for the immediate parameter to cause debounce to trigger the function on the leading instead - * of the trailing edge of the wait interval. Useful in circumstances like preventing accidental double - *-clicks on a "submit" button from firing a second time. - * @param fn Function to debounce `waitMS` ms. - * @param waitMS The number of milliseconds to wait before `fn` can be invoked again. - * @param immediate True if `fn` should be invoked on the leading edge of `waitMS` instead of the trailing edge. - * @return Debounced version of `fn` that waits `waitMS` ms when invoked. - **/ - debounce(fn: Function, waitMS: number, immediate?: bool): Function; - - /** - * Creates a version of the function that can only be called one time. Repeated calls to the modified - * function will have no effect, returning the value from the original call. Useful for initialization - * functions, instead of having to set a boolean flag and then check it later. - * @param fn Function to only execute once. - * @return Copy of `fn` that can only be invoked once. - **/ - once(fn: Function): Function; - - /** - * Creates a version of the function that will only be run after first being called count times. Useful - * for grouping asynchronous responses, where you want to be sure that all the async calls have finished, - * before proceeding. - * @param count Number of times to be called before actually executing. - * @fn The function to defer execution `count` times. - * @return Copy of `fn` that will not execute until it is invoked `count` times. - **/ - after(count: number, fn: Function): Function; - - /** - * Wraps the first function inside of the wrapper function, passing it as the first argument. This allows - * the wrapper to execute code before and after the function runs, adjust the arguments, and execute it - * conditionally. - * @param fn Function to wrap. - * @param wrapper The function that will wrap `fn`. - * @return Wrapped version of `fn. - **/ - wrap(fn: Function, wrapper: (fn: Function, ...args: any[]) => any): Function; - - /** - * Returns the composition of a list of functions, where each function consumes the return value of the - * function that follows. In math terms, composing the functions f(), g(), and h() produces f(g(h())). - * @param functions List of functions to compose. - * @return Composition of `functions`. - **/ - compose(...functions: Function[]): Function; - - /********** - * Objects * - ***********/ - - /** - * Retrieve all the names of the object's properties. - * @param object Retreive the key or property names from this object. - * @return List of all the property names on `object`. - **/ - keys(object: any): string[]; - - /** - * Return all of the values of the object's properties. - * @param object Retreive the values of all the properties on this object. - * @return List of all the values on `object`. - **/ - values(object: any): any[]; - - /** - * Convert an object into a list of [key, value] pairs. - * @param object Convert this object to a list of [key, value] pairs. - * @return List of [key, value] pairs on `object`. - **/ - pairs(object: any): any[][]; - - /** - * Returns a copy of the object where the keys have become the values and the values the keys. - * For this to work, all of your object's values should be unique and string serializable. - * @param object Object to invert key/value pairs. - * @return An inverted key/value paired version of `object`. - **/ - invert(object: any): any; - - /** - * Returns a sorted list of the names of every method in an object — that is to say, - * the name of every function property of the object. - * @param object Object to pluck all function property names from. - * @return List of all the function names on `object`. - **/ - functions(object: any): string[]; - - /** - * Copy all of the properties in the source objects over to the destination object, and return - * the destination object. It's in-order, so the last source will override properties of the - * same name in previous arguments. - * @param destination Object to extend all the properties from `sources`. - * @param sources Extends `destination` with all properties from these source objects. - * @return `destination` extended with all the properties from the `sources` objects. - **/ - extend(destination: any, ...sources: any[]): any; - - /** - * Return a copy of the object, filtered to only have values for the whitelisted keys - * (or array of valid keys). - * @param object Object to strip unwanted key/value pairs. - * @keys The key/value pairs to keep on `object`. - * @return Copy of `object` with only the `keys` properties. - **/ - pick(object: any, ...keys: string[]): any; - - /** - * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). - * @param object Object to strip unwanted key/value pairs. - * @param keys The key/value pairs to remove on `object`. - * @return Copy of `object` without the `keys` properties. - **/ - omit(object: any, ...keys: string[]): any; - - /** - * Fill in null and undefined properties in object with values from the defaults objects, - * and return the object. As soon as the property is filled, further defaults will have no effect. - * @param object Fill this object with default values. - * @param defaults The default values to add to `object`. - * @return `object` with added `defaults` values. - **/ - defaults(object: any, ...defaults: any[]): any; - - /** - * Create a shallow-copied clone of the object. - * Any nested objects or arrays will be copied by reference, not duplicated. - * @param object Object to clone. - * @return Copy of `object`. - **/ - clone(object: any): any; - /** - * Create a shallow-copied clone of the object. - * Any nested objects or arrays will be copied by reference, not duplicated. - * @param list List to clone. - * @return Copy of `list`. - **/ - clone(list: any[]): any[]; - - /** - * Invokes interceptor with the object, and then returns object. The primary purpose of this method - * is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. - * @param object Argument to `interceptor`. - * @param intercepter The function to modify `object` before continuing the method chain. - * @return Modified `object`. - **/ - tap(object: any, intercepter: Function): any; - - /** - * Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe - * reference to the hasOwnProperty function, in case it's been overridden accidentally. - * @param object Object to check for `key`. - * @param key The key to check for on `object`. - * @return True if `key` is a property on `object`, otherwise false. - **/ - has(object: any, key: string): bool; - - /** - * Performs an optimized deep comparison between the two objects, - * to determine if they should be considered equal. - * @param object Compare to `other`. - * @param other Compare to `object`. - * @return True if `object` is equal to `other`. - **/ - isEqual(object: any, other: any): bool; - - /** - * Returns true if object contains no values. - * @param object Check if this object has no properties or values. - * @return True if `object` is empty. - **/ - isEmpty(object: any): bool; - /** - * Returns true if the list contains no values. - * @param object Check if this list has no elements. - * @return True if `list` is empty. - **/ - isEmpty(list: any[]): bool; - - /** - * Returns true if object is a DOM element. - * @param object Check if this object is a DOM element. - * @return True if `object` is a DOM element, otherwise false. - **/ - isElement(object: any): bool; - - /** - * Returns true if object is an Array. - * @param object Check if this object is an Array. - * @return True if `object` is an Array, otherwise false. - **/ - isArray(object: any): bool; - - /** - * Returns true if value is an Object. Note that JavaScript arrays and functions are objects, - * while (normal) strings and numbers are not. - * @param object Check if this object is an Object. - * @return True of `object` is an Object, otherwise false. - **/ - isObject(object: any): bool; - - /** - * Returns true if object is an Arguments object. - * @param object Check if this object is an Arguments object. - * @return True if `object` is an Arguments object, otherwise false. - **/ - isArguments(object: any): bool; - - /** - * Returns true if object is a Function. - * @param object Check if this object is a Function. - * @return True if `object` is a Function, otherwise false. - **/ - isFunction(object: any): bool; - - /** - * Returns true if object is a String. - * @param object Check if this object is a String. - * @return True if `object` is a String, otherwise false. - **/ - isString(object: any): bool; - - /** - * Returns true if object is a Number (including NaN). - * @param object Check if this object is a Number. - * @return True if `object` is a Number, otherwise false. - **/ - isNumber(object: any): bool; - - /** - * Returns true if object is a finite Number. - * @param object Check if this object is a finite Number. - * @return True if `object` is a finite Number. - **/ - isFinite(object: any): bool; - - /** - * Returns true if object is either true or false. - * @param object Check if this object is a bool. - * @return True if `object` is a bool, otherwise false. - **/ - isBoolean(object: any): bool; - - /** - * Returns true if object is a Date. - * @param object Check if this object is a Date. - * @return True if `object` is a Date, otherwise false. - **/ - isDate(object: any): bool; - - /** - * Returns true if object is a RegExp. - * @param object Check if this object is a RegExp. - * @return True if `object` is a RegExp, otherwise false. - **/ - isRegExp(object: any): bool; - - /** - * Returns true if object is NaN. - * Note: this is not the same as the native isNaN function, - * which will also return true if the variable is undefined. - * @param object Check if this object is NaN. - * @return True if `object` is NaN, otherwise false. - **/ - isNaN(object: any): bool; - - /** - * Returns true if the value of object is null. - * @param object Check if this object is null. - * @return True if `object` is null, otherwise false. - **/ - isNull(object: any): bool; - - /** - * Returns true if value is undefined. - * @param object Check if this object is undefined. - * @return True if `object` is undefined, otherwise false. - **/ - isUndefined(object: any): bool; - - /********** - * Utility * - ***********/ - - /** - * Give control of the "_" variable back to its previous owner. - * Returns a reference to the Underscore object. - * @return Underscore object reference. - **/ - noConflict(): Underscore; - - /** - * Returns the same value that is used as the argument. In math: f(x) = x - * This function looks useless, but is used throughout Underscore as a default iterator. - * @param value Identity of this object. - * @return `value`. - **/ - identity(value: any): any; - - /** - * Invokes the given iterator function n times. - * Each invocation of iterator is called with an index argument - * @param n Number of times to invoke `iterator`. - * @param iterator Function iterator to invoke `n` times. - * @param context `this` object in `iterator`, optional. - **/ - times(n: number, iterator: (n: number) => any , context?: any): any[]; - - /** - * Returns a random integer between min and max, inclusive. If you only pass one argument, - * it will return a number between 0 and that number. - * @param max The maximum random number. - * @return A random number between 0 and `max`. - **/ - random(max: number): number; - /** - * Returns a random integer between min and max, inclusive. If you only pass one argument, - * it will return a number between 0 and that number. - * @param min The minimum random number. - * @param max The maximum random number. - * @return A random number between `min` and `max`. - **/ - random(min: number, max: number): number; - - /** - * Allows you to extend Underscore with your own utility functions. Pass a hash of - * {name: function} definitions to have your functions added to the Underscore object, - * as well as the OOP wrapper. - * @param object Mixin object containing key/function pairs to add to the Underscore object. - **/ - mixin(object: any): void; - - /** - * Generate a globally-unique id for client-side models or DOM elements that need one. - * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. - * @return Unique number ID. - **/ - uniqueId(): number; - /** - * Generate a globally-unique id for client-side models or DOM elements that need one. - * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. - * @param prefix A prefix string to start the unique ID with. - * @return Unique string ID beginning with `prefix`. - **/ - uniqueId(prefix: string): string; - - /** - * Escapes a string for insertion into HTML, replacing &, <, >, ", ', and / characters. - * @param str Raw string to escape. - * @return `str` HTML escaped. - **/ - escape(str: string): string; - - /** - * If the value of the named property is a function then invoke it; otherwise, return it. - * @param object Object to maybe invoke function `property` on. - * @param property The function by name to invoke on `object`. - * @return The result of invoking the function `property` on `object. - **/ - result(object: any, property: string): any; - - /** - * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful - * for rendering complicated bits of HTML from JSON data sources. Template functions can both - * interpolate variables, using <%= … %>, as well as execute arbitrary JavaScript code, with - * <% … %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- … %> When - * you evaluate a template function, pass in a data object that has properties corresponding to - * the template's free variables. If you're writing a one-off, you can pass the data object as - * the second parameter to template in order to render immediately instead of returning a template - * function. The settings argument should be a hash containing any _.templateSettings that should - * be overridden. - * @param templateString Underscore HTML template. - * @param data Data to use when compiling `templateString`. - * @param settings Settings to use while compiling. - * @return Returns the compiled Underscore HTML template. - **/ - template(templateString: string, data?: any, settings?: UnderscoreTemplateSettings): any; - - /** - * By default, Underscore uses ERB-style template delimiters, change the - * following template settings to use alternative delimiters. - **/ - templateSettings: UnderscoreTemplateSettings; - - /*********** - * Chaining * - ************/ - - /** - * Returns a wrapped object. Calling methods on this object will continue to return wrapped objects - * until value() is used. - * @param obj Object to chain. - * @return Wrapped `obj`. - **/ - chain(obj: any): UnderscoreOOPWrapper; - - /** - * Extracts the value of a wrapped object. - * @param obj Wrapped object to extract the value from. - * @return Value of `obj`. - **/ - value(obj: any): any; - - /************** - * OOP Wrapper * - **************/ - - /** - * Underscore OOP Wrapper, all Underscore functions that take an object - * as the first parameter can be invoked through this function. - * @param key First argument to Underscore object functions. - **/ - (obj: any): UnderscoreOOPWrapper; -} - -/** -* underscore.js template settings, set templateSettings or pass as an argument -* to 'template()' to overide defaults. -**/ -interface UnderscoreTemplateSettings { - /** - * Default value is '/<%([\s\S]+?)%>/g'. - **/ - evaluate?: RegExp; - - /** - * Default value is '/<%=([\s\S]+?)%>/g'. - **/ - interpolate?: RegExp; - - /** - * Default value is '/<%-([\s\S]+?)%>/g'. - **/ - escape?: RegExp; -} - -interface UnderscoreOOPWrapper { - - /************** - * Collections * - **************/ - - /** - * Wrapped type `any[]`. - * @see _.each - **/ - each( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Wrapped type `object`. - * @see _.each - **/ - each( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Alias for 'each'. - * @see each - **/ - forEach( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): void; - /** - * Alias for 'each'. - * @see each - **/ - forEach( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): void; - - /** - * Wrapped type `any[]`. - * @see _.map - **/ - map( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Wrapped type `object`. - * @see _.map - **/ - map( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Alias for 'map'. - * @see map - **/ - collect( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Alias for 'map'. - * @see map - **/ - collect( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.reduce - **/ - reduce( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - inject( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduce'. - * @see reduce - **/ - foldl( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.reduceRight - **/ - reduceRight( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Alias for 'reduceRight'. - * @see reduceRight - **/ - foldr( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.find - **/ - find( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - /** - * Alias for 'find'. - * @see find - **/ - detect( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - - - /** - * Wrapped type `any[]`. - * @see _.filter - **/ - filter( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Alias for 'filter'. - * @see filter - **/ - select( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.where - **/ - where(list: any[], properties: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.reject - **/ - reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.all - **/ - all( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'all'. - * @see all - **/ - every( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.any - **/ - any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Alias for 'any'. - * @see any - **/ - some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.contains - **/ - contains(value: any): bool; - - /** - * Alias for 'contains'. - * @see contains - **/ - include(value: any): bool; - - /** - * Wrapped type `any[]`. - * @see _.invoke - **/ - invoke(methodName: string, ...arguments: any[]): void; - - /** - * Wrapped type `any[]`. - * @see _.pluck - **/ - pluck(propertyName: string): any[]; - - /** - * Wrapped type `number[]`. - * @see _.max - **/ - max(): number; - /** - * Wrapped type `any[]`. - * @see _.max - **/ - max( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Wrapped type `number[]`. - * @see _.min - **/ - min(): number; - /** - * Wrapped type `any[]`. - * @see _.min - **/ - min( - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; - - /** - * Wrapped type `any[]`. - * @see _.sortBy - **/ - sortBy( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any[]; - /** - * Wrapped type `any[]`. - * @see _.sortBy - **/ - sortBy( - iterator: string, - context?: any): any[]; - - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ - groupBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: any[]; }; - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ - groupBy( - iterator: string, - context?: any): { [key: string]: any[]; }; - - /** - * Wrapped type `any[]`. - * @see _.countBy - **/ - countBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: number; }; - /** - * Wrapped type `any[]`. - * @see _.countBy - **/ - countBy( - iterator: string, - context?: any): { [key: string]: number; }; - - /** - * Wrapped type `any[]`. - * @see _.shuffle - **/ - shuffle(): any[]; - - /** - * Wrapped type `any`. - * @see _.toArray - **/ - toArray(): any[]; - - /** - * Wrapped type `any`. - * @see _.size - **/ - size(): number; - - /********* - * Arrays * - **********/ - - /** - * Wrapped type `any[]`. - * @see _.first - **/ - first(): any; - /** - * Wrapped type `any[]`. - * @see _.first - **/ - first(n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - head(): any; - /** - * Alias for 'first'. - * @see first - **/ - head(n: number): any[]; - - /** - * Alias for 'first'. - * @see first - **/ - take(): any; - /** - * Alias for 'first'. - * @see first - **/ - take(n: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.initial - **/ - initial(n?: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.last - **/ - last(): any; - /** - * Wrapped type `any[]`. - * @see _.last - **/ - last(n: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.rest - **/ - rest(index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - tail(index?: number): any[]; - - /** - * Alias for 'rest'. - * @see rest - **/ - drop(index?: number): any[]; - - /** - * Wrapped type `any[]`. - * @see _.compact - **/ - compact(): any[]; - - /** - * Wrapped type `any`. - * @see _.flatten - **/ - flatten(shallow?: bool): any; - - /** - * Wrapped type `any[]`. - * @see _.without - **/ - without(...values: any[]): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.union - **/ - union(...arrays: any[][]): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.intersection - **/ - intersection(...arrays: any[][]): any[]; - - /** - * Wrapped type `any[]`. - * @see _.difference - **/ - difference(...others: any[]): any[]; - - /** - * Wrapped type `any[]`. - * @see _.uniq - **/ - uniq( - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - /** - * Wrapped type `any[]`. - * @see _.uniq - **/ - uniq( - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; - - /** - * Alias for 'uniq'. - * @see uniq - **/ - unique( - isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; - - /** - * Wrapped type `any[][]`. - * @see _.zip - **/ - zip(...arrays: any[][]): any[][]; - - /** - * Wrapped type `any[][]`. - * @see _.object - **/ - object(...keyValuePairs: any[][]): any; - - /** - * Wrapped type `any[]`. - * @see _.indexOf - **/ - indexOf(value: any, isSorted?: bool): number; - - /** - * Wrapped type `any[]`. - * @see _.lastIndexOf - **/ - lastIndexOf(value: any, from?: number): number; - - /** - * Wrapped type `any[]`. - * @see _.sortedIndex - **/ - sortedIndex(value: any, iterator?: (element: any) => number): number; - - /** - * Wrapped type `number`. - * @see _.range - **/ - range(stop: number, step?: number): number[]; - /** - * Wrapped type `number`. - * @see _.range - **/ - range(): number[]; - - /************ - * Functions * - *************/ - - /** - * Wrapped type `Function`. - * @see _.bind - **/ - bind(object: any, ...arguments: any[]): Function; - - - /** - * Wrapped type `object`. - * @see _.bindAll - **/ - bindAll(...methodNames: string[]): void; - - /** - * Wrapped type `Function`. - * @see _.memoize - **/ - memoize(hashFn?: (n: any) => string): Function; - - /** - * Wrapped type `Function`. - * @see _.delay - **/ - delay(waitMS: number, ...arguments: any[]): void; - - /** - * Wrapped type `Function`. - * @see _.defer - **/ - defer(...arguments: any[]): void; - - /** - * Wrapped type `Function`. - * @see _.throttle - **/ - throttle(waitMS: number): Function; - - /** - * Wrapped type `Function`. - * @see _.debounce - **/ - debounce(waitMS: number, immediate?: bool): Function; - - /** - * Wrapped type `Function`. - * @see _.once - **/ - once(): Function; - - /** - * Wrapped type `number`. - * @see _.after - **/ - after(fn: Function): Function; - - /** - * Wrapped type `Function`. - * @see _.wrap - **/ - wrap(wrapper: (fn: Function, ...args: any[]) => any): Function; - - /** - * Wrapped type `Function[]`. - * @see _.compose - **/ - compose(...functions: Function[]): Function; - - /********** - * Objects * - ***********/ - - /** - * Wrapped type `object`. - * @see _.keys - **/ - keys(): string[]; - - /** - * Wrapped type `object`. - * @see _.values - **/ - values(): any[]; - - /** - * Wrapped type `object`. - * @see _.pairs - **/ - pairs(): any[][]; - - /** - * Wrapped type `object`. - * @see _.invert - **/ - invert(): any; - - /** - * Wrapped type `object`. - * @see _.functions - **/ - functions(): string[]; - - /** - * Wrapped type `object`. - * @see _.extend - **/ - extend(...sources: any[]): any; - - /** - * Wrapped type `object`. - * @see _.pick - **/ - pick(...keys: string[]): any; - - /** - * Wrapped type `object`. - * @see _.omit - **/ - omit(...keys: string[]): any; - - /** - * Wrapped type `object`. - * @see _.defaults - **/ - defaults(...defaults: any[]): any; - - /** - * Wrapped type `object`. - * @see _.clone - **/ - clone(object: any): any; - /** - * Wrapped type `any[]`. - * @see _.clone - **/ - clone(list: any[]): any[]; - - /** - * Wrapped type `object`. - * @see _.tap - **/ - tap(intercepter: Function): any; - - /** - * Wrapped type `object`. - * @see _.has - **/ - has(key: string): bool; - - /** - * Wrapped type `object`. - * @see _.isEqual - **/ - isEqual(other: any): bool; - - /** - * Wrapped type `object`. - * @see _.isEmpty - **/ - isEmpty(object: any): bool; - /** - * Wrapped type `any[]`. - * @see _.isEmpty - **/ - isEmpty(list: any[]): bool; - - /** - * Wrapped type `object`. - * @see _.isElement - **/ - isElement(): bool; - - /** - * Wrapped type `object`. - * @see _.isArray - **/ - isArray(): bool; - - /** - * Wrapped type `object`. - * @see _.isObject - **/ - isObject(): bool; - - /** - * Wrapped type `object`. - * @see _.isArguments - **/ - isArguments(): bool; - - /** - * Wrapped type `object`. - * @see _.isFunction - **/ - isFunction(): bool; - - /** - * Wrapped type `object`. - * @see _.isString - **/ - isString(): bool; - - /** - * Wrapped type `object`. - * @see _.isNumber - **/ - isNumber(): bool; - - /** - * Wrapped type `object`. - * @see _.isFinite - **/ - isFinite(): bool; - - /** - * Wrapped type `object`. - * @see _.isBoolean - **/ - isBoolean(): bool; - - /** - * Wrapped type `object`. - * @see _.isDate - **/ - isDate(): bool; - - /** - * Wrapped type `object`. - * @see _.isRegExp - **/ - isRegExp(): bool; - - /** - * Wrapped type `object`. - * @see _.isNaN - **/ - isNaN(): bool; - - /** - * Wrapped type `object`. - * @see _.isNull - **/ - isNull(): bool; - - /** - * Wrapped type `object`. - * @see _.isUndefined - **/ - isUndefined(): bool; - - /********** - * Utility * - ***********/ - - /** - * Wrapped type `any`. - * @see _.identity - **/ - identity(): any; - - /** - * Wrapped type `number`. - * @see _.times - **/ - times(iterator: (n: number) => any, context?: any): any[]; - - /** - * Wrapped type `number`. - * @see _.random - **/ - random(): number; - /** - * Wrapped type `number`. - * @see _.random - **/ - random(max: number): number; - - /** - * Wrapped type `object`. - * @see _.mixin - **/ - mixin(): void; - - /** - * Wrapped type `string`. - * @see _.uniqueId - **/ - uniqueId(): string; - - /** - * Wrapped type `string`. - * @see _.escape - **/ - escape(): string; - - /** - * Wrapped type `object`. - * @see _.result - **/ - result(property: string): any; - - /** - * Wrapped type `string`. - * @see _.template - **/ - template(data?: any, settings?: UnderscoreTemplateSettings): any; - - /*********** - * Chaining * - ************/ - - /** - * Wrapped type `any`. - * @see _.chain - **/ - chain(): any; - - /** - * Wrapped type `any`. - * @see _.value - **/ - value(): any; -} - -declare var _: Underscore; diff --git a/underscore/underscore-typed-tests.ts b/underscore/underscore-typed-tests.ts index abe680ed1b..b04f3c213d 100644 --- a/underscore/underscore-typed-tests.ts +++ b/underscore/underscore-typed-tests.ts @@ -3,7 +3,7 @@ declare var $; _.each([1, 2, 3], (num) => alert(num.toString())); -_.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())); +_.each({ one: 1, two: 2, three: 3 }, (value) => alert(value.toString())); _.map([1, 2, 3], (num) => num * 3); _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); @@ -41,16 +41,15 @@ _.min(numbers); _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); -// not sure how this is typechecking at all.. Math.floor(e) is number not string..? -_([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)); -_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); +_([1.3, 2.1, 2.4]).groupBy((e, i?: number, list?: any[]) => Math.floor(e)); +_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num).toString()); _.groupBy(['one', 'two', 'three'], 'length'); _.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd'); _.shuffle([1, 2, 3, 4, 5, 6]); -// (function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); +(function(a, b, c, d){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); _.size({ one: 1, two: 2, three: 3 }); @@ -74,7 +73,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); _.difference([1, 2, 3, 4, 5], [5, 2, 10]); _.uniq([1, 2, 1, 3, 1, 4]); _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -_.object(['moe', 'larry', 'curly'], [30, 40, 50]); +var r = _.object<{ [key: string]: number }>(['moe', 'larry', 'curly'], [30, 40, 50]); _.object([['moe', 30], ['larry', 40], ['curly', 50]]); _.indexOf([1, 2, 3], 2); _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); @@ -154,10 +153,20 @@ _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); +_([1, 2, 3, 4]) + .chain() + .filter((num: number) => { + return num % 2 == 0; + }).tap(alert) + .map((num: number) => { + return num * num; + }) + .value(); + _.chain([1, 2, 3, 200]) - .filter(function (num) { return num % 2 == 0; }) + .filter(function (num: number) { return num % 2 == 0; }) .tap(alert) - .map(function (num) { return num * num }) + .map(function (num: number) { return num * num }) .value(); _.has({ a: 1, b: 2, c: 3 }, "b"); @@ -215,6 +224,7 @@ var moe2 = { name: 'moe' }; moe2 === _.identity(moe); var genie; +var r2 = _.times(3, (n) => { return n * n }); _(3).times(function (n) { genie.grantWishNumber(n); }); _.random(0, 100); diff --git a/underscore/underscore-typed.d.ts b/underscore/underscore-typed.d.ts index 2eb1dd6eff..d892f8746c 100644 --- a/underscore/underscore-typed.d.ts +++ b/underscore/underscore-typed.d.ts @@ -24,7 +24,40 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -interface Underscore { +/************** +* OOP Wrapper * +**************/ + +/** +* Underscore OOP Wrapper, all Underscore functions that take an object +* as the first parameter can be invoked through this function. +* @param key First argument to Underscore object functions. +**/ +declare function _(value: T[]): _; +declare function _(value: T): _; + +declare module _ { + + /** + * underscore.js template settings, set templateSettings or pass as an argument + * to 'template()' to overide defaults. + **/ + interface _TemplateSettings { + /** + * Default value is '/<%([\s\S]+?)%>/g'. + **/ + evaluate?: RegExp; + + /** + * Default value is '/<%=([\s\S]+?)%>/g'. + **/ + interpolate?: RegExp; + + /** + * Default value is '/<%-([\s\S]+?)%>/g'. + **/ + escape?: RegExp; + } /************** * Collections * @@ -39,39 +72,33 @@ interface Underscore { * @param iterator Iterator function for each element `list`. * @param context 'this' object in `iterator`, optional. **/ - each( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, + export function each( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => void, context?: any): void; /** - * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is - * bound to the context object, if one is passed. Each invocation of iterator is called with three - * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be - * (value, key, object). Delegates to the native forEach function if it exists. + * @see _.each * @param obj Iterators over this object's properties. * @param iterator Iterator function for each property on `obj`. - * @param context `this` object in the `iterator`, optional. **/ - each( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, + export function each( + obj: T, + iterator: (value: any, key?: string, obj?: T) => void, context?: any): void; /** - * Alias for 'each'. - * @see each + * @see _.each **/ - forEach( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, + export function forEach( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => void, context?: any): void; /** - * Alias for 'each'. - * @see each + * @see _.each **/ - forEach( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, + export function forEach( + obj: T, + iterator: (value: any, key?: string, obj?: T) => void, context?: any): void; /** @@ -83,40 +110,36 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The mapped array result. **/ - map( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + export function map( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): TResult[]; /** - * Produces a new array of values by mapping each value in list through a transformation function - * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript - * object, iterator's arguments will be (value, key, object). - * @param list Maps the properties of this object. + * @see _.map + * @param obj Maps the properties of this object. * @param iterator Map iterator function for each property on `obj`. * @param context `this` object in `iterator`, optional. * @return The mapped object result. **/ - map( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; + export function map( + obj: T, + iterator: (value: any, key?: string, object?: Object) => TResult, + context?: any): TResult[]; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + export function collect( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): TResult[]; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - obj: Object, - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; + export function collect( + obj: T, + iterator: (value: any, key?: string, object?: Object) => TResult, + context?: any): TResult[]; /** * Also known as inject and foldl, reduce boils down a list of values into a single value. @@ -129,31 +152,29 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return Reduced object result. **/ - reduce( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + export function reduce( + list: T[], + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - inject( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + export function inject( + list: T[], + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - foldl( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + export function foldl( + list: T[], + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** * The right-associative version of reduce. Delegates to the JavaScript 1.8 version of @@ -165,21 +186,20 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return Reduced object result. **/ - reduceRight( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + export function reduceRight( + list: T[], + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduceRight'. - * @see reduceRight + * @see _.reduceRight **/ - foldr( - list: any[], - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + export function foldr( + list: T[], + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** * Looks through each value in the list, returning the first one that passes a truth @@ -190,20 +210,18 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The first acceptable found element in `list`, if nothing is found undefined/null is returned. **/ - find( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; + export function find( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T; /** - * Alias for 'find'. - * @see find + * @see _.find **/ - detect( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - + export function detect( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T; /** * Looks through each value in the list, returning an array of all the values that pass a truth @@ -213,19 +231,18 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The filtered list of elements. **/ - filter( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + export function filter( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** - * Alias for 'filter'. - * @see filter + * @see _.filter **/ - select( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + export function select( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** * Looks through each value in the list, returning an array of all the values that contain all @@ -234,7 +251,7 @@ interface Underscore { * @param properties The properties to check for on each element within `list`. * @return The elements within `list` that contain the required `properties`. **/ - where(list: any[], properties: any): any[]; + export function where(list: T[], properties: U): T[]; /** * Looks through the list and returns the first value that matches all of the key-value pairs listed in properties. @@ -242,7 +259,7 @@ interface Underscore { * @param properties Properties to look for on the elements within `list`. * @return The first element in `list` that has all `properties`. **/ - findWhere(list: any[], properties: any): any; + export function findWhere(list: T[], properties: U): T; /** * Returns the values in list without the elements that the truth test (iterator) passes. @@ -253,10 +270,10 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The rejected list of elements. **/ - reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + export function reject( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** * Returns true if all of the values in the list pass the iterator truth test. Delegates to the @@ -266,18 +283,17 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return True if all elements passed the truth test, otherwise false. **/ - all( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, + export function all( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** - * Alias for 'all'. - * @see all + * @see _.all **/ - every( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, + export function every( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** @@ -288,18 +304,17 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return True if any elements passed the truth test, otherwise false. **/ - any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, + export function any( + list: T[], + iterator?: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** - * Alias for 'any'. - * @see any + * @see _.any **/ - some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, + export function some( + list: T[], + iterator?: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** @@ -309,13 +324,12 @@ interface Underscore { * @param value The value to check for within `list`. * @return True if `value` is present in `list`, otherwise false. **/ - contains(list: any[], value: any): bool; + export function contains(list: T[], value: T): bool; /** - * Alias for 'contains'. - * @see contains + * @see _.contains **/ - include(list: any[], value: any): bool; + export function include(list: T[], value: T): bool; /** * Calls the method named by methodName on each value in the list. Any extra arguments passed to @@ -324,7 +338,7 @@ interface Underscore { * @param methodName The method's name to call on each element within `list`. * @param arguments Additional arguments to pass to the method `methodName`. **/ - invoke(list: any[], methodName: string, ...arguments: any[]): void; + export function invoke(list: T[], methodName: string, ...arguments: any[]): void; /** * A convenient version of what is perhaps the most common use-case for map: extracting a list of @@ -333,14 +347,14 @@ interface Underscore { * @param propertyName The property to look for on each element within `list`. * @return The list of elements within `list` that have the property `propertyName`. **/ - pluck(list: any[], propertyName: string): any[]; + export function pluck(list: T[], propertyName: string): T[]; /** * Returns the maximum value in list. * @param list Finds the maximum value in this list. * @return Maximum value in `list`. **/ - max(list: number[]): number; + export function max(list: number[]): number; /** * Returns the maximum value in list. If iterator is passed, it will be used on each value to generate * the criterion by which the value is ranked. @@ -349,17 +363,17 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The maximum element within `list`. **/ - max( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; + export function max( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): T; /** * Returns the minimum value in list. * @param list Finds the minimum value in this list. * @return Minimum value in `list`. **/ - min(list: number[]): number; + export function min(list: number[]): number; /** * Returns the minimum value in list. If iterator is passed, it will be used on each value to generate * the criterion by which the value is ranked. @@ -368,10 +382,10 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return The minimum element within `list`. **/ - min( - list: any[], - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; + export function min( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): T; /** * Returns a sorted copy of list, ranked in ascending order by the results of running each value @@ -381,22 +395,18 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return A sorted copy of `list`. **/ - sortBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + export function sortBy( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** - * Returns a sorted copy of list, ranked in ascending order by the results of running each value - * through iterator. Iterator may also be the string name of the property to sort by (eg. length). - * @param list Sorts this list. + * @see _.sortBy * @param iterator Sort iterator for each element within `list`. - * @param context `this` object in `iterator`, optional. - * @return A sorted copy of `list`. **/ - sortBy( - list: any[], + export function sortBy( + list: T[], iterator: string, - context?: any): any[]; + context?: any): T[]; /** * Splits a collection into sets, grouped by the result of running each value through iterator. @@ -407,23 +417,21 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return An object with the group names as properties where each property contains the grouped elements from `list`. **/ - groupBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, + export function groupBy( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => string, context?: any): { [key: string]: any[]; }; + // todo: return should be { [key: string]: T[]; }; + /** - * Splits a collection into sets, grouped by the result of running each value through iterator. - * If iterator is a string instead of a function, groups by the property named by iterator on - * each of the values. - * @param list Groups this list. + * @see _.groupBy * @param iterator Group iterator for each element within `list`, return the key to group the element by. - * @param context `this` object in `iterator`, optional. - * @return An object with the group names as properties where each property contains the grouped elements from `list`. **/ - groupBy( - list: any[], + export function groupBy( + list: T[], iterator: string, context?: any): { [key: string]: any[]; }; + // todo: return should be { [key: string]: T[]; }; /** * Sorts a list into groups and returns a count for the number of objects in each group. Similar @@ -434,9 +442,9 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return An object with the group names as properties where each property contains the number of elements in that group. **/ - countBy( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => string, + export function countBy( + list: T[], + iterator: (element: T, index?: number, list?: T[]) => string, context?: any): { [key: string]: number; }; /** * Sorts a list into groups and returns a count for the number of objects in each group. Similar @@ -447,8 +455,8 @@ interface Underscore { * @param context `this` object in `iterator`, optional. * @return An object with the group names as properties where each property contains the number of elements in that group. **/ - countBy( - list: any[], + export function countBy( + list: T[], iterator: string, context?: any): { [key: string]: number; }; @@ -457,7 +465,7 @@ interface Underscore { * @param list List to shuffle. * @return Shuffled copy of `list`. **/ - shuffle(list: any[]): any[]; + export function shuffle(list: T[]): T[]; /** * Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting @@ -465,14 +473,14 @@ interface Underscore { * @param list object to transform into an array. * @return `list` as an array. **/ - toArray(list: any): any[]; + export function toArray(list: any): any[]; /** * Return the number of values in the list. * @param list Count the number of values/elements in this list. * @return Number of values in `list`. **/ - size(list: any): number; + export function size(list: any): number; /********* * Arrays * @@ -483,36 +491,30 @@ interface Underscore { * @param array Retrieves the first element of this array. * @return Returns the first element of `array`. **/ - first(array: any[]): any; + export function first(array: T[]): T; /** - * Returns the first element of an array. Passing n will return the first n elements of the array. - * @param array Retreives the first `n` elements of this array. + * @see _.first * @param n Return more than one element from `array`. - * @return Returns the first `n` elements from `array. **/ - first(array: any[], n: number): any[]; + export function first(array: T[], n: number): T[]; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(array: any[]): any; + export function head(array: T[]): T; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(array: any[], n: number): any[]; + export function head(array: T[], n: number): T[]; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(array: any[]): any; + export function take(array: T[]): T; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(array: any[], n: number): any[]; + export function take(array: T[], n: number): T[]; /** * Returns everything but the last entry of the array. Especially useful on the arguments object. @@ -521,21 +523,19 @@ interface Underscore { * @param n Leaves this many elements behind, optional. * @return Returns everything but the last `n` elements of `array`. **/ - initial(array: any[], n?: number): any[]; + export function initial(array: T[], n?: number): T[]; /** * Returns the last element of an array. Passing n will return the last n elements of the array. * @param array Retrieves the last element of this array. * @return Returns the last element of `array`. **/ - last(array: any[]): any; + export function last(array: T[]): T; /** - * Returns the last element of an array. Passing n will return the last n elements of the array. - * @param array Retreives the last `n` elements of this array. + * @see _.last * @param n Return more than one element from `array`. - * @return Returns the last `n` elements from `array. **/ - last(array: any[], n: number): any[]; + export function last(array: T[], n: number): T[]; /** * Returns the rest of the elements in an array. Pass an index to return the values of the array @@ -544,19 +544,17 @@ interface Underscore { * @param index The index to start retrieving elements forward from, optional, default = 1. * @return Returns the elements of `array` from `index` to the end of `array`. **/ - rest(array: any[], index?: number): any[]; + export function rest(array: T[], index?: number): T[]; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - tail(array: any[], index?: number): any[]; + export function tail(array: T[], index?: number): T[]; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - drop(array: any[], index?: number): any[]; + export function drop(array: T[], index?: number): T[]; /** * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "", @@ -564,7 +562,7 @@ interface Underscore { * @param array Array to compact. * @return Copy of `array` without false values. **/ - compact(array: any[]): any[]; + export function compact(array: T[]): T[]; /** * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will @@ -573,7 +571,7 @@ interface Underscore { * @param shallow If true then only flatten one level, optional, default = false. * @return `array` flattened. **/ - flatten(array: any, shallow?: bool): any; + export function flatten(array: any, shallow?: bool): any; /** * Returns a copy of the array with all instances of the values removed. @@ -581,7 +579,7 @@ interface Underscore { * @param values The values to remove from `array`. * @return Copy of `array` without `values`. **/ - without(array: any[], ...values: any[]): any[]; + export function without(array: T[], ...values: T[]): T[]; /** * Computes the union of the passed-in arrays: the list of unique items, in order, that are @@ -589,7 +587,7 @@ interface Underscore { * @param arrays Array of arrays to compute the union of. * @return The union of elements within `arrays`. **/ - union(...arrays: any[][]): any[]; + export function union(...arrays: T[][]): T[]; /** * Computes the list of values that are the intersection of all the arrays. Each value in the result @@ -597,7 +595,7 @@ interface Underscore { * @param arrays Array of arrays to compute the intersection of. * @return The intersection of elements within `arrays`. **/ - intersection(...arrays: any[][]): any[]; + export function intersection(...arrays: T[][]): T[]; /** * Similar to without, but returns the values from array that are not present in the other arrays. @@ -605,7 +603,7 @@ interface Underscore { * @param others The values to keep within `array`. * @return Copy of `array` with only `others` values. **/ - difference(array: any[], ...others: any[]): any[]; + export function difference(array: T[], ...others: T[][]): T[]; /** * Produces a duplicate-free version of the array, using === to test object equality. If you know in @@ -617,32 +615,34 @@ interface Underscore { * @param context 'this' object in `iterator`, optional. * @return Copy of `array` where all elements are unique. **/ - uniq( - array: any[], + export function uniq( + array: T[], isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** - * Produces a duplicate-free version of the array, using === to test object equality. If you know in - * advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If - * you want to compute unique items based on a transformation, pass an iterator function. - * @param array Array to remove duplicates from. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @param context 'this' object in `iterator`, optional. - * @return Copy of `array` where all elements are unique. + * @see _.unq **/ - uniq( - array: any[], - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + export function uniq( + array: T[], + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** - * Alias for 'uniq'. - * @see uniq + * @see _.uniq **/ - unique(array: any[], + export function unique( + array: T[], isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; + /** + * @see _.unq + **/ + export function unique( + array: T[], + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** * Merges together the values of each of the arrays with the values at the corresponding position. @@ -651,7 +651,7 @@ interface Underscore { * @param arrays The arrays to merge/zip. * @return Zipped version of `arrays`. **/ - zip(...arrays: any[][]): any[][]; + export function zip(...arrays: any[][]): any[][]; /** * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a @@ -660,14 +660,14 @@ interface Underscore { * @param values Value array. * @return An object containing the `keys` as properties and `values` as the property values. **/ - object(keys: string[], values: any[]): any; + export function object(keys: string[], values: any[]): TResult; /** * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a * list of keys, and a list of values. * @param keyValuePairs Array of [key, value] pairs. * @return An object containing the `keys` as properties and `values` as the property values. **/ - object(...keyValuePairs: any[][]): any; + export function object(...keyValuePairs: any[][]): TResult; /** * Returns the index at which value can be found in the array, or -1 if value is not present in the array. @@ -679,7 +679,7 @@ interface Underscore { * @param isSorted True if the array is already sorted, optional, default = false. * @return The index of `value` within `array`. **/ - indexOf(array: any[], value: any, isSorted?: bool): number; + export function indexOf(array: T[], value: T, isSorted?: bool): number; /** * Returns the index of the last occurrence of value in the array, or -1 if value is not present. Uses the @@ -689,7 +689,7 @@ interface Underscore { * @param from The starting index for the search, optional. * @return The index of the last occurance of `value` within `array`. **/ - lastIndexOf(array: any[], value: any, from?: number): number; + export function lastIndexOf(array: T[], value: T, from?: number): number; /** * Uses a binary search to determine the index at which the value should be inserted into the list in order @@ -700,7 +700,7 @@ interface Underscore { * @param iterator Iterator to compute the sort ranking of each value, optional. * @return The index where `value` should be inserted into `list`. **/ - sortedIndex(list: any[], value: any, iterator?: (element: any) => number): number; + export function sortedIndex(list: T[], value: T, iterator?: (element: T) => number): number; /** * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, @@ -711,7 +711,7 @@ interface Underscore { * @param step The number to count up by each iteration, optional, default = 1. * @return Array of numbers from `start` to `stop` with increments of `step`. **/ - range(start: number, stop: number, step?: number): number[]; + export function range(start: number, stop: number, step?: number): number[]; /** * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted, * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented) @@ -720,7 +720,7 @@ interface Underscore { * @return Array of numbers from 0 to `stop` with increments of 1. * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0) **/ - range(stop: number): number[]; + export function range(stop: number): number[]; /************ * Functions * @@ -734,8 +734,7 @@ interface Underscore { * @param arguments Additional arguments to pass to `fn` when called. * @return `fn` with `this` bound to `object`. **/ - bind(fn: Function, object: any, ...arguments: any[]): Function; - + export function bind(fn: Function, object: any, ...arguments: any[]): Function; /** * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object @@ -746,7 +745,7 @@ interface Underscore { * @param methodNames The methods to bind to `object`, optional and if not provided all of `object`'s * methods are bound. **/ - bindAll(object: any, ...methodNames: string[]): void; + export function bindAll(object: any, ...methodNames: string[]): void; /** * Partially apply a function by filling in any number of its arguments, without changing its dynamic this value. @@ -755,7 +754,7 @@ interface Underscore { * @param arguments The partial arguments. * @return `fn` with partially filled in arguments. **/ - partial(fn: Function, ...arguments: any[]): Function; + export function partial(fn: Function, ...arguments: any[]): Function; /** * Memoizes a given function by caching the computed result. Useful for speeding up slow-running computations. @@ -766,7 +765,7 @@ interface Underscore { * @param hashFn Hash function for storing the result of `fn`. * @return Memoized version of `fn`. **/ - memoize(fn: Function, hashFn?: (n: any) => string): Function; + export function memoize(fn: Function, hashFn?: (n: any) => string): Function; /** * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, @@ -775,7 +774,7 @@ interface Underscore { * @param waitMS The amount of milliseconds to delay `fn`. * @arguments Additional arguments to pass to `fn`. **/ - delay(fn: Function, waitMS: number, ...arguments: any[]): void; + export function delay(fn: Function, waitMS: number, ...arguments: any[]): void; /** * Defers invoking the function until the current call stack has cleared, similar to using setTimeout @@ -785,7 +784,7 @@ interface Underscore { * @param fn The function to defer. * @param arguments Additional arguments to pass to `fn`. **/ - defer(fn: Function, ...arguments: any[]): void; + export function defer(fn: Function, ...arguments: any[]): void; /** * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, @@ -795,7 +794,7 @@ interface Underscore { * @param waitMS The number of milliseconds to wait before `fn` can be invoked again. * @return `fn` with a throttle of `waitMS`. **/ - throttle(fn: Function, waitMS: number): Function; + export function throttle(fn: Function, waitMS: number): Function; /** * Creates and returns a new debounced version of the passed function that will postpone its execution @@ -811,7 +810,7 @@ interface Underscore { * @param immediate True if `fn` should be invoked on the leading edge of `waitMS` instead of the trailing edge. * @return Debounced version of `fn` that waits `waitMS` ms when invoked. **/ - debounce(fn: Function, waitMS: number, immediate?: bool): Function; + export function debounce(fn: Function, waitMS: number, immediate?: bool): Function; /** * Creates a version of the function that can only be called one time. Repeated calls to the modified @@ -820,7 +819,7 @@ interface Underscore { * @param fn Function to only execute once. * @return Copy of `fn` that can only be invoked once. **/ - once(fn: Function): Function; + export function once(fn: Function): Function; /** * Creates a version of the function that will only be run after first being called count times. Useful @@ -830,7 +829,7 @@ interface Underscore { * @fn The function to defer execution `count` times. * @return Copy of `fn` that will not execute until it is invoked `count` times. **/ - after(count: number, fn: Function): Function; + export function after(count: number, fn: Function): Function; /** * Wraps the first function inside of the wrapper function, passing it as the first argument. This allows @@ -840,7 +839,7 @@ interface Underscore { * @param wrapper The function that will wrap `fn`. * @return Wrapped version of `fn. **/ - wrap(fn: Function, wrapper: (fn: Function, ...args: any[]) => any): Function; + export function wrap(fn: Function, wrapper: (fn: Function, ...args: any[]) => any): Function; /** * Returns the composition of a list of functions, where each function consumes the return value of the @@ -848,7 +847,7 @@ interface Underscore { * @param functions List of functions to compose. * @return Composition of `functions`. **/ - compose(...functions: Function[]): Function; + export function compose(...functions: Function[]): Function; /********** * Objects * @@ -859,21 +858,21 @@ interface Underscore { * @param object Retreive the key or property names from this object. * @return List of all the property names on `object`. **/ - keys(object: any): string[]; + export function keys(object: T): string[]; /** * Return all of the values of the object's properties. * @param object Retreive the values of all the properties on this object. * @return List of all the values on `object`. **/ - values(object: any): any[]; + export function values(object: T): any[]; /** * Convert an object into a list of [key, value] pairs. * @param object Convert this object to a list of [key, value] pairs. * @return List of [key, value] pairs on `object`. **/ - pairs(object: any): any[][]; + export function pairs(object: T): any[][]; /** * Returns a copy of the object where the keys have become the values and the values the keys. @@ -881,15 +880,15 @@ interface Underscore { * @param object Object to invert key/value pairs. * @return An inverted key/value paired version of `object`. **/ - invert(object: any): any; + export function invert(object: T): TResult; /** - * Returns a sorted list of the names of every method in an object � that is to say, + * Returns a sorted list of the names of every method in an object - that is to say, * the name of every function property of the object. * @param object Object to pluck all function property names from. * @return List of all the function names on `object`. **/ - functions(object: any): string[]; + export function functions(object: T): string[]; /** * Copy all of the properties in the source objects over to the destination object, and return @@ -899,7 +898,7 @@ interface Underscore { * @param sources Extends `destination` with all properties from these source objects. * @return `destination` extended with all the properties from the `sources` objects. **/ - extend(destination: any, ...sources: any[]): any; + export function extend(destination: any, ...sources: any[]): any; /** * Return a copy of the object, filtered to only have values for the whitelisted keys @@ -908,7 +907,7 @@ interface Underscore { * @keys The key/value pairs to keep on `object`. * @return Copy of `object` with only the `keys` properties. **/ - pick(object: any, ...keys: string[]): any; + export function pick(object: T, ...keys: string[]): TResult; /** * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). @@ -916,7 +915,7 @@ interface Underscore { * @param keys The key/value pairs to remove on `object`. * @return Copy of `object` without the `keys` properties. **/ - omit(object: any, ...keys: string[]): any; + export function omit(object: T, ...keys: string[]): TResult; /** * Fill in null and undefined properties in object with values from the defaults objects, @@ -925,7 +924,7 @@ interface Underscore { * @param defaults The default values to add to `object`. * @return `object` with added `defaults` values. **/ - defaults(object: any, ...defaults: any[]): any; + export function defaults(object: any, ...defaults: any[]): any; /** * Create a shallow-copied clone of the object. @@ -933,14 +932,13 @@ interface Underscore { * @param object Object to clone. * @return Copy of `object`. **/ - clone(object: any): any; + export function clone(object: T): T; /** - * Create a shallow-copied clone of the object. - * Any nested objects or arrays will be copied by reference, not duplicated. + * @see _.clone * @param list List to clone. * @return Copy of `list`. **/ - clone(list: any[]): any[]; + export function clone(list: T[]): T[]; /** * Invokes interceptor with the object, and then returns object. The primary purpose of this method @@ -949,7 +947,7 @@ interface Underscore { * @param intercepter The function to modify `object` before continuing the method chain. * @return Modified `object`. **/ - tap(object: any, intercepter: Function): any; + export function tap(object: T, intercepter: Function): T; /** * Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe @@ -958,7 +956,7 @@ interface Underscore { * @param key The key to check for on `object`. * @return True if `key` is a property on `object`, otherwise false. **/ - has(object: any, key: string): bool; + export function has(object: T, key: string): bool; /** * Performs an optimized deep comparison between the two objects, @@ -967,34 +965,34 @@ interface Underscore { * @param other Compare to `object`. * @return True if `object` is equal to `other`. **/ - isEqual(object: any, other: any): bool; + export function isEqual(object: any, other: any): bool; /** * Returns true if object contains no values. * @param object Check if this object has no properties or values. * @return True if `object` is empty. **/ - isEmpty(object: any): bool; + export function isEmpty(object: any): bool; /** * Returns true if the list contains no values. * @param object Check if this list has no elements. * @return True if `list` is empty. **/ - isEmpty(list: any[]): bool; + export function isEmpty(list: any[]): bool; /** * Returns true if object is a DOM element. * @param object Check if this object is a DOM element. * @return True if `object` is a DOM element, otherwise false. **/ - isElement(object: any): bool; + export function isElement(object: any): bool; /** * Returns true if object is an Array. * @param object Check if this object is an Array. * @return True if `object` is an Array, otherwise false. **/ - isArray(object: any): bool; + export function isArray(object: any): bool; /** * Returns true if value is an Object. Note that JavaScript arrays and functions are objects, @@ -1002,63 +1000,63 @@ interface Underscore { * @param object Check if this object is an Object. * @return True of `object` is an Object, otherwise false. **/ - isObject(object: any): bool; + export function isObject(object: any): bool; /** * Returns true if object is an Arguments object. * @param object Check if this object is an Arguments object. * @return True if `object` is an Arguments object, otherwise false. **/ - isArguments(object: any): bool; + export function isArguments(object: any): bool; /** * Returns true if object is a Function. * @param object Check if this object is a Function. * @return True if `object` is a Function, otherwise false. **/ - isFunction(object: any): bool; + export function isFunction(object: any): bool; /** * Returns true if object is a String. * @param object Check if this object is a String. * @return True if `object` is a String, otherwise false. **/ - isString(object: any): bool; + export function isString(object: any): bool; /** * Returns true if object is a Number (including NaN). * @param object Check if this object is a Number. * @return True if `object` is a Number, otherwise false. **/ - isNumber(object: any): bool; + export function isNumber(object: any): bool; /** * Returns true if object is a finite Number. * @param object Check if this object is a finite Number. * @return True if `object` is a finite Number. **/ - isFinite(object: any): bool; + export function isFinite(object: any): bool; /** * Returns true if object is either true or false. * @param object Check if this object is a bool. * @return True if `object` is a bool, otherwise false. **/ - isBoolean(object: any): bool; + export function isBoolean(object: any): bool; /** * Returns true if object is a Date. * @param object Check if this object is a Date. * @return True if `object` is a Date, otherwise false. **/ - isDate(object: any): bool; + export function isDate(object: any): bool; /** * Returns true if object is a RegExp. * @param object Check if this object is a RegExp. * @return True if `object` is a RegExp, otherwise false. **/ - isRegExp(object: any): bool; + export function isRegExp(object: any): bool; /** * Returns true if object is NaN. @@ -1067,21 +1065,21 @@ interface Underscore { * @param object Check if this object is NaN. * @return True if `object` is NaN, otherwise false. **/ - isNaN(object: any): bool; + export function isNaN(object: any): bool; /** * Returns true if the value of object is null. * @param object Check if this object is null. * @return True if `object` is null, otherwise false. **/ - isNull(object: any): bool; + export function isNull(object: any): bool; /** * Returns true if value is undefined. * @param object Check if this object is undefined. * @return True if `object` is undefined, otherwise false. **/ - isUndefined(object: any): bool; + export function isUndefined(object: any): bool; /********** * Utility * @@ -1092,7 +1090,7 @@ interface Underscore { * Returns a reference to the Underscore object. * @return Underscore object reference. **/ - noConflict(): Underscore; + export function noConflict(): any; /** * Returns the same value that is used as the argument. In math: f(x) = x @@ -1100,8 +1098,8 @@ interface Underscore { * @param value Identity of this object. * @return `value`. **/ - identity(value: any): any; - + export function identity(value: T): T; + /** * Invokes the given iterator function n times. * Each invocation of iterator is called with an index argument @@ -1109,7 +1107,7 @@ interface Underscore { * @param iterator Function iterator to invoke `n` times. * @param context `this` object in `iterator`, optional. **/ - times(n: number, iterator: (n: number) => any , context?: any): any[]; + export function times(n: number, iterator: (n: number) => TResult , context?: any): TResult[]; /** * Returns a random integer between min and max, inclusive. If you only pass one argument, @@ -1117,7 +1115,7 @@ interface Underscore { * @param max The maximum random number. * @return A random number between 0 and `max`. **/ - random(max: number): number; + export function random(max: number): number; /** * Returns a random integer between min and max, inclusive. If you only pass one argument, * it will return a number between 0 and that number. @@ -1125,7 +1123,7 @@ interface Underscore { * @param max The maximum random number. * @return A random number between `min` and `max`. **/ - random(min: number, max: number): number; + export function random(min: number, max: number): number; /** * Allows you to extend Underscore with your own utility functions. Pass a hash of @@ -1133,28 +1131,28 @@ interface Underscore { * as well as the OOP wrapper. * @param object Mixin object containing key/function pairs to add to the Underscore object. **/ - mixin(object: any): void; + export function mixin(object: any): void; /** * Generate a globally-unique id for client-side models or DOM elements that need one. * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. * @return Unique number ID. **/ - uniqueId(): number; + export function uniqueId(): number; /** * Generate a globally-unique id for client-side models or DOM elements that need one. * If prefix is passed, the id will be appended to it. Without prefix, returns an integer. * @param prefix A prefix string to start the unique ID with. * @return Unique string ID beginning with `prefix`. **/ - uniqueId(prefix: string): string; + export function uniqueId(prefix: string): string; /** * Escapes a string for insertion into HTML, replacing &, <, >, ", ', and / characters. * @param str Raw string to escape. * @return `str` HTML escaped. **/ - escape(str: string): string; + export function escape(str: string): string; /** * If the value of the named property is a function then invoke it; otherwise, return it. @@ -1162,13 +1160,13 @@ interface Underscore { * @param property The function by name to invoke on `object`. * @return The result of invoking the function `property` on `object. **/ - result(object: any, property: string): any; + export function result(object: any, property: string): any; /** * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful * for rendering complicated bits of HTML from JSON data sources. Template functions can both - * interpolate variables, using <%= � %>, as well as execute arbitrary JavaScript code, with - * <% � %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- � %> When + * interpolate variables, using <%= ... %>, as well as execute arbitrary JavaScript code, with + * <% ... %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- ... %> When * you evaluate a template function, pass in a data object that has properties corresponding to * the template's free variables. If you're writing a one-off, you can pass the data object as * the second parameter to template in order to render immediately instead of returning a template @@ -1179,13 +1177,13 @@ interface Underscore { * @param settings Settings to use while compiling. * @return Returns the compiled Underscore HTML template. **/ - template(templateString: string, data?: any, settings?: UnderscoreTemplateSettings): any; + export function template(templateString: string, data?: any, settings?: _TemplateSettings): any; /** * By default, Underscore uses ERB-style template delimiters, change the * following template settings to use alternative delimiters. **/ - templateSettings: UnderscoreTemplateSettings; + export var templateSettings: _TemplateSettings; /*********** * Chaining * @@ -1197,49 +1195,17 @@ interface Underscore { * @param obj Object to chain. * @return Wrapped `obj`. **/ - chain(obj: any): UnderscoreChain; + export function chain(obj: any): _Chain; /** * Extracts the value of a wrapped object. * @param obj Wrapped object to extract the value from. * @return Value of `obj`. **/ - value(obj: any): any; - - /************** - * OOP Wrapper * - **************/ - - /** - * Underscore OOP Wrapper, all Underscore functions that take an object - * as the first parameter can be invoked through this function. - * @param key First argument to Underscore object functions. - **/ - (obj: any): UnderscoreOOPWrapper; + export function value(obj: T): TResult; } -/** -* underscore.js template settings, set templateSettings or pass as an argument -* to 'template()' to overide defaults. -**/ -interface UnderscoreTemplateSettings { - /** - * Default value is '/<%([\s\S]+?)%>/g'. - **/ - evaluate?: RegExp; - - /** - * Default value is '/<%=([\s\S]+?)%>/g'. - **/ - interpolate?: RegExp; - - /** - * Default value is '/<%-([\s\S]+?)%>/g'. - **/ - escape?: RegExp; -} - -interface UnderscoreOOPWrapper { +declare class _ { /************** * Collections * @@ -1250,174 +1216,160 @@ interface UnderscoreOOPWrapper { * @see _.each **/ each( - iterator: (element: any, index?: number, list?: any[]) => any, + iterator: (element: T, index?: number, list?: T[]) => void, context?: any): void; /** - * Wrapped type `object`. * @see _.each **/ each( - iterator: (value: any, key?: string, object?: Object) => any, + iterator: (value: any, key?: string, object?: T) => void, context?: any): void; /** - * Alias for 'each'. - * @see each + * @see _.each **/ forEach( - iterator: (element: any, index?: number, list?: any[]) => any, + iterator: (element: T, index?: number, list?: T[]) => void , context?: any): void; /** - * Alias for 'each'. - * @see each + * @see _.each **/ forEach( - iterator: (value: any, key?: string, object?: Object) => any, + iterator: (value: any, key?: string, object?: T) => any, context?: any): void; /** * Wrapped type `any[]`. * @see _.map **/ - map( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + map( + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): TResult[]; /** - * Wrapped type `object`. * @see _.map **/ - map( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; + map( + iterator: (value: any, key?: string, object?: T) => TResult, + context?: any): TResult[]; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + collect( + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): TResult[]; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): any[]; + collect( + iterator: (value: any, key?: string, object?: T) => TResult, + context?: any): TResult[]; /** * Wrapped type `any[]`. * @see _.reduce **/ - reduce( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + reduce( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - inject( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + inject( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - foldl( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + foldl( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** * Wrapped type `any[]`. * @see _.reduceRight **/ - reduceRight( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + reduceRight( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** - * Alias for 'reduceRight'. - * @see reduceRight + * @see _.reduceRight **/ - foldr( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): any; + foldr( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): TResult; /** * Wrapped type `any[]`. * @see _.find **/ find( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T; /** - * Alias for 'find'. - * @see find + * @see _.find **/ detect( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any; - + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T; /** * Wrapped type `any[]`. * @see _.filter **/ filter( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** - * Alias for 'filter'. - * @see filter + * @see _.filter **/ select( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** * Wrapped type `any[]`. * @see _.where **/ - where(list: any[], properties: any): any[]; + where(properties: U): T[]; /** * Wrapped type `any[]`. * @see _.findWhere **/ - findWhere(properties: any): any; + findWhere(properties: U): T; /** * Wrapped type `any[]`. * @see _.reject **/ reject( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): any[]; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): T[]; /** * Wrapped type `any[]`. * @see _.all **/ all( - iterator: (element: any, index?: number, list?: any[]) => bool, + iterator: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** - * Alias for 'all'. - * @see all + * @see _.all **/ every( - iterator: (element: any, index?: number, list?: any[]) => bool, + iterator: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** @@ -1425,17 +1377,14 @@ interface UnderscoreOOPWrapper { * @see _.any **/ any( - list: any[], - iterator?: (element: any, index?: number, list?: any[]) => bool, + iterator?: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** - * Alias for 'any'. - * @see any + * @see _.any **/ some( - list: any[], - iterator: (element: any, index?: number, list?: any[]) => bool, + iterator: (element: T, index?: number, list?: T[]) => bool, context?: any): bool; /** @@ -1472,8 +1421,8 @@ interface UnderscoreOOPWrapper { * @see _.max **/ max( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): any; + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): T; /** * Wrapped type `number[]`. @@ -1485,45 +1434,46 @@ interface UnderscoreOOPWrapper { * @see _.min **/ min( - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): any; + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): T; /** * Wrapped type `any[]`. * @see _.sortBy **/ - sortBy( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + sortBy( + iterator: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** * Wrapped type `any[]`. * @see _.sortBy **/ sortBy( iterator: string, - context?: any): any[]; + context?: any): T[]; + + /** + * Wrapped type `any[]`. + * @see _.groupBy + **/ + groupBy( + iterator: (element: any, index?: number, list?: any[]) => TSort, + context?: any): { [key: string]: T[]; }; /** * Wrapped type `any[]`. * @see _.groupBy **/ - groupBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): { [key: string]: any[]; }; - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ groupBy( iterator: string, - context?: any): { [key: string]: any[]; }; + context?: any): { [key: string]: T[]; }; /** * Wrapped type `any[]`. * @see _.countBy **/ countBy( - iterator: (element: any, index?: number, list?: any[]) => string, + iterator: (element: T, index?: number, list?: T[]) => string, context?: any): { [key: string]: number; }; /** * Wrapped type `any[]`. @@ -1537,13 +1487,13 @@ interface UnderscoreOOPWrapper { * Wrapped type `any[]`. * @see _.shuffle **/ - shuffle(): any[]; + shuffle(): T[]; /** * Wrapped type `any`. * @see _.toArray **/ - toArray(): any[]; + toArray(): T[]; /** * Wrapped type `any`. @@ -1559,75 +1509,69 @@ interface UnderscoreOOPWrapper { * Wrapped type `any[]`. * @see _.first **/ - first(): any; + first(): T; /** * Wrapped type `any[]`. * @see _.first **/ - first(n: number): any[]; + first(n: number): T[]; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(): any; + head(): T; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(n: number): any[]; + head(n: number): T[]; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(): any; + take(): T; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(n: number): any[]; + take(n: number): T[]; /** * Wrapped type `any[]`. * @see _.initial **/ - initial(n?: number): any[]; + initial(n?: number): T[]; /** * Wrapped type `any[]`. * @see _.last **/ - last(): any; + last(): T; /** * Wrapped type `any[]`. * @see _.last **/ - last(n: number): any[]; + last(n: number): T[]; /** * Wrapped type `any[]`. * @see _.rest **/ - rest(index?: number): any[]; + rest(index?: number): T[]; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - tail(index?: number): any[]; + tail(index?: number): T[]; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - drop(index?: number): any[]; + drop(index?: number): T[]; /** * Wrapped type `any[]`. * @see _.compact **/ - compact(): any[]; + compact(): T[]; /** * Wrapped type `any`. @@ -1639,49 +1583,55 @@ interface UnderscoreOOPWrapper { * Wrapped type `any[]`. * @see _.without **/ - without(...values: any[]): any[]; + without(...values: T[]): T[]; /** * Wrapped type `any[][]`. * @see _.union **/ - union(...arrays: any[][]): any[]; + union(...arrays: T[][]): T[]; /** * Wrapped type `any[][]`. * @see _.intersection **/ - intersection(...arrays: any[][]): any[]; + intersection(...arrays: T[][]): T[]; /** * Wrapped type `any[]`. * @see _.difference **/ - difference(...others: any[]): any[]; + difference(...others: T[][]): T[]; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq( + uniq( isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq( - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): any[]; + uniq( + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** - * Alias for 'uniq'. - * @see uniq + * @see _.uniq **/ - unique( + unique( isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): any[]; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; + /** + * @see _.uniq + **/ + unique( + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): T[]; /** * Wrapped type `any[][]`. @@ -1699,19 +1649,19 @@ interface UnderscoreOOPWrapper { * Wrapped type `any[]`. * @see _.indexOf **/ - indexOf(value: any, isSorted?: bool): number; + indexOf(value: T, isSorted?: bool): number; /** * Wrapped type `any[]`. * @see _.lastIndexOf **/ - lastIndexOf(value: any, from?: number): number; + lastIndexOf(value: T, from?: number): number; /** * Wrapped type `any[]`. * @see _.sortedIndex **/ - sortedIndex(value: any, iterator?: (element: any) => number): number; + sortedIndex(value: T, iterator?: (element: T) => number): number; /** * Wrapped type `number`. @@ -1863,12 +1813,12 @@ interface UnderscoreOOPWrapper { * Wrapped type `object`. * @see _.clone **/ - clone(object: any): any; + clone(object: T): T; /** * Wrapped type `any[]`. * @see _.clone **/ - clone(list: any[]): any[]; + clone(list: T[]): T[]; /** * Wrapped type `object`. @@ -1897,7 +1847,7 @@ interface UnderscoreOOPWrapper { * Wrapped type `any[]`. * @see _.isEmpty **/ - isEmpty(list: any[]): bool; + isEmpty(): bool; /** * Wrapped type `object`. @@ -1997,7 +1947,7 @@ interface UnderscoreOOPWrapper { * Wrapped type `number`. * @see _.times **/ - times(iterator: (n: number) => any, context?: any): any[]; + times(iterator: (n: number) => TResult, context?: any): TResult[]; /** * Wrapped type `number`. @@ -2038,7 +1988,7 @@ interface UnderscoreOOPWrapper { * Wrapped type `string`. * @see _.template **/ - template(data?: any, settings?: UnderscoreTemplateSettings): any; + template(data?: any, settings?: _._TemplateSettings): any; /*********** * Chaining * @@ -2048,16 +1998,16 @@ interface UnderscoreOOPWrapper { * Wrapped type `any`. * @see _.chain **/ - chain(): UnderscoreChain; + chain(): _Chain; /** * Wrapped type `any`. * @see _.value **/ - value(): any; + value(): TResult; } -interface UnderscoreChain { +interface _Chain { /************** * Collections * @@ -2068,303 +2018,290 @@ interface UnderscoreChain { * @see _.each **/ each( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => void , + context?: any): _Chain; /** - * Wrapped type `object`. * @see _.each **/ each( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): UnderscoreChain; + iterator: (value: any, key?: string, object?: T) => void , + context?: any): _Chain; /** - * Alias for 'each'. - * @see each + * @see _.each **/ forEach( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => void , + context?: any): _Chain; /** - * Alias for 'each'. - * @see each + * @see _.each **/ forEach( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): UnderscoreChain; + iterator: (value: any, key?: string, object?: T) => any, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.map **/ - map( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + map( + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): _Chain; /** - * Wrapped type `object`. * @see _.map **/ - map( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): UnderscoreChain; + map( + iterator: (value: any, key?: string, object?: T) => TResult, + context?: any): _Chain; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + collect( + iterator: (element: T, index?: number, list?: T[]) => TResult, + context?: any): _Chain; /** - * Alias for 'map'. - * @see map + * @see _.map **/ - collect( - iterator: (value: any, key?: string, object?: Object) => any, - context?: any): UnderscoreChain; + collect( + iterator: (value: any, key?: string, object?: T) => TResult, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.reduce **/ - reduce( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): UnderscoreChain; + reduce( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): _Chain; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - inject( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): UnderscoreChain; + inject( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): _Chain; /** - * Alias for 'reduce'. - * @see reduce + * @see _.reduce **/ - foldl( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): UnderscoreChain; + foldl( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.reduceRight **/ - reduceRight( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): UnderscoreChain; + reduceRight( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): _Chain; /** - * Alias for 'reduceRight'. - * @see reduceRight + * @see _.reduceRight **/ - foldr( - iterator: (memo: any, element: any, index?: number, list?: any[]) => any, - memo: any, - context?: any): UnderscoreChain; + foldr( + iterator: (memo: TResult, element: T, index?: number, list?: T[]) => TResult, + memo: TResult, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.find **/ find( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** - * Alias for 'find'. - * @see find + * @see _.find **/ detect( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; - + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.filter **/ filter( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** - * Alias for 'filter'. - * @see filter + * @see _.filter **/ select( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.where **/ - where(properties: any): UnderscoreChain; + where(properties: U): _Chain; /** * Wrapped type `any[]`. * @see _.findWhere **/ - findWhere(properties: any): UnderscoreChain; + findWhere(properties: U): _Chain; /** * Wrapped type `any[]`. * @see _.reject **/ reject( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.all **/ all( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** - * Alias for 'all'. - * @see all + * @see _.all **/ every( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.any **/ any( - iterator?: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator?: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** - * Alias for 'any'. - * @see any + * @see _.any **/ some( - iterator: (element: any, index?: number, list?: any[]) => bool, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => bool, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.contains **/ - contains(value: any): UnderscoreChain; + contains(value: any): _Chain; /** * Alias for 'contains'. * @see contains **/ - include(value: any): UnderscoreChain; + include(value: any): _Chain; /** * Wrapped type `any[]`. * @see _.invoke **/ - invoke(methodName: string, ...arguments: any[]): UnderscoreChain; + invoke(methodName: string, ...arguments: any[]): _Chain; /** * Wrapped type `any[]`. * @see _.pluck **/ - pluck(propertyName: string): UnderscoreChain; + pluck(propertyName: string): _Chain; /** * Wrapped type `number[]`. * @see _.max **/ - max(): UnderscoreChain; + max(): _Chain; /** * Wrapped type `any[]`. * @see _.max **/ max( - iterator: (element: any, index?: number, list?: any[]) => number, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): _Chain; /** * Wrapped type `number[]`. * @see _.min **/ - min(): UnderscoreChain; + min(): _Chain; /** * Wrapped type `any[]`. * @see _.min **/ min( - iterator: (obj: any, index?: number, list?: any[]) => number, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => number, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.sortBy **/ - sortBy( - iterator: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + sortBy( + iterator: (element: T, index?: number, list?: T[]) => TSort, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.sortBy **/ sortBy( iterator: string, - context?: any): UnderscoreChain; + context?: any): _Chain; + + /** + * Wrapped type `any[]`. + * @see _.groupBy + **/ + groupBy( + iterator: (element: any, index?: number, list?: any[]) => TSort, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.groupBy **/ - groupBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): UnderscoreChain; - /** - * Wrapped type `any[]`. - * @see _.groupBy - **/ groupBy( iterator: string, - context?: any): UnderscoreChain; + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.countBy **/ countBy( - iterator: (element: any, index?: number, list?: any[]) => string, - context?: any): UnderscoreChain; + iterator: (element: T, index?: number, list?: T[]) => string, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.countBy **/ countBy( iterator: string, - context?: any): UnderscoreChain; + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.shuffle **/ - shuffle(): UnderscoreChain; + shuffle(): _Chain; /** * Wrapped type `any`. * @see _.toArray **/ - toArray(): UnderscoreChain; + toArray(): _Chain; /** * Wrapped type `any`. * @see _.size **/ - size(): UnderscoreChain; + size(): _Chain; /********* * Arrays * @@ -2374,170 +2311,170 @@ interface UnderscoreChain { * Wrapped type `any[]`. * @see _.first **/ - first(): UnderscoreChain; + first(): _Chain; /** * Wrapped type `any[]`. * @see _.first **/ - first(n: number): UnderscoreChain; + first(n: number): _Chain; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(): UnderscoreChain; + head(): _Chain; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - head(n: number): UnderscoreChain; + head(n: number): _Chain; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(): UnderscoreChain; + take(): _Chain; /** - * Alias for 'first'. - * @see first + * @see _.first **/ - take(n: number): UnderscoreChain; + take(n: number): _Chain; /** * Wrapped type `any[]`. * @see _.initial **/ - initial(n?: number): UnderscoreChain; + initial(n?: number): _Chain; /** * Wrapped type `any[]`. * @see _.last **/ - last(): UnderscoreChain; + last(): _Chain; /** * Wrapped type `any[]`. * @see _.last **/ - last(n: number): UnderscoreChain; + last(n: number): _Chain; /** * Wrapped type `any[]`. * @see _.rest **/ - rest(index?: number): UnderscoreChain; + rest(index?: number): _Chain; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - tail(index?: number): UnderscoreChain; + tail(index?: number): _Chain; /** - * Alias for 'rest'. - * @see rest + * @see _.rest **/ - drop(index?: number): UnderscoreChain; + drop(index?: number): _Chain; /** * Wrapped type `any[]`. * @see _.compact **/ - compact(): UnderscoreChain; + compact(): _Chain; /** * Wrapped type `any`. * @see _.flatten **/ - flatten(shallow?: bool): UnderscoreChain; + flatten(shallow?: bool): _Chain; /** * Wrapped type `any[]`. * @see _.without **/ - without(...values: any[]): UnderscoreChain; + without(...values: T[]): _Chain; /** * Wrapped type `any[][]`. * @see _.union **/ - union(...arrays: any[][]): UnderscoreChain; + union(...arrays: T[][]): _Chain; /** * Wrapped type `any[][]`. * @see _.intersection **/ - intersection(...arrays: any[][]): UnderscoreChain; + intersection(...arrays: T[][]): _Chain; /** * Wrapped type `any[]`. * @see _.difference **/ - difference(...others: any[]): UnderscoreChain; + difference(...others: T[][]): _Chain; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq( + uniq( isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq( - iterator?: (element: any, index?: number, list?: any[]) => any, - context?: any): UnderscoreChain; + uniq( + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): _Chain; /** - * Alias for 'uniq'. - * @see uniq + * @see _.uniq **/ - unique( + unique( isSorted?: bool, - iterator?: (element: any, index?: number, list?: any[]) => any): UnderscoreChain; + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): _Chain; + /** + * @see _.uniq + **/ + unique( + iterator?: (element: T, index?: number, list?: T[]) => TSort, + context?: any): _Chain; /** * Wrapped type `any[][]`. * @see _.zip **/ - zip(...arrays: any[][]): UnderscoreChain; + zip(...arrays: any[][]): _Chain; /** * Wrapped type `any[][]`. * @see _.object **/ - object(...keyValuePairs: any[][]): UnderscoreChain; + object(...keyValuePairs: any[][]): _Chain; /** * Wrapped type `any[]`. * @see _.indexOf **/ - indexOf(value: any, isSorted?: bool): UnderscoreChain; + indexOf(value: T, isSorted?: bool): _Chain; /** * Wrapped type `any[]`. * @see _.lastIndexOf **/ - lastIndexOf(value: any, from?: number): UnderscoreChain; + lastIndexOf(value: T, from?: number): _Chain; /** * Wrapped type `any[]`. * @see _.sortedIndex **/ - sortedIndex(value: any, iterator?: (element: any) => number): UnderscoreChain; + sortedIndex(value: T, iterator?: (element: T) => number): _Chain; /** * Wrapped type `number`. * @see _.range **/ - range(stop: number, step?: number): UnderscoreChain; + range(stop: number, step?: number): _Chain; /** * Wrapped type `number`. * @see _.range **/ - range(): UnderscoreChain; + range(): _Chain; /************ * Functions * @@ -2547,74 +2484,74 @@ interface UnderscoreChain { * Wrapped type `Function`. * @see _.bind **/ - bind(object: any, ...arguments: any[]): UnderscoreChain; + bind(object: any, ...arguments: any[]): _Chain; /** * Wrapped type `object`. * @see _.bindAll **/ - bindAll(...methodNames: string[]): UnderscoreChain; + bindAll(...methodNames: string[]): _Chain; /** * Wrapped type `Function`. * @see _.partial **/ - partial(...arguments: any[]): UnderscoreChain; + partial(...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.memoize **/ - memoize(hashFn?: (n: any) => string): UnderscoreChain; + memoize(hashFn?: (n: any) => string): _Chain; /** * Wrapped type `Function`. * @see _.delay **/ - delay(waitMS: number, ...arguments: any[]): UnderscoreChain; + delay(waitMS: number, ...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.defer **/ - defer(...arguments: any[]): UnderscoreChain; + defer(...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.throttle **/ - throttle(waitMS: number): UnderscoreChain; + throttle(waitMS: number): _Chain; /** * Wrapped type `Function`. * @see _.debounce **/ - debounce(waitMS: number, immediate?: bool): UnderscoreChain; + debounce(waitMS: number, immediate?: bool): _Chain; /** * Wrapped type `Function`. * @see _.once **/ - once(): UnderscoreChain; + once(): _Chain; /** * Wrapped type `number`. * @see _.after **/ - after(fn: Function): UnderscoreChain; + after(fn: Function): _Chain; /** * Wrapped type `Function`. * @see _.wrap **/ - wrap(wrapper: (fn: Function, ...args: any[]) => any): UnderscoreChain; + wrap(wrapper: (fn: Function, ...args: any[]) => any): _Chain; /** * Wrapped type `Function[]`. * @see _.compose **/ - compose(...functions: Function[]): UnderscoreChain; + compose(...functions: Function[]): _Chain; /********** * Objects * @@ -2624,179 +2561,179 @@ interface UnderscoreChain { * Wrapped type `object`. * @see _.keys **/ - keys(): UnderscoreChain; + keys(): _Chain; /** * Wrapped type `object`. * @see _.values **/ - values(): UnderscoreChain; + values(): _Chain; /** * Wrapped type `object`. * @see _.pairs **/ - pairs(): UnderscoreChain; + pairs(): _Chain; /** * Wrapped type `object`. * @see _.invert **/ - invert(): UnderscoreChain; + invert(): _Chain; /** * Wrapped type `object`. * @see _.functions **/ - functions(): UnderscoreChain; + functions(): _Chain; /** * Wrapped type `object`. * @see _.extend **/ - extend(...sources: any[]): UnderscoreChain; + extend(...sources: any[]): _Chain; /** * Wrapped type `object`. * @see _.pick **/ - pick(...keys: string[]): UnderscoreChain; + pick(...keys: string[]): _Chain; /** * Wrapped type `object`. * @see _.omit **/ - omit(...keys: string[]): UnderscoreChain; + omit(...keys: string[]): _Chain; /** * Wrapped type `object`. * @see _.defaults **/ - defaults(...defaults: any[]): UnderscoreChain; + defaults(...defaults: any[]): _Chain; /** * Wrapped type `object`. * @see _.clone **/ - clone(object: any): UnderscoreChain; + clone(object: T): _Chain; /** * Wrapped type `any[]`. * @see _.clone **/ - clone(list: any[]): UnderscoreChain; + clone(list: T[]): _Chain; /** * Wrapped type `object`. * @see _.tap **/ - tap(intercepter: Function): UnderscoreChain; + tap(intercepter: Function): _Chain; /** * Wrapped type `object`. * @see _.has **/ - has(key: string): UnderscoreChain; + has(key: string): _Chain; /** * Wrapped type `object`. * @see _.isEqual **/ - isEqual(other: any): UnderscoreChain; + isEqual(other: any): _Chain; /** * Wrapped type `object`. * @see _.isEmpty **/ - isEmpty(object: any): UnderscoreChain; + isEmpty(object: any): _Chain; /** * Wrapped type `any[]`. * @see _.isEmpty **/ - isEmpty(): UnderscoreChain; + isEmpty(): _Chain; /** * Wrapped type `object`. * @see _.isElement **/ - isElement(): UnderscoreChain; + isElement(): _Chain; /** * Wrapped type `object`. * @see _.isArray **/ - isArray(): UnderscoreChain; + isArray(): _Chain; /** * Wrapped type `object`. * @see _.isObject **/ - isObject(): UnderscoreChain; + isObject(): _Chain; /** * Wrapped type `object`. * @see _.isArguments **/ - isArguments(): UnderscoreChain; + isArguments(): _Chain; /** * Wrapped type `object`. * @see _.isFunction **/ - isFunction(): UnderscoreChain; + isFunction(): _Chain; /** * Wrapped type `object`. * @see _.isString **/ - isString(): UnderscoreChain; + isString(): _Chain; /** * Wrapped type `object`. * @see _.isNumber **/ - isNumber(): UnderscoreChain; + isNumber(): _Chain; /** * Wrapped type `object`. * @see _.isFinite **/ - isFinite(): UnderscoreChain; + isFinite(): _Chain; /** * Wrapped type `object`. * @see _.isBoolean **/ - isBoolean(): UnderscoreChain; + isBoolean(): _Chain; /** * Wrapped type `object`. * @see _.isDate **/ - isDate(): UnderscoreChain; + isDate(): _Chain; /** * Wrapped type `object`. * @see _.isRegExp **/ - isRegExp(): UnderscoreChain; + isRegExp(): _Chain; /** * Wrapped type `object`. * @see _.isNaN **/ - isNaN(): UnderscoreChain; + isNaN(): _Chain; /** * Wrapped type `object`. * @see _.isNull **/ - isNull(): UnderscoreChain; + isNull(): _Chain; /** * Wrapped type `object`. * @see _.isUndefined **/ - isUndefined(): UnderscoreChain; + isUndefined(): _Chain; /********** * Utility * @@ -2806,54 +2743,54 @@ interface UnderscoreChain { * Wrapped type `any`. * @see _.identity **/ - identity(): UnderscoreChain; + identity(): _Chain; /** * Wrapped type `number`. * @see _.times **/ - times(iterator: (n: number) => any, context?: any): UnderscoreChain; + times(iterator: (n: number) => TResult, context?: any): _Chain; /** * Wrapped type `number`. * @see _.random **/ - random(): UnderscoreChain; + random(): _Chain; /** * Wrapped type `number`. * @see _.random **/ - random(max: number): UnderscoreChain; + random(max: number): _Chain; /** * Wrapped type `object`. * @see _.mixin **/ - mixin(): UnderscoreChain; + mixin(): _Chain; /** * Wrapped type `string`. * @see _.uniqueId **/ - uniqueId(): UnderscoreChain; + uniqueId(): _Chain; /** * Wrapped type `string`. * @see _.escape **/ - escape(): UnderscoreChain; + escape(): _Chain; /** * Wrapped type `object`. * @see _.result **/ - result(property: string): UnderscoreChain; + result(property: string): _Chain; /** * Wrapped type `string`. * @see _.template **/ - template(data?: any, settings?: UnderscoreTemplateSettings): UnderscoreChain; + template(data?: any, settings?: _._TemplateSettings): _Chain; /*********** * Chaining * @@ -2863,13 +2800,15 @@ interface UnderscoreChain { * Wrapped type `any`. * @see _.chain **/ - chain(): UnderscoreChain; + chain(): _Chain; /** * Wrapped type `any`. * @see _.value **/ - value(): any; + value(): TResult; } -declare var _: Underscore; +declare module "underscore" { + export = _; +}