From b0d6f6912e84aeac8832add9f58d0e084506360a Mon Sep 17 00:00:00 2001 From: Adam Hewitt Date: Sat, 4 Jan 2014 11:56:15 -0800 Subject: [PATCH 01/17] work to extend the definitions for WinJS and WinRT --- winjs/winjs.d.ts | 155 ++++++++++++++++++++++++++++++++++++----------- winrt/winrt.d.ts | 42 ++++++++----- 2 files changed, 147 insertions(+), 50 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index cba248b44..9a120d052 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -15,37 +15,55 @@ and limitations under the License. declare module WinJS { function strictProcessing(): void; + + export module Application { + export var onsettings: EventListener; + } + module Binding { function as(data: any): any; - class List { - constructor(data?: any[]); - public push(item: any): any; - public indexOf(item: any): number; - public splice(start: number, howMany?: number, item?: any[]): any[]; - public createFiltered(predicate: (x: any) => boolean): List; - public createGrouped(keySelector: (x: any) => any, dataSelector: (x:any) => any, groupSorter: (left:any, right:any) => number): List; - public groups: any; + function processAll(rootElement?: any, dataContext?: any, skipRoot?: boolean, bindingCache?: any): any; + function define(data: any): any; + function expandProperties(data: any): any; + function converter(method: any): any; + + export var optimizeBindingReferences: boolean; + export var mixin; + export var bind; + export var oneTime; + + export function initializer(customInit): any; + export var setAttribute; + + class List { + constructor(data?: T[], options?: { binding: boolean; proxy: boolean; }); + public push(item: T): number; + public indexOf(item: T, fromIndex?: number): number; + public splice(start: number, howMany?: number, ...items: T[]): T[]; + public createFiltered(predicate: (x: T) => boolean): List; + public createGrouped(keySelector: (x: T) => string, dataSelector: (x:T) => U, groupSorter: (left:string, right:string) => number): List; + public createSorted(sorter: (left:T, right:T) => number); + public groups: List; public dataSource: any; - public getAt(index: number): any; - public createSorted(sorter: (left, right) => number); - public forEach(callback: (val: any, index: number, array: any[]) => void, thisArg?: any); - public every(callback: (val: any, index: number, array: any[]) => boolean, thisArg?: any): boolean; + public getAt(index: number): T; + public forEach(callback: (val: T, index: number, array: T[]) => void, thisArg?: any); + public every(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; public join(separator: string): string; - public map(callback: (val: any, index: number, array: any[]) => any, thisArg?: any): any[]; + public map(callback: (val: T, index: number, array: T[]) => U, thisArg?: any): U[]; public move(index: number, newIndex: number); - public pop(): any; + public pop(): T; public reduce(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; public reduceRight(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; public reverse(); - public setAt(index: number, newValue: number); - public shift(): any; - public slice(begin: number, end: number): WinJS.Binding.List; - public some(callback: (val: any, index: number, array: any[]) => boolean, thisArg?: any): boolean; - public sort(sortFunction: (left, right) => number); - public unshift(value: any): number; + public setAt(index: number, newValue: T); + public shift(): T; + public slice(begin: number, end: number): List; + public some(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + public sort(sortFunction: (left: T, right: T) => number); + public filter(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + public unshift(value: T): number; public length: number; - public notifyMutated(index: number); - + public notifyMutated(index: number); } class Template { public element: HTMLElement; @@ -73,7 +91,7 @@ declare module WinJS { module Class { function define(constructor: any, instanceMembers: any): any; function derive(baseClass: any, constructor: any, instanceMembers: any): any; - function mix(constructor: any, mixin: any): any; + function mix(constructor: any, ...mixin: any[]): any; } function xhr(options: { type?: string; url?: string; user?: string; password?: string; headers?: any; data?: any; responseType?: string; }): WinJS.Promise; module Application { @@ -100,15 +118,21 @@ declare module WinJS { class ErrorFromName { constructor(name: string, message?: string); } - class Promise { + class Promise implements Windows.Foundation.IPromise { constructor(init: (c: any, e: any, p: any) => void); - then(success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void ): Promise; - then(success?: (value: T) => Promise, error?: (error: any) => U, progress?: (progress: any) => void ): Promise; - then(success?: (value: T) => U, error?: (error: any) => Promise, progress?: (progress: any) => void ): Promise; - then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Promise; + then(success?: (value: T) => Windows.Foundation.IPromise, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: (value: T) => Windows.Foundation.IPromise, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; done(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; - static join: any; - static timeout: any; + + cancel(): void; + + static join(values: any[]): Promise; + static timeout(timeout: number): Promise; + static as(): Promise; + static as(obj: U): Promise; + static wrapError(obj: U): Promise; } module Navigation { var history: any; @@ -126,9 +150,23 @@ declare module WinJS { var onnavigated: CustomEvent; var onnavigating: CustomEvent; } + + export module Resources { + export var processAll: (element?: HTMLElement) => void; + export var getString: (id: string) => { value: string; empty?: boolean; lang?: string; }; + export var addEventListener: (id: string, handler: EventListener, useCapture?: boolean) => void; + } + module Utilities { - function markSupportedForProcessing(obj: any): void; - enum Key { + function markSupportedForProcessing(obj: T): T; + function createEventProperties(...events: string[]): any; + + export function addClass(element: HTMLElement, className: string): void; + export function removeClass(element: HTMLElement, className: string): void; + + export function hasClass(element: HTMLElement, className: string): boolean; + + enum Key { backspace, tab, enter, @@ -235,9 +273,58 @@ declare module WinJS { var ListLayout: any; var GridLayout: any; var Pages: any; - var Menu: any; - var setOptions: any; + var setOptions: any; + + export var Animation: any; + + var DOMEventMixin: any; + + class Flyout { + constructor(element: HTMLElement, options); + element: Element; + } + + module Fragments { + var renderCopy: any; + } + + export class HtmlControl { + constructor(element: HTMLElement, options: { uri: string; }); + } + + interface IItem { + data: any; + } + + interface ISelection { + clear(): WinJS.Promise; + count(); + getItems(): WinJS.Promise; + } + + class ListView { + element: Element; + elementFromIndex(index: number); + indexOfElement(element: Element); + selection: ISelection; + } + + class Menu { + constructor(element: HTMLElement, options); + element: Element; + } + + export class MenuCommand { + constructor(element: HTMLElement, options); + } + + export class SettingsFlyout { + static populateSettings(e: any): any; + static showSettings(id: string, path: any): any; + } } + + export function xhr(options: { type: string; url: string; }): WinJS.Promise; // user: string; password: string; headers: any; data: any; responseType: string; } interface Element { diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 11f1dba86..86d6d635d 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -496,6 +496,14 @@ declare module Windows { close(): void; } export interface IAsyncAction extends Windows.Foundation.IAsyncInfo { + then(success?: () => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: () => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + then(success?: () => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; + then(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; + done? (success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void; + + cancel(); + completed: Windows.Foundation.AsyncActionCompletedHandler; getResults(): void; } @@ -521,7 +529,7 @@ declare module Windows { export interface AsyncActionWithProgressCompletedHandler { (asyncInfo: Windows.Foundation.IAsyncActionWithProgress, asyncStatus: Windows.Foundation.AsyncStatus): void; } - export interface IAsyncActionWithProgress extends Windows.Foundation.IAsyncInfo { + export interface IAsyncActionWithProgress extends Windows.Foundation.IAsyncInfo, Windows.Foundation.IPromise { progress: Windows.Foundation.AsyncActionProgressHandler; completed: Windows.Foundation.AsyncActionWithProgressCompletedHandler; getResults(): void; @@ -3301,11 +3309,11 @@ declare module Windows { getResults(): void; cancel(): void; close(): void; - then(success: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => Windows.Foundation.IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => U, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => Windows.Foundation.IPromise, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - done(success: (value: any) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; + then(success?: () => Windows.Foundation.IPromise, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => Windows.Foundation.IPromise, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => U, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; + done(success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void ; operation: { completed: Windows.Foundation.AsyncOperationCompletedHandler; getResults(): any; @@ -8385,11 +8393,11 @@ declare module Windows { getResults(): void; cancel(): void; close(): void; - then(success: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => Windows.Foundation.IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => U, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success: (value: any) => Windows.Foundation.IPromise, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - done(success: (value: any) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; + then(success?: () => Windows.Foundation.IPromise, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => Windows.Foundation.IPromise, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => U, error?: (error: any) => Windows.Foundation.IPromise, progress?: (progress: any) => void): Windows.Foundation.IPromise; + then(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): Windows.Foundation.IPromise; + done(success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void; operation: { completed: Windows.Foundation.AsyncOperationCompletedHandler; getResults(): any; @@ -14635,10 +14643,12 @@ declare module Windows { } declare module Windows.Foundation { export interface IPromise { - then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Windows.Foundation.IPromise; - done?(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void; + then(success?: (value: T) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void ): IPromise; + then(success?: (value: T) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise; + then(success?: (value: T) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void ): IPromise; + then(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): IPromise; + done?(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; + + cancel(): void; } } From 556523ad40ce9232f7bcb7f9c02a3868a285db5e Mon Sep 17 00:00:00 2001 From: Adam Hewitt Date: Sat, 4 Jan 2014 12:51:36 -0800 Subject: [PATCH 02/17] work so it will still compile if implicit any is turned off --- winjs/winjs.d.ts | 44 ++++++++++++++++++++++---------------------- winrt/winrt.d.ts | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 9a120d052..e91a8548e 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -28,12 +28,12 @@ declare module WinJS { function converter(method: any): any; export var optimizeBindingReferences: boolean; - export var mixin; - export var bind; - export var oneTime; + export var mixin: any; + export var bind: any; + export var oneTime: any; - export function initializer(customInit): any; - export var setAttribute; + export function initializer(customInit: any): any; + export var setAttribute: any; class List { constructor(data?: T[], options?: { binding: boolean; proxy: boolean; }); @@ -41,29 +41,29 @@ declare module WinJS { public indexOf(item: T, fromIndex?: number): number; public splice(start: number, howMany?: number, ...items: T[]): T[]; public createFiltered(predicate: (x: T) => boolean): List; - public createGrouped(keySelector: (x: T) => string, dataSelector: (x:T) => U, groupSorter: (left:string, right:string) => number): List; - public createSorted(sorter: (left:T, right:T) => number); + public createGrouped(keySelector: (x: T) => string, dataSelector: (x:T) => U, groupSorter?: (left:string, right:string) => number): List; + public createSorted(sorter: (left:T, right:T) => number): List; public groups: List; public dataSource: any; public getAt(index: number): T; - public forEach(callback: (val: T, index: number, array: T[]) => void, thisArg?: any); + public forEach(callback: (val: T, index: number, array: T[]) => void, thisArg?: any): void; public every(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; public join(separator: string): string; public map(callback: (val: T, index: number, array: T[]) => U, thisArg?: any): U[]; - public move(index: number, newIndex: number); + public move(index: number, newIndex: number): void; public pop(): T; public reduce(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; public reduceRight(callback: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; - public reverse(); - public setAt(index: number, newValue: T); + public reverse(): void; + public setAt(index: number, newValue: T): void; public shift(): T; public slice(begin: number, end: number): List; public some(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - public sort(sortFunction: (left: T, right: T) => number); + public sort(sortFunction: (left: T, right: T) => number): void; public filter(callback: (val: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; public unshift(value: T): number; public length: number; - public notifyMutated(index: number); + public notifyMutated(index: number): void; } class Template { public element: HTMLElement; @@ -79,7 +79,7 @@ declare module WinJS { (dataContext: any, container?: HTMLElement): WinJS.Promise; value(href: string, dataContext: any, container?: HTMLElement): WinJS.Promise; }; - public renderItem(item: any, recycled?: HTMLElement); + public renderItem(item: any, recycled?: HTMLElement): void; } @@ -143,8 +143,8 @@ declare module WinJS { function addEventListener(type: string, listener: EventListener, capture: boolean): void; function back(): void; function forward(): void; - function navigate(location: any, initialState: any); - function navigate(location: any); + function navigate(location: any, initialState: any): WinJS.Promise; + function navigate(location: any): WinJS.Promise; function removeEventListener(type: string, listener: EventListener, capture: boolean): void; var onbeforenavigate: CustomEvent; var onnavigated: CustomEvent; @@ -280,7 +280,7 @@ declare module WinJS { var DOMEventMixin: any; class Flyout { - constructor(element: HTMLElement, options); + constructor(element: HTMLElement, options: any); element: Element; } @@ -298,24 +298,24 @@ declare module WinJS { interface ISelection { clear(): WinJS.Promise; - count(); + count(): number; getItems(): WinJS.Promise; } class ListView { element: Element; - elementFromIndex(index: number); - indexOfElement(element: Element); + elementFromIndex(index: number): Element; + indexOfElement(element: Element): number; selection: ISelection; } class Menu { - constructor(element: HTMLElement, options); + constructor(element: HTMLElement, options: any); element: Element; } export class MenuCommand { - constructor(element: HTMLElement, options); + constructor(element: HTMLElement, options: any); } export class SettingsFlyout { diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 86d6d635d..881b64ed3 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -502,7 +502,7 @@ declare module Windows { then(success?: () => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; done? (success?: () => any, error?: (error: any) => any, progress?: (progress: any) => void): void; - cancel(); + cancel(): void; completed: Windows.Foundation.AsyncActionCompletedHandler; getResults(): void; From aea6e0dab3ed05d2ba1bfb33d67c838c8b6dd4a8 Mon Sep 17 00:00:00 2001 From: jraymakers Date: Tue, 7 Jan 2014 15:59:44 -0800 Subject: [PATCH 03/17] support optional scope on ITemplateLinkingFunction --- angularjs/angular.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 875abc754..5bfde41e9 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -537,9 +537,15 @@ declare module ng { directive(directivesMap: any): ICompileProvider; } - interface ITemplateLinkingFunction { + interface ICloneAttachFunction { // Let's hint but not force cloneAttachFn's signature - (scope: IScope, cloneAttachFn?: (clonedElement?: JQuery, scope?: IScope) => any): JQuery; + (clonedElement?: JQuery, scope?: IScope): any + } + + interface ITemplateLinkingFunction { + (scope: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery; + // scope argument is optional + (cloneAttachFn?: ICloneAttachFunction): JQuery; } /////////////////////////////////////////////////////////////////////////// From 3a82c7c52c606043d05a2bb72a20fc4596dc72a3 Mon Sep 17 00:00:00 2001 From: jraymakers Date: Tue, 7 Jan 2014 18:24:52 -0800 Subject: [PATCH 04/17] add ? to scope in ITemplateLinkingFunction --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 5bfde41e9..79134e433 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -543,7 +543,7 @@ declare module ng { } interface ITemplateLinkingFunction { - (scope: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery; + (scope?: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery; // scope argument is optional (cloneAttachFn?: ICloneAttachFunction): JQuery; } From ad7b08921be13c5dd80cc73ded45f4b8441acb08 Mon Sep 17 00:00:00 2001 From: jraymakers Date: Tue, 7 Jan 2014 21:08:18 -0800 Subject: [PATCH 05/17] remove unnecessary comment in ITemplateLinkingFunction --- angularjs/angular.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 79134e433..ec5b48964 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -544,7 +544,6 @@ declare module ng { interface ITemplateLinkingFunction { (scope?: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery; - // scope argument is optional (cloneAttachFn?: ICloneAttachFunction): JQuery; } From 75357ab8101c32379e2a59f396161a66688c6d26 Mon Sep 17 00:00:00 2001 From: jraymakers Date: Tue, 7 Jan 2014 22:22:33 -0800 Subject: [PATCH 06/17] add missing semicolon in ICloneAttachFunction --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index ec5b48964..3af21d4a3 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -539,7 +539,7 @@ declare module ng { interface ICloneAttachFunction { // Let's hint but not force cloneAttachFn's signature - (clonedElement?: JQuery, scope?: IScope): any + (clonedElement?: JQuery, scope?: IScope): any; } interface ITemplateLinkingFunction { From 8bda915f3766026c53cb91be99ae5587632bd8e0 Mon Sep 17 00:00:00 2001 From: bolkhovsky Date: Thu, 9 Jan 2014 18:06:50 +0400 Subject: [PATCH 07/17] fix methods accessors --- openlayers/openlayers.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index ea489bc12..ba9f6baea 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -611,7 +611,7 @@ declare module OpenLayers { * openlayers.org homepage: * http://trac.openlayers.org/wiki/SettingZoomLevels */ - private initResolutions(): void; + initResolutions(): void; /** * Method: resolutionsFromScales @@ -635,7 +635,7 @@ declare module OpenLayers { * Returns: * {Array({Number})} Array of resolutions. */ - private calculateResolutions(props: Object): number[]; + calculateResolutions(props: Object): number[]; /** * APIMethod: getResolution @@ -760,7 +760,7 @@ declare module OpenLayers { * Returns: * {Integer} the z-index of this layer */ - private getZIndex(): number; + getZIndex(): number; /** * Method: setZIndex @@ -768,7 +768,7 @@ declare module OpenLayers { * Parameters: * zIndex - {Integer} */ - private setZIndex(zIndex: number): void; + setZIndex(zIndex: number): void; /** * Method: adjustBounds @@ -781,7 +781,7 @@ declare module OpenLayers { * Parameters: * bounds - {} */ - private adjustBounds(bounds: Bounds): Bounds; + adjustBounds(bounds: Bounds): Bounds; static CLASS_NAME: string; } From 40210142d6c937c3320dbaf48c045c4a353fcbdd Mon Sep 17 00:00:00 2001 From: anwalkers Date: Thu, 9 Jan 2014 10:11:00 -0800 Subject: [PATCH 08/17] added invertExtent to d3.d.ts --- d3/d3.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 0c0be2178..d10935770 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -2635,6 +2635,7 @@ declare module D3 { (): any[]; }; copy(): QuantizeScale; + invertExtent(y: any): any[]; } export interface ThresholdScale extends Scale { From cca98c346edc2bf21b47130d2a1030c779c43296 Mon Sep 17 00:00:00 2001 From: anwalkers Date: Thu, 9 Jan 2014 10:16:24 -0800 Subject: [PATCH 09/17] moved invertExtent(y: any): any[]; to Scale interface from QuantizeScale interface --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index d10935770..126f2d95b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -2442,6 +2442,7 @@ declare module D3 { (values: any[]): Scale; (): any[]; }; + invertExtent(y: any): any[]; copy(): Scale; } @@ -2635,7 +2636,6 @@ declare module D3 { (): any[]; }; copy(): QuantizeScale; - invertExtent(y: any): any[]; } export interface ThresholdScale extends Scale { From 90cf96b45178b6708d61b159b6bb0b541394b0ce Mon Sep 17 00:00:00 2001 From: jraymakers Date: Thu, 9 Jan 2014 16:01:48 -0800 Subject: [PATCH 10/17] update optionality of arguments to ITemplateLinkingFunction --- angularjs/angular.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1a3889e04..6b0fe4683 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -543,7 +543,9 @@ declare module ng { } interface ITemplateLinkingFunction { - (scope?: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery; + // If the scope is provided, then the cloneAttachFn must be as well. + (scope: IScope, cloneAttachFn: ICloneAttachFunction): JQuery; + // If one argument is provided, then it's assumed to be the cloneAttachFn. (cloneAttachFn?: ICloneAttachFunction): JQuery; } From 9efa6268fc2b0f6caa2943aff21831145449bd8a Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 10 Jan 2014 11:03:22 +0000 Subject: [PATCH 11/17] jQuery UI: added some missing API parts --- jqueryui/jqueryui.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 14a1d2579..3a1823a92 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -185,6 +185,8 @@ declare module JQueryUI { title?: string; width?: any; // number or string zIndex?: number; + + close?: DialogEvent; } interface DialogUIParams { @@ -561,9 +563,15 @@ declare module JQueryUI { heightStyle?: string; hide?: any; // boolean, number, string or object show?: any; // boolean, number, string or object + + activate?: TabsEvent; } interface TabsUIParams { + newTab: JQuery; + oldTab: JQuery; + newPanel: JQuery; + oldPanel: JQuery; } interface TabsEvent { From eaf4ce0ed46fcb67f5a88b3220f224dca19bdb89 Mon Sep 17 00:00:00 2001 From: mick delaney Date: Fri, 10 Jan 2014 12:47:05 +0000 Subject: [PATCH 12/17] Restangular: Adding In Some Restangular Api Methods --- restangular/restangular.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index e633d8ac2..a329b20bf 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Restangular v0.8.0 - 2013-06-03 +// Type definitions for Restangular v1.2.2 - 2014-01-10 // Project: https://github.com/mgonto/restangular // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,6 +12,9 @@ interface Restangular extends RestangularCustom { all(route: string): RestangularCollection; copy(fromElement: any): RestangularElement; withConfig(configurer: (RestangularProvider) => any): Restangular; + restangularizeElement(parent: any, element: any, route: string, collection?, reqParams?): RestangularElement; + restangularizeCollection(parent: any, element: any, route: string): RestangularCollection; + stripRestangular(element: any): any; } interface RestangularElement extends Restangular { From e97d59b953c303920a660360c6931155286aad45 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 10 Jan 2014 13:35:23 +0000 Subject: [PATCH 13/17] jQuery: scrollLeft / scrollTop JSDoc'd --- jquery/jquery.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 01e75e118..9bc102ca0 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1067,10 +1067,26 @@ interface JQuery { */ position(): JQueryCoordinates; + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. + */ scrollLeft(): number; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ scrollLeft(value: number): JQuery; + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + */ scrollTop(): number; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ scrollTop(value: number): JQuery; /** From c733d256516bde678fc0f6c92ff75f35caa9d564 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 10 Jan 2014 13:38:25 +0000 Subject: [PATCH 14/17] jQuery: scrollLeft /scrollTop test suites --- jquery/jquery-tests.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 35a954e95..0fed71bf4 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -1814,6 +1814,20 @@ function test_outerWidth() { " , outerWidth( true ):" + p.outerWidth(true)); } +function test_scrollLeft() { + var p = $("p:first"); + $("p:last").text("scrollLeft:" + p.scrollLeft()); + + $("div.demo").scrollLeft(300); +} + +function test_scrollTop() { + var p = $("p:first"); + $("p:last").text("scrollTop:" + p.scrollTop()); + + $("div.demo").scrollTop(300); +} + function test_position() { var p = $("p:first"); var position = p.position(); From 9d4f888a30651c9fc4ed4eb05c8dd4823df69a19 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 10 Jan 2014 13:51:27 +0000 Subject: [PATCH 15/17] jQuery: data JSDoc and removeData test suite --- jquery/jquery-tests.ts | 10 +++++++++ jquery/jquery.d.ts | 46 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 0fed71bf4..440a56707 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -898,6 +898,16 @@ function test_data() { $.data(document.getElementById("id"), "", "8").toUpperCase(); } +function test_removeData() { + $("span:eq(0)").text("" + $("div").data("test1")); + $("div").data("test1", "VALUE-1"); + $("div").data("test2", "VALUE-2"); + $("span:eq(1)").text("" + $("div").data("test1")); + $("div").removeData("test1"); + $("span:eq(2)").text("" + $("div").data("test1")); + $("span:eq(3)").text("" + $("div").data("test2")); +} + function test_dblclick() { $('#target').dblclick(function () { alert('Handler for .dblclick() called.'); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 9bc102ca0..f21670ba7 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1130,16 +1130,56 @@ interface JQuery { */ width(func: (index: number, width: number) => string): JQuery; - // Data + /** + * Remove from the queue all items that have not yet been run. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ clearQueue(queueName?: string): JQuery; + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + */ data(key: string, value: any): JQuery; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + */ data(obj: { [key: string]: any; }): JQuery; - data(key?: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + */ + data(key: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + */ + data(): any; + /** + * Execute the next function on the queue for the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ dequeue(queueName?: string): JQuery; - removeData(nameOrList?: any): JQuery; + /** + * Remove a previously-stored piece of data. + * + * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. + */ + removeData(name: string): JQuery; + /** + * Remove a previously-stored piece of data. + * + * @param list An array of strings naming the pieces of data to delete. + */ + removeData(list: string[]): JQuery; // Deferred promise(type?: any, target?: any): JQueryPromise; From 0931add1c36308f3a4e2b1ea1d256ba96b54687f Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 10 Jan 2014 13:55:55 +0000 Subject: [PATCH 16/17] jQuery: promise JSDoc'd and added test suite --- jquery/jquery-tests.ts | 33 +++++++++++++++++++++++++++++++++ jquery/jquery.d.ts | 9 +++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 440a56707..6508e81a7 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -1856,6 +1856,39 @@ function test_insertBefore() { $("p").insertBefore("#foo"); } +function test_promise() { + var div = $("
"); + + div.promise().done(function (arg1) { + // Will fire right away and alert "true" + alert(this === div && arg1 === div); + }); + + $("button").on("click", function () { + $("p").append("Started..."); + + $("div").each(function (i) { + $(this).fadeIn().fadeOut(1000 * (i + 1)); + }); + + $("div").promise().done(function () { + $("p").append(" Finished! "); + }); + }); + + var effect = function () { + return $("div").fadeIn(800).delay(1200).fadeOut(); + }; + + $("button").on("click", function () { + $("p").append(" Started... "); + + $.when(effect()).done(function () { + $("p").append(" Finished! "); + }); + }); +} + function test_is() { $("ul").click(function (event) { var $target = $(event.target); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index f21670ba7..992213c39 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1181,8 +1181,13 @@ interface JQuery { */ removeData(list: string[]): JQuery; - // Deferred - promise(type?: any, target?: any): JQueryPromise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * + * @param type The type of queue that needs to be observed. (default: fx) + * @param target Object onto which the promise methods have to be attached + */ + promise(type?: string, target?: Object): JQueryPromise; // Effects animate(properties: any, duration?: any, complete?: Function): JQuery; From 1f2d03f0ef8626919e776a18888c19fc027eb0d9 Mon Sep 17 00:00:00 2001 From: Adam Hewitt Date: Fri, 10 Jan 2014 14:54:37 -0800 Subject: [PATCH 17/17] fix missing file reference --- winjs/winjs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index e91a8548e..99a5e33c2 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -13,6 +13,8 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ +/// + declare module WinJS { function strictProcessing(): void;