Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into enums
  • Loading branch information
saschanaz committed Mar 29, 2017
2 parents 8ea647a + 077bd91 commit a469045
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 11 deletions.
20 changes: 14 additions & 6 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,7 @@ interface DataTransfer {
clearData(format?: string): boolean;
getData(format: string): string;
setData(format: string, data: string): boolean;
setDragImage(image: Element, x: number, y: number): void;
}

declare var DataTransfer: {
Expand Down Expand Up @@ -3207,7 +3208,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Gets or sets the version attribute specified in the declaration of an XML document.
*/
xmlVersion: string | null;
adoptNode(source: Node): Node;
adoptNode<T extends Node>(source: T): T;
captureEvents(): void;
caretRangeFromPoint(x: number, y: number): Range;
clear(): void;
Expand Down Expand Up @@ -3384,7 +3385,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Gets a value indicating whether the object currently has focus.
*/
hasFocus(): boolean;
importNode(importedNode: Node, deep: boolean): Node;
importNode<T extends Node>(importedNode: T, deep: boolean): T;
msElementsFromPoint(x: number, y: number): NodeListOf<Element>;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf<Element>;
/**
Expand Down Expand Up @@ -3795,7 +3796,12 @@ declare var FocusNavigationEvent: {
}

interface FormData {
append(name: any, value: any, blobName?: string): void;
append(name: string, value: string | Blob, fileName?: string): void;
delete(name: string): void;
get(name: string): FormDataEntryValue | null;
getAll(name: string): FormDataEntryValue[];
has(name: string): boolean;
set(name: string, value: string | Blob, fileName?: string): void;
}

declare var FormData: {
Expand Down Expand Up @@ -8253,15 +8259,15 @@ interface Node extends EventTarget {
contains(child: Node): boolean;
hasAttributes(): boolean;
hasChildNodes(): boolean;
insertBefore(newChild: Node, refChild: Node | null): Node;
insertBefore<T extends Node>(newChild: T, refChild: Node | null): T;
isDefaultNamespace(namespaceURI: string | null): boolean;
isEqualNode(arg: Node): boolean;
isSameNode(other: Node): boolean;
lookupNamespaceURI(prefix: string | null): string | null;
lookupPrefix(namespaceURI: string | null): string | null;
normalize(): void;
removeChild(oldChild: Node): Node;
replaceChild(newChild: Node, oldChild: Node): Node;
removeChild<T extends Node>(oldChild: T): T;
replaceChild<T extends Node>(newChild: Node, oldChild: T): T;
readonly ATTRIBUTE_NODE: number;
readonly CDATA_SECTION_NODE: number;
readonly COMMENT_NODE: number;
Expand Down Expand Up @@ -13231,6 +13237,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly top: Window;
readonly window: Window;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
Blob: typeof Blob;
customElements: CustomElementRegistry;
alert(message?: any): void;
Expand Down Expand Up @@ -14940,6 +14947,7 @@ type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type MouseWheelEvent = WheelEvent;
type ScrollRestoration = "auto" | "manual";
type FormDataEntryValue = string | File;
type AppendMode = "segments" | "sequence";
type AudioContextState = "suspended" | "running" | "closed";
type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass";
Expand Down
63 changes: 63 additions & 0 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ interface NotificationOptions {
icon?: string;
}

interface ObjectURLOptions {
oneTimeOnly?: boolean;
}

interface PushSubscriptionOptionsInit {
userVisibleOnly?: boolean;
applicationServerKey?: any;
Expand Down Expand Up @@ -1008,6 +1012,29 @@ declare var SyncManager: {
new(): SyncManager;
}

interface URL {
hash: string;
host: string;
hostname: string;
href: string;
readonly origin: string;
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
username: string;
readonly searchParams: URLSearchParams;
toString(): string;
}

declare var URL: {
prototype: URL;
new(url: string, base?: string): URL;
createObjectURL(object: any, options?: ObjectURLOptions): string;
revokeObjectURL(url: string): void;
}

interface WebSocketEventMap {
"close": CloseEvent;
"error": Event;
Expand Down Expand Up @@ -1484,6 +1511,41 @@ interface ImageBitmap {
close(): void;
}

interface URLSearchParams {
/**
* Appends a specified key/value pair as a new search parameter.
*/
append(name: string, value: string): void;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*/
delete(name: string): void;
/**
* Returns the first value associated to the given search parameter.
*/
get(name: string): string | null;
/**
* Returns all the values association with a given search parameter.
*/
getAll(name: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
*/
has(name: string): boolean;
/**
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
}

declare var URLSearchParams: {
prototype: URLSearchParams;
/**
* Constructor returning a URLSearchParams object.
*/
new (init?: string | URLSearchParams): URLSearchParams;
}

interface BlobPropertyBag {
type?: string;
endings?: string;
Expand Down Expand Up @@ -1746,6 +1808,7 @@ type RequestInfo = Request | string;
type USVString = string;
type IDBValidKey = number | string | Date | IDBArrayKey;
type BufferSource = ArrayBuffer | ArrayBufferView;
type FormDataEntryValue = string | File;
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
type IDBRequestReadyState = "pending" | "done";
type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
Expand Down
54 changes: 53 additions & 1 deletion inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
{
"kind": "interface",
"name": "URLSearchParams",
"flavor": "Web",
"constructorSignatures": [
"new (init?: string | URLSearchParams): URLSearchParams"
],
Expand Down Expand Up @@ -226,6 +225,13 @@
"name": "URL",
"type": "typeof URL"
},
{
"kind": "property",
"interface": "Window",
"exposeGlobally": false,
"name": "URLSearchParams",
"type": "typeof URLSearchParams"
},
{
"kind": "property",
"interface": "Window",
Expand Down Expand Up @@ -1203,6 +1209,12 @@
"flavor": "Web",
"type": "WheelEvent"
},
{
"kind": "method",
"interface": "DataTransfer",
"name": "setDragImage",
"signatures": ["setDragImage(image: Element, x: number, y: number): void"]
},
{
"kind": "method",
"interface": "Element",
Expand Down Expand Up @@ -1528,5 +1540,45 @@
"name": "getElementById",
"flavor": "DOM",
"signatures": ["getElementById(elementId: string): HTMLElement | null"]
},
{
"kind": "typedef",
"name": "FormDataEntryValue",
"type": "string | File"
},
{
"kind": "method",
"interface": "FormData",
"name": "delete",
"flavor": "Web",
"signatures": ["delete(name: string): void"]
},
{
"kind": "method",
"interface": "FormData",
"name": "get",
"flavor": "Web",
"signatures": ["get(name: string): FormDataEntryValue | null"]
},
{
"kind": "method",
"interface": "FormData",
"name": "getAll",
"flavor": "Web",
"signatures": ["getAll(name: string): FormDataEntryValue[]"]
},
{
"kind": "method",
"interface": "FormData",
"name": "has",
"flavor": "Web",
"signatures": ["has(name: string): boolean"]
},
{
"kind": "method",
"interface": "FormData",
"name": "set",
"flavor": "Web",
"signatures": ["set(name: string, value: string | Blob, fileName?: string): void"]
}
]
5 changes: 4 additions & 1 deletion inputfiles/knownWorkerInterfaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"NotificationEventInit",
"NotificationOptions",
"NotificationPermissionCallback",
"ObjectURLOptions",
"Performance",
"PerformanceNavigation",
"PerformanceTiming",
Expand All @@ -91,11 +92,13 @@
"SyncEventInit",
"SyncManager",
"USVString",
"URL",
"URLSearchParams",
"WebSocket",
"WindowBase64",
"WindowConsole",
"Worker",
"XMLHttpRequest",
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload"
]
]
37 changes: 34 additions & 3 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,40 @@
},
{
"kind": "method",
"interface": "Node",
"name": "insertBefore",
"signatures": ["insertBefore(newChild: Node, refChild: Node | null): Node"]
"interface": "Document",
"name": "adoptNode",
"signatures": ["adoptNode<T extends Node>(source: T): T"]
},
{
"kind": "method",
"interface": "Document",
"name": "importNode",
"signatures": ["importNode<T extends Node>(importedNode: T, deep: boolean): T"]
},
{
"kind": "method",
"interface": "Node",
"name": "appendChild",
"signatures": ["appendChild<T extends Node>(newChild: T): T"]
},
{
"kind": "method",
"interface": "Node",
"name": "insertBefore",
"signatures": ["insertBefore<T extends Node>(newChild: T, refChild: Node | null): T"]
},
{
"kind": "method",
"interface": "Node",
"name": "removeChild",
"signatures": ["removeChild<T extends Node>(oldChild: T): T"]
},
{
"kind": "method",
"interface": "Node",
"name": "replaceChild",
"signatures": ["replaceChild<T extends Node>(newChild: Node, oldChild: T): T"]
},
{
"kind": "method",
"interface": "HTMLCollection",
Expand Down Expand Up @@ -1016,5 +1040,12 @@
"interface": "DOMImplementation",
"name": "createDocument",
"signatures": ["createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document"]
},
{
"kind": "method",
"interface": "FormData",
"name": "append",
"flavor": "Web",
"signatures": ["append(name: string, value: string | Blob, fileName?: string): void"]
}
]

0 comments on commit a469045

Please sign in to comment.