From 2de7bfe6276ffd9dea76187ba59198b72ab4a574 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:10:08 -0700 Subject: [PATCH 01/13] WinJS control constructors do not require an element to be passed. If no element is passed, an element is created during construction and accessible via the 'element' property. --- winjs/winjs.d.ts | 50 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index cdc3d27fa..aa0b5b0be 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -3490,7 +3490,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new AppBar. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -3646,7 +3646,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new AppBarCommand. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -3768,7 +3768,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new BackButton. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -3951,7 +3951,7 @@ declare module WinJS.UI { * @param element The DOM element associated with the DatePicker control. * @param options The set of options to be applied initially to the DatePicker control. The options are the following: calendar, current, datePattern, disabled, maxYear, minYear, monthPattern, yearPattern. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4110,7 +4110,7 @@ declare module WinJS.UI { * @param element The DOM element that hosts the control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the pageselected event, add a property named "onpageselected" and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4252,7 +4252,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new Flyout. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4615,7 +4615,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the Hub control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the contentanimating event, add a property named "oncontentanimating" to the options object and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4742,7 +4742,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new HubSection. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4793,7 +4793,7 @@ declare module WinJS.UI { * @param element The element that hosts the HtmlControl. * @param options The options for configuring the page. The uri option is required in order to specify the source document for the content of the page. Other options are the ones used by the WinJS.Pages.render method. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -4811,7 +4811,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new ItemContainer. For the ItemContainer to be accessible, this element must have its role attribute set to "list" or "listbox". If tapBehavior is set to none and selectionDisabled is true, then use the "list" role; otherwise, use the "listbox" role. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5163,7 +5163,7 @@ declare module WinJS.UI { /** * Displays data items in a customizable list or grid. **/ - class ListView { + class ListView { //#region Constructors /** @@ -5172,7 +5172,7 @@ declare module WinJS.UI { * @param element The DOM element that hosts the ListView control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the selectionchanged event, add a property named "onselectionchanged" to the options object and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5485,7 +5485,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new Menu. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5631,7 +5631,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new MenuCommand. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5728,7 +5728,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the new NavBar. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5883,7 +5883,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new NavBarCommand. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -5978,7 +5978,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new NavBarContainer. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6089,7 +6089,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new Rating. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the cancel event, add a property named "oncancel" to the options object and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6344,7 +6344,7 @@ declare module WinJS.UI { * @param element The DOM element hosts the new SearchBox. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6479,7 +6479,7 @@ declare module WinJS.UI { * @param element The DOM element that hosts the SemanticZoom. * @param options An object that contains one or more property/value pairs to apply to the new control. This object can contain these properties: initiallyZoomedOut Boolean, zoomFactor 0.2–0.85. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6579,7 +6579,7 @@ declare module WinJS.UI { * @param element The DOM element that will host the control. * @param options The set of properties and values to apply to the new SettingsFlyout. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6781,7 +6781,7 @@ declare module WinJS.UI { * @param element The DOM element associated with the TimePicker control. * @param options The set of options to be applied initially to the TimePicker control. The options are the following: clock. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -6894,7 +6894,7 @@ declare module WinJS.UI { * @param element The DOM that hosts the control. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the change event, add a property named "onchange" to the options object and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -7003,7 +7003,7 @@ declare module WinJS.UI { * @param element The DOM element associated that hosts the Tooltip. * @param options An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the opened event, add a property named "onopened" to the options object and set its value to the event handler. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors @@ -7119,7 +7119,7 @@ declare module WinJS.UI { * @param element The DOM element that functions as the scaling box. This element fills 100% of the width and height allotted to it. * @param options The set of options to be applied initially to the ViewBox control. There are currently no options on this control, and any options included in this parameter are ignored. **/ - constructor(element: HTMLElement, options?: any); + constructor(element?: HTMLElement, options?: any); //#endregion Constructors From 0a7bf0d88949070926e19495e76806f8902f5318 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:12:08 -0700 Subject: [PATCH 02/13] The second parameter for show/hideCommands for AppBar can be optional, especially since it is deprecated, it is actually encouraged to not specify it. --- winjs/winjs.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index aa0b5b0be..daa071fb3 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -3562,7 +3562,7 @@ declare module WinJS.UI { * @param commands The commands to hide. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to hide the commands immediately, without animating them; otherwise, false. **/ - hideCommands(commands: any[], immediate: boolean): void; + hideCommands(commands: any[], immediate?: boolean): void; /** * Removes an event handler that the addEventListener method registered. @@ -3582,14 +3582,14 @@ declare module WinJS.UI { * @param commands The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the commands immediately, without animating them; otherwise, false. **/ - showCommands(commands: any[], immediate: boolean): void; + showCommands(commands: any[], immediate?: boolean): void; /** * Shows the specified commands of the AppBar while hiding all other commands. * @param commands The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands. * @param immediate The parameter immediate is not supported and may be altered or unavailable in the future. true to show the specified commands (and hide the others) immediately, without animating them; otherwise, false. **/ - showOnlyCommands(commands: any[], immediate: boolean): void; + showOnlyCommands(commands: any[], immediate?: boolean): void; //#endregion Methods From c4cfea06a6f3a391da7bdc91309bb649733e9fa8 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:13:47 -0700 Subject: [PATCH 03/13] The 'commands' property of both AppBar and Menu can take both a single command or an array of commands. Since there is no syntax to type this duality, we should indicate an array of commands instead. --- winjs/winjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index daa071fb3..a27a5350e 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -3598,7 +3598,7 @@ declare module WinJS.UI { /** * Sets the AppBarCommand objects that appear in the app bar. **/ - commands: AppBarCommand; + commands: AppBarCommand[]; /** * Gets or sets a value that indicates whether the AppBar is disabled. @@ -5598,7 +5598,7 @@ declare module WinJS.UI { /** * Sets the MenuCommand objects that appear in the menu. **/ - commands: MenuCommand; + commands: MenuCommand[]; /** * Gets the DOM element that hosts the Menu. From fac68f1264d168e734c3a6ae54b7e157d414ede1 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:14:27 -0700 Subject: [PATCH 04/13] As the docs say, these 2 properties are HTMLElements. --- winjs/winjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index a27a5350e..d9d47c03f 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -3695,7 +3695,7 @@ declare module WinJS.UI { /** * Gets or sets the HTMLElement with a 'content' type AppBarCommand that should receive focus whenever focus moves by the user pressing HOME or the arrow keys, from the previous AppBarCommand to this AppBarCommand. **/ - firstElementFocus: any; + firstElementFocus: HTMLElement; /** * Gets or sets the Flyout object displayed by this command. The specified flyout is shown when the AppBarCommand's button is invoked. @@ -3725,7 +3725,7 @@ declare module WinJS.UI { /** * Gets or sets the HTMLElement with a 'content' type AppBarCommand that should receive focus whenever focus moves by the user pressing END or the arrow keys, from the previous AppBarCommand to this AppBarCommand. **/ - lastElementFocus: any; + lastElementFocus: HTMLElement; /** * Gets or sets the function to be invoked when the command is clicked. From dcff230b754931d529f13ac8cec7a949abbef198 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:16:22 -0700 Subject: [PATCH 05/13] The 'calendar' property is a format string. --- winjs/winjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index d9d47c03f..2cf7bfa77 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -4011,7 +4011,7 @@ declare module WinJS.UI { /** * Gets or sets the calendar to use. **/ - calendar: any; + calendar: string; /** * Gets or sets the current date of the DatePicker. You can use either a date string or a Date object to set this property. From b69147f2a5465aefebafff2469a5a75b38d5e1bc Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:17:52 -0700 Subject: [PATCH 06/13] Fixed some any-typed properties. --- winjs/winjs.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 2cf7bfa77..c968b788b 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -4714,7 +4714,7 @@ declare module WinJS.UI { /** * Gets or sets the index of the first visible HubSection. **/ - sectionOnScreen: any; + sectionOnScreen: number; /** * Gets or sets the List that contains the HubSection objects that belong to this Hub. @@ -4724,7 +4724,7 @@ declare module WinJS.UI { /** * This API supports the SemanticZoom infrastructure and is not intended to be used directly from your code. **/ - zoomableView: any; + zoomableView: IZoomableView; //#endregion Properties @@ -4905,12 +4905,12 @@ declare module WinJS.UI { /** * Gets or sets the orientation of swipe gestures. **/ - swipeOrientation: any; + swipeOrientation: Orientation; /** * Gets or sets how the ItemContainer reacts when the user taps or clicks an item. **/ - tapBehavior: any; + tapBehavior: TapBehavior; //#endregion Properties @@ -5402,7 +5402,7 @@ declare module WinJS.UI { /** * Gets or sets an object that controls the layout of the ListView. **/ - layout: any; + layout: ILayout2; /** * Gets or sets a value that specifies how the ListView fetches items and adds and removes them to the DOM. Don't change the value of this property after the ListView has begun loading data. @@ -6763,7 +6763,7 @@ declare module WinJS.UI { /** * Gets or sets the tab index of this container. **/ - tabIndex: any; + tabIndex: number; //#endregion Properties From 793e49acba52b148940ef090b67e1347996f7dc6 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:19:02 -0700 Subject: [PATCH 07/13] Provided an interface for the currentItem property. Fixed up some minor typing and visibility issues in ListView. --- winjs/winjs.d.ts | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index c968b788b..716939ea0 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -3310,6 +3310,31 @@ declare module WinJS.UI { } + /** + * Used by ListView's currentItem API + **/ + interface IListViewItem { + /** + * Gets or sets index of the ListView item. + **/ + index?: number; + + /** + * Gets or sets key of the ListView item. + **/ + key?: string; + + /** + * Gets or sets whether the ListView item is focused. + **/ + hasFocus?: boolean; + + /** + * Gets or sets whether the ListView item is focused and is showing its focus visual. + **/ + showFocus?: boolean; + } + /** * Represents a selection of ListView items. **/ @@ -5330,10 +5355,10 @@ declare module WinJS.UI { **/ removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean): void; - /** - * Triggers the ListView disposal service manually. - **/ - triggerDispose(): void; + /** + * Triggers the ListView disposal service manually. + **/ + static triggerDispose(): void; //#endregion Methods @@ -5344,10 +5369,10 @@ declare module WinJS.UI { **/ automaticallyLoadPages: boolean; - /** - * Gets or sets an object that indicates which item should have keyboard focus and the focus state of that item. - **/ - currentItem: { index: number; key: string; hasFocus: boolean; showFocus: boolean }; + /** + * Gets or sets an IListViewItem that indicates which item should have keyboard focus and the focus state of that item. + **/ + currentItem: IListViewItem; /** * Gets the HTML element that hosts this ListView. @@ -5467,7 +5492,7 @@ declare module WinJS.UI { /** * Gets a ZoomableView that supports semantic zoom functionality. This API supports the SemanticZoom infrastructure and is not intended to be used directly from your code. **/ - zoomableView: IZoomableView; + zoomableView: IZoomableView>; //#endregion Properties From 722788bcc70735bb1144c69d160d66de92ac038f Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:19:33 -0700 Subject: [PATCH 08/13] This guy can be even more specialized - it takes only img tags. --- winjs/winjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 716939ea0..7ce907b2f 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -6747,7 +6747,7 @@ declare module WinJS.UI { * @param image The img element that will display the thumbnail. * @returns A Promise that completes when the full-quality thumbnail is visible. **/ - loadThumbnail(item: IItem, image: HTMLElement): Promise; + loadThumbnail(item: IItem, image: HTMLImageElement): Promise; //#endregion Methods From 40c621ae5cade35aa1e19a688df3766d00933da8 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:19:51 -0700 Subject: [PATCH 09/13] As the docs indicate, the 2nd parameter is optional. --- winjs/winjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 7ce907b2f..5ff8da71d 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -7371,7 +7371,7 @@ declare module WinJS.UI.Fragments { * @param element Optional. The element to which the fragment is appended. * @returns A promise that is fulfilled when the fragment has been loaded. If a target element is not specified, the copied fragment is the completed value. The element is not added to the cache. See also rendercopy, where the element is added to the cache. **/ - function render(href: string, element: HTMLElement): Promise; + function render(href: string, element?: HTMLElement): Promise; /** * Loads and copies the contents of the specified URI into the specified element. @@ -7379,7 +7379,7 @@ declare module WinJS.UI.Fragments { * @param target The element to which the fragment is appended. * @returns A promise that is fulfilled when the fragment has been loaded. If a target element is not specified, the copied fragment is the completed value. The fragment is added to the cache. See also render, where the element is not added to the cache. **/ - function renderCopy(href: string, target: HTMLElement): Promise; + function renderCopy(href: string, target?: HTMLElement): Promise; //#endregion Functions From a85238496dd599a01e0dc9feacb7c131167898ca Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:21:07 -0700 Subject: [PATCH 10/13] Parameterized some utility functions. This assures that the return type and the input type are always the same. --- winjs/winjs.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 5ff8da71d..5a0cfdbbe 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -8135,7 +8135,7 @@ declare module WinJS.Utilities { * @param name The name of the class to add. * @returns The element. **/ - function addClass(e: HTMLElement, name: string): HTMLElement; + function addClass(e: T, name: string): T; /** * Gets a collection of elements that are the direct children of the specified element. @@ -8177,7 +8177,7 @@ declare module WinJS.Utilities { * @param element The element. * @returns The element. **/ - function empty(element: HTMLElement): HTMLElement; + function empty(element: T): T; /** * Determines whether the specified event occurred within the specified element. @@ -8322,7 +8322,7 @@ declare module WinJS.Utilities { * @param name The name of the class to remove. * @returns The element. **/ - function removeClass(e: HTMLElement, name: string): HTMLElement; + function removeClass(e: T, name: string): T; /** * Asserts that the value is compatible with declarative processing. Declarative processing is performed by WinJS.UI.processAll or WinJS.Binding.processAll. If the value is not compatible, and strictProcessing is on, an exception is thrown. All functions that have been declared using WinJS.Class.define, WinJS.Class.derive, WinJS.UI.Pages.define, or WinJS.Binding.converter are automatically marked as supported for declarative processing. Any other function that you use from a declarative context (that is, a context in which an HTML element has a data-win-control or data-win-options attribute) must be marked manually by calling this function. When you mark a function as supported for declarative processing, you are guaranteeing that the code in the function is secure from injection of third-party content. @@ -8376,7 +8376,7 @@ declare module WinJS.Utilities { * @param name The name of the class to toggle. * @returns The element. **/ - function toggleClass(e: HTMLElement, name: string): HTMLElement; + function toggleClass(e: T, name: string): T; //#endregion Functions From f3b8cfb7e33e8ad095896e2ac61ccccd1cc0fe06 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:21:51 -0700 Subject: [PATCH 11/13] Fixed some typing in WinJS.Utilities. --- winjs/winjs.d.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 5a0cfdbbe..294de0815 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -8298,7 +8298,7 @@ declare module WinJS.Utilities { * @param func The function to be marked as compatible with declarative processing. * @returns The input function, marked as compatible with declarative processing. **/ - function markSupportedForProcessing(func: U): U; + function markSupportedForProcessing(func: U): U; /** * Returns a QueryCollection with zero or one elements matching the specified selector query. @@ -8329,7 +8329,7 @@ declare module WinJS.Utilities { * @param value The value to be tested for compatibility with declarative processing. If the value is a function it must be marked with a property supportedForProcessing with a value of true when strictProcessing is on. For more information, see WinJS.Utilities.markSupportedForProcessing. * @returns The input value. **/ - function requireSupportedForProcessing(value: any): any; + function requireSupportedForProcessing(value: T): T; /** * Sets the innerHTML property of the specified element to the specified text. @@ -8363,7 +8363,7 @@ declare module WinJS.Utilities { * Configures a logger that writes messages containing the specified tags to the JavaScript console. * @param options The tags for messages to log. Multiple tags should be separated by spaces. May contain type, tags, excludeTags and action properties. **/ - function startLog(options?: any): void; + function startLog(options?: ILogOptions): void; /** * Removes the WinJS logger that had previously been set up. @@ -8382,6 +8382,13 @@ declare module WinJS.Utilities { //#region Interfaces + interface ILogOptions { + type: string; + action?: (message: string, tags: string, type: string) => void; + excludeTags: string; + tags: string; + } + interface IPosition { left: number; top: number; From 27b4741d5c75c5d08c8c752870f924ecc307e0be Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:22:08 -0700 Subject: [PATCH 12/13] Missing property in the WinJS.Utilities namespace. --- winjs/winjs.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 294de0815..87217d439 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -8380,6 +8380,15 @@ declare module WinJS.Utilities { //#endregion Functions + //#region Properties + + /** + * Gets whether the current script context has access to WinRT APIs. + **/ + var hasWinRT: boolean; + + //#endregion Properties + //#region Interfaces interface ILogOptions { From 55c1ee5cd16a00706ae593ba00d1a0394ea69171 Mon Sep 17 00:00:00 2001 From: jseanxu Date: Wed, 9 Apr 2014 15:22:55 -0700 Subject: [PATCH 13/13] As the doc says, the type of the first parameter is the VALUE (not the promise itself) to be returned by the return promise. --- winjs/winjs.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 87217d439..20263a3bb 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -8596,7 +8596,7 @@ declare module WinJS.Utilities.Scheduler { * @param name A description of the work item for diagnostics. The default value is an empty string. * @returns The job instance that represents this work item. **/ - function schedule(work: (jobInfo: IJobInfo) => void, priority?: Priority, thisArg?: any, name?: string): IJob; + function schedule(work: (jobInfo: IJobInfo) => any, priority?: Priority, thisArg?: any, name?: string): IJob; /** * Schedules a job to complete the returned Promise at WinJS.Utilities.Scheduler.Priority.aboveNormal priority. @@ -8604,7 +8604,7 @@ declare module WinJS.Utilities.Scheduler { * @param jobName A string that describes the job for diagnostic purposes. * @returns A Promise that completes within a job of aboveNormal priority. **/ - function schedulePromiseAboveNormal(promiseValue?: Promise, jobName?: string): Promise; + function schedulePromiseAboveNormal(promiseValue?: U, jobName?: string): Promise; /** * Schedules a job to complete the returned Promise at WinJS.Utilities.Scheduler.Priority.belowNormal priority. @@ -8612,7 +8612,7 @@ declare module WinJS.Utilities.Scheduler { * @param jobName A string that describes the job for diagnostic purposes. * @returns A Promise that completes within a job of belowNormal priority. **/ - function schedulePromiseBelowNormal(promiseValue?: Promise, jobName?: string): Promise; + function schedulePromiseBelowNormal(promiseValue?: U, jobName?: string): Promise; /** * Schedules a job to complete the returned Promise at WinJS.Utilities.Scheduler.Priority.high priority. @@ -8620,7 +8620,7 @@ declare module WinJS.Utilities.Scheduler { * @param jobName A string that describes the job for diagnostic purposes. * @returns A Promise that completes within a job of high priority. **/ - function schedulePromiseHigh(promiseValue?: Promise, jobName?: string): Promise; + function schedulePromiseHigh(promiseValue?: U, jobName?: string): Promise; /** * Schedules a job to complete the returned Promise at WinJS.Utilities.Scheduler.Priority.Idle priority. @@ -8628,7 +8628,7 @@ declare module WinJS.Utilities.Scheduler { * @param jobName A string that describes the job for diagnostic purposes. * @returns A Promise that completes within a job of idle priority. **/ - function schedulePromiseIdle(promiseValue?: Promise, jobName?: string): Promise; + function schedulePromiseIdle(promiseValue?: U, jobName?: string): Promise; /** * Schedules a job to complete the returned Promise at WinJS.Utilities.Scheduler.Priority.normal priority. @@ -8636,7 +8636,7 @@ declare module WinJS.Utilities.Scheduler { * @param jobName A string that describes the job for diagnostic purposes. * @returns A Promise that completes within a job of normal priority. **/ - function schedulePromiseNormal(promiseValue?: Promise, jobName?: string): Promise; + function schedulePromiseNormal(promiseValue?: U, jobName?: string): Promise; //#endregion Functions