Add conditional index signature for Canvas2DContextAttributes (https://github.com/Microsoft/TypeScript/issues/9244)

This commit is contained in:
Mohamed Hegazy 2016-06-18 12:01:29 -07:00
parent 3fe546b9ea
commit f568ad0ce4

View file

@ -2290,7 +2290,7 @@ declare var DeviceRotationRate: {
interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent {
/**
* Sets or gets the URL for the current document.
* Sets or gets the URL for the current document.
*/
readonly URL: string;
/**
@ -2318,7 +2318,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
applets: HTMLCollectionOf<HTMLAppletElement>;
/**
* Deprecated. Sets or retrieves a value that indicates the background color behind the object.
* Deprecated. Sets or retrieves a value that indicates the background color behind the object.
*/
bgColor: string;
/**
@ -2346,19 +2346,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
designMode: string;
/**
* Sets or retrieves a value that indicates the reading order of the object.
* Sets or retrieves a value that indicates the reading order of the object.
*/
dir: string;
/**
* Gets an object representing the document type declaration associated with the current document.
* Gets an object representing the document type declaration associated with the current document.
*/
readonly doctype: DocumentType;
/**
* Gets a reference to the root node of the document.
* Gets a reference to the root node of the document.
*/
documentElement: HTMLElement;
/**
* Sets or gets the security domain of the document.
* Sets or gets the security domain of the document.
*/
domain: string;
/**
@ -2382,7 +2382,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
images: HTMLCollectionOf<HTMLImageElement>;
/**
* Gets the implementation object of the current document.
* Gets the implementation object of the current document.
*/
readonly implementation: DOMImplementation;
/**
@ -2390,11 +2390,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
readonly inputEncoding: string | null;
/**
* Gets the date that the page was last modified, if the page supplies one.
* Gets the date that the page was last modified, if the page supplies one.
*/
readonly lastModified: string;
/**
* Sets or gets the color of the document links.
* Sets or gets the color of the document links.
*/
linkColor: string;
/**
@ -2402,7 +2402,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>;
/**
* Contains information about the current URL.
* Contains information about the current URL.
*/
readonly location: Location;
msCSSOMElementFloatMetrics: boolean;
@ -2427,19 +2427,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param ev The event.
*/
onbeforedeactivate: (ev: UIEvent) => any;
/**
* Fires when the object loses the input focus.
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
*/
onblur: (ev: FocusEvent) => any;
/**
* Occurs when playback is possible, but would require further buffering.
* Occurs when playback is possible, but would require further buffering.
* @param ev The event.
*/
oncanplay: (ev: Event) => any;
oncanplaythrough: (ev: Event) => any;
/**
* Fires when the contents of the object or selection have changed.
* Fires when the contents of the object or selection have changed.
* @param ev The event.
*/
onchange: (ev: Event) => any;
@ -2449,7 +2449,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onclick: (ev: MouseEvent) => any;
/**
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* @param ev The mouse event.
*/
oncontextmenu: (ev: PointerEvent) => any;
@ -2473,12 +2473,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param ev The event.
*/
ondragend: (ev: DragEvent) => any;
/**
/**
* Fires on the target element when the user drags the object to a valid drop target.
* @param ev The drag event.
*/
ondragenter: (ev: DragEvent) => any;
/**
/**
* Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
* @param ev The drag event.
*/
@ -2489,23 +2489,23 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
ondragover: (ev: DragEvent) => any;
/**
* Fires on the source object when the user starts to drag a text selection or selected object.
* Fires on the source object when the user starts to drag a text selection or selected object.
* @param ev The event.
*/
ondragstart: (ev: DragEvent) => any;
ondrop: (ev: DragEvent) => any;
/**
* Occurs when the duration attribute is updated.
* Occurs when the duration attribute is updated.
* @param ev The event.
*/
ondurationchange: (ev: Event) => any;
/**
* Occurs when the media element is reset to its initial state.
* Occurs when the media element is reset to its initial state.
* @param ev The event.
*/
onemptied: (ev: Event) => any;
/**
* Occurs when the end of playback is reached.
* Occurs when the end of playback is reached.
* @param ev The event
*/
onended: (ev: MediaStreamErrorEvent) => any;
@ -2515,7 +2515,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onerror: (ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
* Fires when the object receives focus.
* @param ev The event.
*/
onfocus: (ev: FocusEvent) => any;
@ -2539,12 +2539,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onkeyup: (ev: KeyboardEvent) => any;
/**
* Fires immediately after the browser loads the object.
* Fires immediately after the browser loads the object.
* @param ev The event.
*/
onload: (ev: Event) => any;
/**
* Occurs when media data is loaded at the current playback position.
* Occurs when media data is loaded at the current playback position.
* @param ev The event.
*/
onloadeddata: (ev: Event) => any;
@ -2554,22 +2554,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onloadedmetadata: (ev: Event) => any;
/**
* Occurs when Internet Explorer begins looking for media data.
* Occurs when Internet Explorer begins looking for media data.
* @param ev The event.
*/
onloadstart: (ev: Event) => any;
/**
* Fires when the user clicks the object with either mouse button.
* Fires when the user clicks the object with either mouse button.
* @param ev The mouse event.
*/
onmousedown: (ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse over the object.
* Fires when the user moves the mouse over the object.
* @param ev The mouse event.
*/
onmousemove: (ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* @param ev The mouse event.
*/
onmouseout: (ev: MouseEvent) => any;
@ -2579,12 +2579,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onmouseover: (ev: MouseEvent) => any;
/**
* Fires when the user releases a mouse button while the mouse is over the object.
* Fires when the user releases a mouse button while the mouse is over the object.
* @param ev The mouse event.
*/
onmouseup: (ev: MouseEvent) => any;
/**
* Fires when the wheel button is rotated.
* Fires when the wheel button is rotated.
* @param ev The mouse event
*/
onmousewheel: (ev: WheelEvent) => any;
@ -2606,7 +2606,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onmspointerover: (ev: MSPointerEvent) => any;
onmspointerup: (ev: MSPointerEvent) => any;
/**
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* @param ev The event.
*/
onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any;
@ -2621,24 +2621,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onpause: (ev: Event) => any;
/**
* Occurs when the play method is requested.
* Occurs when the play method is requested.
* @param ev The event.
*/
onplay: (ev: Event) => any;
/**
* Occurs when the audio or video has started playing.
* Occurs when the audio or video has started playing.
* @param ev The event.
*/
onplaying: (ev: Event) => any;
onpointerlockchange: (ev: Event) => any;
onpointerlockerror: (ev: Event) => any;
/**
* Occurs to indicate progress while downloading media data.
* Occurs to indicate progress while downloading media data.
* @param ev The event.
*/
onprogress: (ev: ProgressEvent) => any;
/**
* Occurs when the playback rate is increased or decreased.
* Occurs when the playback rate is increased or decreased.
* @param ev The event.
*/
onratechange: (ev: Event) => any;
@ -2648,22 +2648,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onreadystatechange: (ev: ProgressEvent) => any;
/**
* Fires when the user resets a form.
* Fires when the user resets a form.
* @param ev The event.
*/
onreset: (ev: Event) => any;
/**
* Fires when the user repositions the scroll box in the scroll bar on the object.
* Fires when the user repositions the scroll box in the scroll bar on the object.
* @param ev The event.
*/
onscroll: (ev: UIEvent) => any;
/**
* Occurs when the seek operation ends.
* Occurs when the seek operation ends.
* @param ev The event.
*/
onseeked: (ev: Event) => any;
/**
* Occurs when the current playback position is moved.
* Occurs when the current playback position is moved.
* @param ev The event.
*/
onseeking: (ev: Event) => any;
@ -2679,7 +2679,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onselectionchange: (ev: Event) => any;
onselectstart: (ev: Event) => any;
/**
* Occurs when the download has stopped.
* Occurs when the download has stopped.
* @param ev The event.
*/
onstalled: (ev: Event) => any;
@ -2690,7 +2690,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
onstop: (ev: Event) => any;
onsubmit: (ev: Event) => any;
/**
* Occurs if the load operation has been intentionally halted.
* Occurs if the load operation has been intentionally halted.
* @param ev The event.
*/
onsuspend: (ev: Event) => any;
@ -2709,7 +2709,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
onvolumechange: (ev: Event) => any;
/**
* Occurs when playback stops because the next frame of a video resource is not available.
* Occurs when playback stops because the next frame of a video resource is not available.
* @param ev The event.
*/
onwaiting: (ev: Event) => any;
@ -2743,7 +2743,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
title: string;
readonly visibilityState: string;
/**
/**
* Sets or gets the color of the links that the user has visited.
*/
vlinkColor: string;
@ -2933,7 +2933,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
createNSResolver(nodeResolver: Node): XPathNSResolver;
/**
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
* @param root The root element or node to start traversing on.
* @param whatToShow The type of nodes or elements to appear in the node list
* @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.
@ -2942,11 +2942,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;
createProcessingInstruction(target: string, data: string): ProcessingInstruction;
/**
* Returns an empty range object that has both of its boundary points positioned at the beginning of the document.
* Returns an empty range object that has both of its boundary points positioned at the beginning of the document.
*/
createRange(): Range;
/**
* Creates a text string from the specified value.
* Creates a text string from the specified value.
* @param data String that specifies the nodeValue property of the text node.
*/
createTextNode(data: string): Text;
@ -2961,7 +2961,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
*/
createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;
/**
* Returns the element for the specified x coordinate and the specified y coordinate.
* Returns the element for the specified x coordinate and the specified y coordinate.
* @param x The x-offset
* @param y The y-offset
*/
@ -3199,7 +3199,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
*/
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
/**
/**
* Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.
* @param commandId Specifies a command identifier.
*/
@ -3221,7 +3221,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
queryCommandSupported(commandId: string): boolean;
/**
* Retrieves the string associated with a command.
* @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.
* @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.
*/
queryCommandText(commandId: string): string;
/**
@ -3237,12 +3237,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
webkitCancelFullScreen(): void;
webkitExitFullscreen(): void;
/**
* Writes one or more HTML expressions to a document in the specified window.
* Writes one or more HTML expressions to a document in the specified window.
* @param content Specifies the text and HTML tags to write.
*/
write(...content: string[]): void;
/**
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
@ -3971,12 +3971,12 @@ interface HTMLAnchorElement extends HTMLElement {
*/
target: string;
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
type: string;
urn: string;
/**
/**
* Returns a string representation of an object.
*/
toString(): string;
@ -4078,7 +4078,7 @@ interface HTMLAreaElement extends HTMLElement {
*/
host: string;
/**
* Sets or retrieves the host name part of the location or URL.
* Sets or retrieves the host name part of the location or URL.
*/
hostname: string;
/**
@ -4114,7 +4114,7 @@ interface HTMLAreaElement extends HTMLElement {
* Sets or retrieves the window or frame at which to target content.
*/
target: string;
/**
/**
* Returns a string representation of an object.
*/
toString(): string;
@ -4380,7 +4380,7 @@ interface HTMLButtonElement extends HTMLElement {
* Overrides the target attribute on a form element.
*/
formTarget: string;
/**
/**
* Sets or retrieves the name of the object.
*/
name: string;
@ -4397,7 +4397,7 @@ interface HTMLButtonElement extends HTMLElement {
* Returns a ValidityState object that represents the validity states of an element.
*/
readonly validity: ValidityState;
/**
/**
* Sets or retrieves the default or selected value of the control.
*/
value: string;
@ -4504,7 +4504,7 @@ declare var HTMLDirectoryElement: {
interface HTMLDivElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
* Sets or retrieves how the object is aligned with adjacent text.
*/
align: string;
/**
@ -5647,7 +5647,7 @@ interface HTMLInputElement extends HTMLElement {
*/
readonly files: FileList | null;
/**
* Retrieves a reference to the form that the object is embedded in.
* Retrieves a reference to the form that the object is embedded in.
*/
readonly form: HTMLFormElement;
/**
@ -6367,7 +6367,7 @@ interface HTMLMetaElement extends HTMLElement {
*/
scheme: string;
/**
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
*/
url: string;
}
@ -6630,7 +6630,7 @@ declare var HTMLOptionsCollection: {
interface HTMLParagraphElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
* Sets or retrieves how the object is aligned with adjacent text.
*/
align: string;
clear: string;
@ -6732,10 +6732,10 @@ interface HTMLScriptElement extends HTMLElement {
*/
defer: boolean;
/**
* Sets or retrieves the event for which the script is written.
* Sets or retrieves the event for which the script is written.
*/
event: string;
/**
/**
* Sets or retrieves the object that is bound to the event script.
*/
htmlFor: string;
@ -6744,7 +6744,7 @@ interface HTMLScriptElement extends HTMLElement {
*/
src: string;
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
/**
@ -6765,7 +6765,7 @@ interface HTMLSelectElement extends HTMLElement {
autofocus: boolean;
disabled: boolean;
/**
* Retrieves a reference to the form that the object is embedded in.
* Retrieves a reference to the form that the object is embedded in.
*/
readonly form: HTMLFormElement;
/**
@ -6791,7 +6791,7 @@ interface HTMLSelectElement extends HTMLElement {
selectedIndex: number;
selectedOptions: HTMLCollectionOf<HTMLOptionElement>;
/**
* Sets or retrieves the number of rows in the list box.
* Sets or retrieves the number of rows in the list box.
*/
size: number;
/**
@ -6817,7 +6817,7 @@ interface HTMLSelectElement extends HTMLElement {
/**
* Adds an element to the areas, controlRange, or options collection.
* @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.
* @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection.
* @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection.
*/
add(element: HTMLElement, before?: HTMLElement | number): void;
/**
@ -7012,7 +7012,7 @@ interface HTMLTableElement extends HTMLElement {
*/
border: string;
/**
* Sets or retrieves the border color of the object.
* Sets or retrieves the border color of the object.
*/
borderColor: any;
/**
@ -7307,7 +7307,7 @@ declare var HTMLTextAreaElement: {
interface HTMLTitleElement extends HTMLElement {
/**
* Retrieves or sets the text of the object as a string.
* Retrieves or sets the text of the object as a string.
*/
text: string;
}
@ -13985,7 +13985,7 @@ interface Canvas2DContextAttributes {
alpha?: boolean;
willReadFrequently?: boolean;
storage?: boolean;
[attribute: string]: boolean | string;
[attribute: string]: boolean | string | undefined;
}
interface NodeListOf<TNode extends Node> extends NodeList {