aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--node_modules/.yarn-integrity2
-rw-r--r--node_modules/typescript/Gulpfile.ts4
-rw-r--r--node_modules/typescript/lib/lib.d.ts4328
-rw-r--r--node_modules/typescript/lib/lib.dom.d.ts4286
-rw-r--r--node_modules/typescript/lib/lib.es2015.core.d.ts8
-rw-r--r--node_modules/typescript/lib/lib.es5.d.ts42
-rw-r--r--node_modules/typescript/lib/lib.es6.d.ts4336
-rw-r--r--node_modules/typescript/lib/lib.webworker.d.ts214
-rw-r--r--node_modules/typescript/lib/protocol.d.ts15
-rw-r--r--node_modules/typescript/lib/tsc.js6127
-rw-r--r--node_modules/typescript/lib/tsserver.js7117
-rw-r--r--node_modules/typescript/lib/tsserverlibrary.d.ts585
-rw-r--r--node_modules/typescript/lib/tsserverlibrary.js7105
-rw-r--r--node_modules/typescript/lib/typescript.d.ts118
-rw-r--r--node_modules/typescript/lib/typescript.js8531
-rw-r--r--node_modules/typescript/lib/typescriptServices.d.ts118
-rw-r--r--node_modules/typescript/lib/typescriptServices.js8531
-rw-r--r--node_modules/typescript/lib/typingsInstaller.js173
-rw-r--r--node_modules/typescript/package.json2
19 files changed, 27483 insertions, 24159 deletions
diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity
index 57a73e7ba..f58d3746d 100644
--- a/node_modules/.yarn-integrity
+++ b/node_modules/.yarn-integrity
@@ -1 +1 @@
-71a595d8819c141a8c9cb0787566aceeaaefb2b47317b30f3c9fbbfa9a25eb49 \ No newline at end of file
+7ed29847ffe108e16d5c053f27c2c2be64cd4091dc26a19a2d6cfb0f78807183 \ No newline at end of file
diff --git a/node_modules/typescript/Gulpfile.ts b/node_modules/typescript/Gulpfile.ts
index d7e20a557..054e99c80 100644
--- a/node_modules/typescript/Gulpfile.ts
+++ b/node_modules/typescript/Gulpfile.ts
@@ -177,7 +177,7 @@ for (const i in libraryTargets) {
const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
const configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
const packageJson = "package.json";
-const programTs = path.join(compilerDirectory, "program.ts");
+const versionFile = path.join(compilerDirectory, "core.ts");
function needsUpdate(source: string | string[], dest: string | string[]): boolean {
if (typeof source === "string" && typeof dest === "string") {
@@ -285,7 +285,7 @@ gulp.task(configureNightlyJs, false, [], () => {
// Nightly management tasks
gulp.task("configure-nightly", "Runs scripts/configureNightly.ts to prepare a build for nightly publishing", [configureNightlyJs], (done) => {
- exec(host, [configureNightlyJs, packageJson, programTs], done, done);
+ exec(host, [configureNightlyJs, packageJson, versionFile], done, done);
});
gulp.task("publish-nightly", "Runs `npm publish --tag next` to create a new nightly build on npm", ["LKG"], () => {
return runSequence("clean", "useDebugMode", "runtests", (done) => {
diff --git a/node_modules/typescript/lib/lib.d.ts b/node_modules/typescript/lib/lib.d.ts
index 4eb501c04..ed066deeb 100644
--- a/node_modules/typescript/lib/lib.d.ts
+++ b/node_modules/typescript/lib/lib.d.ts
@@ -200,7 +200,19 @@ interface ObjectConstructor {
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
*/
- freeze<T>(o: T): T;
+ freeze<T>(a: T[]): ReadonlyArray<T>;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T extends Function>(f: T): T;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T>(o: T): Readonly<T>;
/**
* Prevents the addition of new properties to an object.
@@ -1364,6 +1376,34 @@ interface ArrayLike<T> {
}
/**
+ * Make all properties in T optional
+ */
+type Partial<T> = {
+ [P in keyof T]?: T[P];
+};
+
+/**
+ * Make all properties in T readonly
+ */
+type Readonly<T> = {
+ readonly [P in keyof T]: T[P];
+};
+
+/**
+ * From T pick a set of properties K
+ */
+type Pick<T, K extends keyof T> = {
+ [P in K]: T[P];
+}
+
+/**
+ * Construct a type with a set of properties K of type T
+ */
+type Record<K extends string, T> = {
+ [P in K]: T;
+}
+
+/**
* Represents a raw buffer of binary data, which is used to store data for the
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
* but can be passed to a typed array or DataView Object to interpret the raw
@@ -4233,6 +4273,7 @@ interface DoubleRange {
}
interface EventInit {
+ scoped?: boolean;
bubbles?: boolean;
cancelable?: boolean;
}
@@ -5074,15 +5115,26 @@ declare var AnimationEvent: {
new(): AnimationEvent;
}
+interface ApplicationCacheEventMap {
+ "cached": Event;
+ "checking": Event;
+ "downloading": Event;
+ "error": ErrorEvent;
+ "noupdate": Event;
+ "obsolete": Event;
+ "progress": ProgressEvent;
+ "updateready": Event;
+}
+
interface ApplicationCache extends EventTarget {
- oncached: (this: this, ev: Event) => any;
- onchecking: (this: this, ev: Event) => any;
- ondownloading: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onnoupdate: (this: this, ev: Event) => any;
- onobsolete: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onupdateready: (this: this, ev: Event) => any;
+ oncached: (this: ApplicationCache, ev: Event) => any;
+ onchecking: (this: ApplicationCache, ev: Event) => any;
+ ondownloading: (this: ApplicationCache, ev: Event) => any;
+ onerror: (this: ApplicationCache, ev: ErrorEvent) => any;
+ onnoupdate: (this: ApplicationCache, ev: Event) => any;
+ onobsolete: (this: ApplicationCache, ev: Event) => any;
+ onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;
+ onupdateready: (this: ApplicationCache, ev: Event) => any;
readonly status: number;
abort(): void;
swapCache(): void;
@@ -5093,14 +5145,7 @@ interface ApplicationCache extends EventTarget {
readonly OBSOLETE: number;
readonly UNCACHED: number;
readonly UPDATEREADY: number;
- addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ApplicationCacheEventMap>(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5153,17 +5198,21 @@ declare var AudioBuffer: {
new(): AudioBuffer;
}
+interface AudioBufferSourceNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface AudioBufferSourceNode extends AudioNode {
buffer: AudioBuffer | null;
readonly detune: AudioParam;
loop: boolean;
loopEnd: number;
loopStart: number;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;
readonly playbackRate: AudioParam;
start(when?: number, offset?: number, duration?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioBufferSourceNodeEventMap>(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5285,16 +5334,20 @@ declare var AudioTrack: {
new(): AudioTrack;
}
+interface AudioTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface AudioTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;
+ onchange: (this: AudioTrackList, ev: Event) => any;
+ onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;
getTrackById(id: string): AudioTrack | null;
item(index: number): AudioTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioTrackListEventMap>(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: AudioTrack;
}
@@ -5995,7 +6048,6 @@ interface CharacterData extends Node, ChildNode {
insertData(offset: number, arg: string): void;
replaceData(offset: number, count: number, arg: string): void;
substringData(offset: number, count: number): string;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var CharacterData: {
@@ -6320,6 +6372,8 @@ declare var DOMTokenList: {
interface DataCue extends TextTrackCue {
data: ArrayBuffer;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DataCue: {
@@ -6448,7 +6502,98 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
-interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
+interface DocumentEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforedeactivate": UIEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "fullscreenchange": Event;
+ "fullscreenerror": Event;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "mssitemodejumplistitemremoved": MSSiteModeEvent;
+ "msthumbnailclick": MSSiteModeEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "pointerlockchange": Event;
+ "pointerlockerror": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectionchange": Event;
+ "selectstart": Event;
+ "stalled": Event;
+ "stop": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "volumechange": Event;
+ "waiting": Event;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
+interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {
/**
* Sets or gets the URL for the current document.
*/
@@ -6571,294 +6716,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Fires when the user aborts the download.
* @param ev The event.
*/
- onabort: (this: this, ev: UIEvent) => any;
+ onabort: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object is set as the active element.
* @param ev The event.
*/
- onactivate: (this: this, ev: UIEvent) => any;
+ onactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the object is set as the active element.
* @param ev The event.
*/
- onbeforeactivate: (this: this, ev: UIEvent) => any;
+ onbeforeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the activeElement is changed from the current object to another object in the parent document.
* @param ev The event.
*/
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
+ onbeforedeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
*/
- onblur: (this: this, ev: FocusEvent) => any;
+ onblur: (this: Document, ev: FocusEvent) => any;
/**
* Occurs when playback is possible, but would require further buffering.
* @param ev The event.
*/
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
+ oncanplay: (this: Document, ev: Event) => any;
+ oncanplaythrough: (this: Document, ev: Event) => any;
/**
* Fires when the contents of the object or selection have changed.
* @param ev The event.
*/
- onchange: (this: this, ev: Event) => any;
+ onchange: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the left mouse button on the object
* @param ev The mouse event.
*/
- onclick: (this: this, ev: MouseEvent) => any;
+ onclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* @param ev The mouse event.
*/
- oncontextmenu: (this: this, ev: PointerEvent) => any;
+ oncontextmenu: (this: Document, ev: PointerEvent) => any;
/**
* Fires when the user double-clicks the object.
* @param ev The mouse event.
*/
- ondblclick: (this: this, ev: MouseEvent) => any;
+ ondblclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the activeElement is changed from the current object to another object in the parent document.
* @param ev The UI Event
*/
- ondeactivate: (this: this, ev: UIEvent) => any;
+ ondeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires on the source object continuously during a drag operation.
* @param ev The event.
*/
- ondrag: (this: this, ev: DragEvent) => any;
+ ondrag: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user releases the mouse at the close of a drag operation.
* @param ev The event.
*/
- ondragend: (this: this, ev: DragEvent) => any;
+ ondragend: (this: Document, 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: (this: this, ev: DragEvent) => any;
+ ondragenter: (this: Document, 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.
*/
- ondragleave: (this: this, ev: DragEvent) => any;
+ ondragleave: (this: Document, ev: DragEvent) => any;
/**
* Fires on the target element continuously while the user drags the object over a valid drop target.
* @param ev The event.
*/
- ondragover: (this: this, ev: DragEvent) => any;
+ ondragover: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user starts to drag a text selection or selected object.
* @param ev The event.
*/
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
+ ondragstart: (this: Document, ev: DragEvent) => any;
+ ondrop: (this: Document, ev: DragEvent) => any;
/**
* Occurs when the duration attribute is updated.
* @param ev The event.
*/
- ondurationchange: (this: this, ev: Event) => any;
+ ondurationchange: (this: Document, ev: Event) => any;
/**
* Occurs when the media element is reset to its initial state.
* @param ev The event.
*/
- onemptied: (this: this, ev: Event) => any;
+ onemptied: (this: Document, ev: Event) => any;
/**
* Occurs when the end of playback is reached.
* @param ev The event
*/
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: Document, ev: MediaStreamErrorEvent) => any;
/**
* Fires when an error occurs during object loading.
* @param ev The event.
*/
- onerror: (this: this, ev: ErrorEvent) => any;
+ onerror: (this: Document, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
* @param ev The event.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onfullscreenchange: (this: this, ev: Event) => any;
- onfullscreenerror: (this: this, ev: Event) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
+ onfocus: (this: Document, ev: FocusEvent) => any;
+ onfullscreenchange: (this: Document, ev: Event) => any;
+ onfullscreenerror: (this: Document, ev: Event) => any;
+ oninput: (this: Document, ev: Event) => any;
+ oninvalid: (this: Document, ev: Event) => any;
/**
* Fires when the user presses a key.
* @param ev The keyboard event
*/
- onkeydown: (this: this, ev: KeyboardEvent) => any;
+ onkeydown: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user presses an alphanumeric key.
* @param ev The event.
*/
- onkeypress: (this: this, ev: KeyboardEvent) => any;
+ onkeypress: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user releases a key.
* @param ev The keyboard event
*/
- onkeyup: (this: this, ev: KeyboardEvent) => any;
+ onkeyup: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires immediately after the browser loads the object.
* @param ev The event.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: Document, ev: Event) => any;
/**
* Occurs when media data is loaded at the current playback position.
* @param ev The event.
*/
- onloadeddata: (this: this, ev: Event) => any;
+ onloadeddata: (this: Document, ev: Event) => any;
/**
* Occurs when the duration and dimensions of the media have been determined.
* @param ev The event.
*/
- onloadedmetadata: (this: this, ev: Event) => any;
+ onloadedmetadata: (this: Document, ev: Event) => any;
/**
* Occurs when Internet Explorer begins looking for media data.
* @param ev The event.
*/
- onloadstart: (this: this, ev: Event) => any;
+ onloadstart: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the object with either mouse button.
* @param ev The mouse event.
*/
- onmousedown: (this: this, ev: MouseEvent) => any;
+ onmousedown: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse over the object.
* @param ev The mouse event.
*/
- onmousemove: (this: this, ev: MouseEvent) => any;
+ onmousemove: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* @param ev The mouse event.
*/
- onmouseout: (this: this, ev: MouseEvent) => any;
+ onmouseout: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer into the object.
* @param ev The mouse event.
*/
- onmouseover: (this: this, ev: MouseEvent) => any;
+ onmouseover: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user releases a mouse button while the mouse is over the object.
* @param ev The mouse event.
*/
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onmouseup: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the wheel button is rotated.
* @param ev The mouse event
*/
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onmousewheel: (this: Document, ev: WheelEvent) => any;
+ onmscontentzoom: (this: Document, ev: UIEvent) => any;
+ onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;
+ onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;
+ onmspointercancel: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Document, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Document, ev: MSPointerEvent) => any;
/**
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* @param ev The event.
*/
- onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any;
+ onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.
* @param ev The event.
*/
- onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any;
+ onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when playback is paused.
* @param ev The event.
*/
- onpause: (this: this, ev: Event) => any;
+ onpause: (this: Document, ev: Event) => any;
/**
* Occurs when the play method is requested.
* @param ev The event.
*/
- onplay: (this: this, ev: Event) => any;
+ onplay: (this: Document, ev: Event) => any;
/**
* Occurs when the audio or video has started playing.
* @param ev The event.
*/
- onplaying: (this: this, ev: Event) => any;
- onpointerlockchange: (this: this, ev: Event) => any;
- onpointerlockerror: (this: this, ev: Event) => any;
+ onplaying: (this: Document, ev: Event) => any;
+ onpointerlockchange: (this: Document, ev: Event) => any;
+ onpointerlockerror: (this: Document, ev: Event) => any;
/**
* Occurs to indicate progress while downloading media data.
* @param ev The event.
*/
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onprogress: (this: Document, ev: ProgressEvent) => any;
/**
* Occurs when the playback rate is increased or decreased.
* @param ev The event.
*/
- onratechange: (this: this, ev: Event) => any;
+ onratechange: (this: Document, ev: Event) => any;
/**
* Fires when the state of the object has changed.
* @param ev The event
*/
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
+ onreadystatechange: (this: Document, ev: ProgressEvent) => any;
/**
* Fires when the user resets a form.
* @param ev The event.
*/
- onreset: (this: this, ev: Event) => any;
+ onreset: (this: Document, ev: Event) => any;
/**
* Fires when the user repositions the scroll box in the scroll bar on the object.
* @param ev The event.
*/
- onscroll: (this: this, ev: UIEvent) => any;
+ onscroll: (this: Document, ev: UIEvent) => any;
/**
* Occurs when the seek operation ends.
* @param ev The event.
*/
- onseeked: (this: this, ev: Event) => any;
+ onseeked: (this: Document, ev: Event) => any;
/**
* Occurs when the current playback position is moved.
* @param ev The event.
*/
- onseeking: (this: this, ev: Event) => any;
+ onseeking: (this: Document, ev: Event) => any;
/**
* Fires when the current selection changes.
* @param ev The event.
*/
- onselect: (this: this, ev: UIEvent) => any;
+ onselect: (this: Document, ev: UIEvent) => any;
/**
* Fires when the selection state of a document changes.
* @param ev The event.
*/
- onselectionchange: (this: this, ev: Event) => any;
- onselectstart: (this: this, ev: Event) => any;
+ onselectionchange: (this: Document, ev: Event) => any;
+ onselectstart: (this: Document, ev: Event) => any;
/**
* Occurs when the download has stopped.
* @param ev The event.
*/
- onstalled: (this: this, ev: Event) => any;
+ onstalled: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the Stop button or leaves the Web page.
* @param ev The event.
*/
- onstop: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
+ onstop: (this: Document, ev: Event) => any;
+ onsubmit: (this: Document, ev: Event) => any;
/**
* Occurs if the load operation has been intentionally halted.
* @param ev The event.
*/
- onsuspend: (this: this, ev: Event) => any;
+ onsuspend: (this: Document, ev: Event) => any;
/**
* Occurs to indicate the current playback position.
* @param ev The event.
*/
- ontimeupdate: (this: this, ev: Event) => any;
+ ontimeupdate: (this: Document, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
@@ -6867,14 +7012,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Occurs when the volume is changed, or playback is muted or unmuted.
* @param ev The event.
*/
- onvolumechange: (this: this, ev: Event) => any;
+ onvolumechange: (this: Document, ev: Event) => any;
/**
* Occurs when playback stops because the next frame of a video resource is not available.
* @param ev The event.
*/
- onwaiting: (this: this, ev: Event) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwaiting: (this: Document, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Document, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Document, ev: Event) => any;
plugins: HTMLCollectionOf<HTMLEmbedElement>;
readonly pointerLockElement: Element;
/**
@@ -6945,86 +7090,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Creates an instance of the element for the specified tag.
* @param tagName The name of an element.
*/
- createElement(tagName: "a"): HTMLAnchorElement;
- createElement(tagName: "applet"): HTMLAppletElement;
- createElement(tagName: "area"): HTMLAreaElement;
- createElement(tagName: "audio"): HTMLAudioElement;
- createElement(tagName: "base"): HTMLBaseElement;
- createElement(tagName: "basefont"): HTMLBaseFontElement;
- createElement(tagName: "blockquote"): HTMLQuoteElement;
- createElement(tagName: "body"): HTMLBodyElement;
- createElement(tagName: "br"): HTMLBRElement;
- createElement(tagName: "button"): HTMLButtonElement;
- createElement(tagName: "canvas"): HTMLCanvasElement;
- createElement(tagName: "caption"): HTMLTableCaptionElement;
- createElement(tagName: "col"): HTMLTableColElement;
- createElement(tagName: "colgroup"): HTMLTableColElement;
- createElement(tagName: "datalist"): HTMLDataListElement;
- createElement(tagName: "del"): HTMLModElement;
- createElement(tagName: "dir"): HTMLDirectoryElement;
- createElement(tagName: "div"): HTMLDivElement;
- createElement(tagName: "dl"): HTMLDListElement;
- createElement(tagName: "embed"): HTMLEmbedElement;
- createElement(tagName: "fieldset"): HTMLFieldSetElement;
- createElement(tagName: "font"): HTMLFontElement;
- createElement(tagName: "form"): HTMLFormElement;
- createElement(tagName: "frame"): HTMLFrameElement;
- createElement(tagName: "frameset"): HTMLFrameSetElement;
- createElement(tagName: "h1"): HTMLHeadingElement;
- createElement(tagName: "h2"): HTMLHeadingElement;
- createElement(tagName: "h3"): HTMLHeadingElement;
- createElement(tagName: "h4"): HTMLHeadingElement;
- createElement(tagName: "h5"): HTMLHeadingElement;
- createElement(tagName: "h6"): HTMLHeadingElement;
- createElement(tagName: "head"): HTMLHeadElement;
- createElement(tagName: "hr"): HTMLHRElement;
- createElement(tagName: "html"): HTMLHtmlElement;
- createElement(tagName: "iframe"): HTMLIFrameElement;
- createElement(tagName: "img"): HTMLImageElement;
- createElement(tagName: "input"): HTMLInputElement;
- createElement(tagName: "ins"): HTMLModElement;
- createElement(tagName: "isindex"): HTMLUnknownElement;
- createElement(tagName: "label"): HTMLLabelElement;
- createElement(tagName: "legend"): HTMLLegendElement;
- createElement(tagName: "li"): HTMLLIElement;
- createElement(tagName: "link"): HTMLLinkElement;
- createElement(tagName: "listing"): HTMLPreElement;
- createElement(tagName: "map"): HTMLMapElement;
- createElement(tagName: "marquee"): HTMLMarqueeElement;
- createElement(tagName: "menu"): HTMLMenuElement;
- createElement(tagName: "meta"): HTMLMetaElement;
- createElement(tagName: "meter"): HTMLMeterElement;
- createElement(tagName: "nextid"): HTMLUnknownElement;
- createElement(tagName: "object"): HTMLObjectElement;
- createElement(tagName: "ol"): HTMLOListElement;
- createElement(tagName: "optgroup"): HTMLOptGroupElement;
- createElement(tagName: "option"): HTMLOptionElement;
- createElement(tagName: "p"): HTMLParagraphElement;
- createElement(tagName: "param"): HTMLParamElement;
- createElement(tagName: "picture"): HTMLPictureElement;
- createElement(tagName: "pre"): HTMLPreElement;
- createElement(tagName: "progress"): HTMLProgressElement;
- createElement(tagName: "q"): HTMLQuoteElement;
- createElement(tagName: "script"): HTMLScriptElement;
- createElement(tagName: "select"): HTMLSelectElement;
- createElement(tagName: "source"): HTMLSourceElement;
- createElement(tagName: "span"): HTMLSpanElement;
- createElement(tagName: "style"): HTMLStyleElement;
- createElement(tagName: "table"): HTMLTableElement;
- createElement(tagName: "tbody"): HTMLTableSectionElement;
- createElement(tagName: "td"): HTMLTableDataCellElement;
- createElement(tagName: "template"): HTMLTemplateElement;
- createElement(tagName: "textarea"): HTMLTextAreaElement;
- createElement(tagName: "tfoot"): HTMLTableSectionElement;
- createElement(tagName: "th"): HTMLTableHeaderCellElement;
- createElement(tagName: "thead"): HTMLTableSectionElement;
- createElement(tagName: "title"): HTMLTitleElement;
- createElement(tagName: "tr"): HTMLTableRowElement;
- createElement(tagName: "track"): HTMLTrackElement;
- createElement(tagName: "ul"): HTMLUListElement;
- createElement(tagName: "video"): HTMLVideoElement;
- createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement;
- createElement(tagName: "xmp"): HTMLPreElement;
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): HTMLElementTagNameMap[K];
createElement(tagName: string): HTMLElement;
createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement
@@ -7126,7 +7192,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
@@ -7160,182 +7226,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Retrieves a collection of objects based on the specified element name.
* @param name Specifies the name of an element.
*/
- getElementsByTagName(tagname: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(tagname: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(tagname: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(tagname: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(tagname: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(tagname: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(tagname: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(tagname: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(tagname: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(tagname: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(tagname: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(tagname: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(tagname: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(tagname: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(tagname: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(tagname: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(tagname: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(tagname: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(tagname: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(tagname: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(tagname: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(tagname: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(tagname: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(tagname: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(tagname: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(tagname: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(tagname: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(tagname: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(tagname: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(tagname: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(tagname: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(tagname: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(tagname: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(tagname: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(tagname: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(tagname: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(tagname: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(tagname: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(tagname: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(tagname: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(tagname: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(tagname: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(tagname: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(tagname: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(tagname: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(tagname: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(tagname: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(tagname: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(tagname: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(tagname: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(tagname: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(tagname: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(tagname: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(tagname: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(tagname: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(tagname: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(tagname: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(tagname: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(tagname: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(tagname: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(tagname: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(tagname: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(tagname: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(tagname: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(tagname: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(tagname: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(tagname: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(tagname: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(tagname: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(tagname: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(tagname: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(tagname: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(tagname: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(tagname: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(tagname: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(tagname: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(tagname: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(tagname: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(tagname: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(tagname: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(tagname: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(tagname: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(tagname: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(tagname: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(tagname: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(tagname: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(tagname: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(tagname: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(tagname: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(tagname: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(tagname: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(tagname: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(tagname: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(tagname: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(tagname: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(tagname: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(tagname: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(tagname: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(tagname: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(tagname: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(tagname: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(tagname: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(tagname: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(tagname: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(tagname: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(tagname: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(tagname: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(tagname: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(tagname: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(tagname: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(tagname: K): ElementListTagNameMap[K];
getElementsByTagName(tagname: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -7406,103 +7297,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7512,7 +7307,6 @@ declare var Document: {
}
interface DocumentFragment extends Node, NodeSelector, ParentNode {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentFragment: {
@@ -7527,7 +7321,6 @@ interface DocumentType extends Node, ChildNode {
readonly notations: NamedNodeMap;
readonly publicId: string | null;
readonly systemId: string | null;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentType: {
@@ -7580,6 +7373,36 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
+interface ElementEventMap extends GlobalEventHandlersEventMap {
+ "ariarequest": AriaRequestEvent;
+ "command": CommandEvent;
+ "gotpointercapture": PointerEvent;
+ "lostpointercapture": PointerEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSGotPointerCapture": MSPointerEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSLostPointerCapture": MSPointerEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
@@ -7590,33 +7413,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
id: string;
msContentZoomFactor: number;
readonly msRegionOverflow: string;
- onariarequest: (this: this, ev: AriaRequestEvent) => any;
- oncommand: (this: this, ev: CommandEvent) => any;
- ongotpointercapture: (this: this, ev: PointerEvent) => any;
- onlostpointercapture: (this: this, ev: PointerEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmslostpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onariarequest: (this: Element, ev: AriaRequestEvent) => any;
+ oncommand: (this: Element, ev: CommandEvent) => any;
+ ongotpointercapture: (this: Element, ev: PointerEvent) => any;
+ onlostpointercapture: (this: Element, ev: PointerEvent) => any;
+ onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;
+ onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmspointercancel: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Element, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Element, ev: MSPointerEvent) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Element, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Element, ev: Event) => any;
readonly prefix: string | null;
readonly scrollHeight: number;
scrollLeft: number;
@@ -7624,188 +7447,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
readonly scrollWidth: number;
readonly tagName: string;
innerHTML: string;
+ readonly assignedSlot: HTMLSlotElement | null;
+ slot: string;
+ readonly shadowRoot: ShadowRoot | null;
getAttribute(name: string): string | null;
getAttributeNS(namespaceURI: string, localName: string): string;
getAttributeNode(name: string): Attr;
getAttributeNodeNS(namespaceURI: string, localName: string): Attr;
getBoundingClientRect(): ClientRect;
getClientRects(): ClientRectList;
- getElementsByTagName(name: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(name: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(name: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(name: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(name: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(name: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(name: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(name: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(name: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(name: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(name: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(name: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(name: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(name: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(name: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(name: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(name: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(name: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(name: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(name: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(name: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(name: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(name: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(name: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(name: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(name: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(name: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(name: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(name: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(name: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(name: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(name: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(name: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(name: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(name: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(name: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(name: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(name: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(name: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(name: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(name: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(name: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(name: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(name: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(name: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(name: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(name: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(name: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(name: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(name: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(name: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(name: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(name: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(name: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(name: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(name: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(name: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(name: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(name: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(name: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(name: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(name: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(name: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(name: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(name: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(name: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(name: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(name: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(name: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(name: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(name: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(name: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(name: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(name: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(name: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(name: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(name: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(name: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(name: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(name: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(name: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(name: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(name: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(name: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(name: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(name: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(name: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(name: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(name: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(name: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(name: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(name: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(name: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(name: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(name: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(name: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(name: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(name: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(name: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(name: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(name: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(name: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(name: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(name: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(name: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(name: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(name: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(name: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(name: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(name: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(name: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(name: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(name: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(name: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(name: K): ElementListTagNameMap[K];
getElementsByTagName(name: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -7845,42 +7496,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;
+ addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7916,10 +7533,12 @@ interface Event {
readonly target: EventTarget;
readonly timeStamp: number;
readonly type: string;
+ readonly scoped: boolean;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
+ deepPath(): EventTarget[];
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
@@ -7980,6 +7599,7 @@ interface FileReader extends EventTarget, MSBaseReader {
readAsBinaryString(blob: Blob): void;
readAsDataURL(blob: Blob): void;
readAsText(blob: Blob, encoding?: string): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8150,6 +7770,8 @@ interface HTMLAnchorElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAnchorElement: {
@@ -8222,6 +7844,8 @@ interface HTMLAppletElement extends HTMLElement {
useMap: string;
vspace: number;
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAppletElement: {
@@ -8288,6 +7912,8 @@ interface HTMLAreaElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAreaElement: {
@@ -8312,6 +7938,8 @@ declare var HTMLAreasCollection: {
}
interface HTMLAudioElement extends HTMLMediaElement {
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAudioElement: {
@@ -8324,6 +7952,8 @@ interface HTMLBRElement extends HTMLElement {
* Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.
*/
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBRElement: {
@@ -8340,6 +7970,8 @@ interface HTMLBaseElement extends HTMLElement {
* Sets or retrieves the window or frame at which to target content.
*/
target: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBaseElement: {
@@ -8356,6 +7988,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty
* Sets or retrieves the font size of the object.
*/
size: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8364,6 +7997,27 @@ declare var HTMLBaseFontElement: {
new(): HTMLBaseFontElement;
}
+interface HTMLBodyElementEventMap extends HTMLElementEventMap {
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "popstate": PopStateEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLBodyElement extends HTMLElement {
aLink: any;
background: string;
@@ -8371,147 +8025,27 @@ interface HTMLBodyElement extends HTMLElement {
bgProperties: string;
link: any;
noWrap: boolean;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onafterprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;
+ onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLBodyElement, ev: Event) => any;
+ onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLBodyElement, ev: Event) => any;
+ ononline: (this: HTMLBodyElement, ev: Event) => any;
+ onorientationchange: (this: HTMLBodyElement, ev: Event) => any;
+ onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;
+ onresize: (this: HTMLBodyElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLBodyElement, ev: Event) => any;
text: any;
vLink: any;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8584,6 +8118,8 @@ interface HTMLButtonElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLButtonElement: {
@@ -8617,6 +8153,8 @@ interface HTMLCanvasElement extends HTMLElement {
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLCanvasElement: {
@@ -8647,6 +8185,8 @@ declare var HTMLCollection: {
interface HTMLDListElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDListElement: {
@@ -8656,6 +8196,8 @@ declare var HTMLDListElement: {
interface HTMLDataListElement extends HTMLElement {
options: HTMLCollectionOf<HTMLOptionElement>;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDataListElement: {
@@ -8665,6 +8207,8 @@ declare var HTMLDataListElement: {
interface HTMLDirectoryElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDirectoryElement: {
@@ -8681,6 +8225,8 @@ interface HTMLDivElement extends HTMLElement {
* Sets or retrieves whether the browser automatically performs wordwrap.
*/
noWrap: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDivElement: {
@@ -8689,6 +8235,8 @@ declare var HTMLDivElement: {
}
interface HTMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDocument: {
@@ -8696,6 +8244,76 @@ declare var HTMLDocument: {
new(): HTMLDocument;
}
+interface HTMLElementEventMap extends ElementEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforecopy": ClipboardEvent;
+ "beforecut": ClipboardEvent;
+ "beforedeactivate": UIEvent;
+ "beforepaste": ClipboardEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "copy": ClipboardEvent;
+ "cuechange": Event;
+ "cut": ClipboardEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "paste": ClipboardEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectstart": Event;
+ "stalled": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface HTMLElement extends Element {
accessKey: string;
readonly children: HTMLCollection;
@@ -8714,73 +8332,73 @@ interface HTMLElement extends Element {
readonly offsetParent: Element;
readonly offsetTop: number;
readonly offsetWidth: number;
- onabort: (this: this, ev: UIEvent) => any;
- onactivate: (this: this, ev: UIEvent) => any;
- onbeforeactivate: (this: this, ev: UIEvent) => any;
- onbeforecopy: (this: this, ev: ClipboardEvent) => any;
- onbeforecut: (this: this, ev: ClipboardEvent) => any;
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
- onbeforepaste: (this: this, ev: ClipboardEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- oncopy: (this: this, ev: ClipboardEvent) => any;
- oncuechange: (this: this, ev: Event) => any;
- oncut: (this: this, ev: ClipboardEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondeactivate: (this: this, ev: UIEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onpaste: (this: this, ev: ClipboardEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreset: (this: this, ev: Event) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onselectstart: (this: this, ev: Event) => any;
- onstalled: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onabort: (this: HTMLElement, ev: UIEvent) => any;
+ onactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onblur: (this: HTMLElement, ev: FocusEvent) => any;
+ oncanplay: (this: HTMLElement, ev: Event) => any;
+ oncanplaythrough: (this: HTMLElement, ev: Event) => any;
+ onchange: (this: HTMLElement, ev: Event) => any;
+ onclick: (this: HTMLElement, ev: MouseEvent) => any;
+ oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;
+ oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ oncuechange: (this: HTMLElement, ev: Event) => any;
+ oncut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ ondblclick: (this: HTMLElement, ev: MouseEvent) => any;
+ ondeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ ondrag: (this: HTMLElement, ev: DragEvent) => any;
+ ondragend: (this: HTMLElement, ev: DragEvent) => any;
+ ondragenter: (this: HTMLElement, ev: DragEvent) => any;
+ ondragleave: (this: HTMLElement, ev: DragEvent) => any;
+ ondragover: (this: HTMLElement, ev: DragEvent) => any;
+ ondragstart: (this: HTMLElement, ev: DragEvent) => any;
+ ondrop: (this: HTMLElement, ev: DragEvent) => any;
+ ondurationchange: (this: HTMLElement, ev: Event) => any;
+ onemptied: (this: HTMLElement, ev: Event) => any;
+ onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;
+ onerror: (this: HTMLElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLElement, ev: FocusEvent) => any;
+ oninput: (this: HTMLElement, ev: Event) => any;
+ oninvalid: (this: HTMLElement, ev: Event) => any;
+ onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onload: (this: HTMLElement, ev: Event) => any;
+ onloadeddata: (this: HTMLElement, ev: Event) => any;
+ onloadedmetadata: (this: HTMLElement, ev: Event) => any;
+ onloadstart: (this: HTMLElement, ev: Event) => any;
+ onmousedown: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousemove: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseout: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseover: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseup: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;
+ onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;
+ onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;
+ onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onpause: (this: HTMLElement, ev: Event) => any;
+ onplay: (this: HTMLElement, ev: Event) => any;
+ onplaying: (this: HTMLElement, ev: Event) => any;
+ onprogress: (this: HTMLElement, ev: ProgressEvent) => any;
+ onratechange: (this: HTMLElement, ev: Event) => any;
+ onreset: (this: HTMLElement, ev: Event) => any;
+ onscroll: (this: HTMLElement, ev: UIEvent) => any;
+ onseeked: (this: HTMLElement, ev: Event) => any;
+ onseeking: (this: HTMLElement, ev: Event) => any;
+ onselect: (this: HTMLElement, ev: UIEvent) => any;
+ onselectstart: (this: HTMLElement, ev: Event) => any;
+ onstalled: (this: HTMLElement, ev: Event) => any;
+ onsubmit: (this: HTMLElement, ev: Event) => any;
+ onsuspend: (this: HTMLElement, ev: Event) => any;
+ ontimeupdate: (this: HTMLElement, ev: Event) => any;
+ onvolumechange: (this: HTMLElement, ev: Event) => any;
+ onwaiting: (this: HTMLElement, ev: Event) => any;
outerHTML: string;
outerText: string;
spellcheck: boolean;
@@ -8793,109 +8411,7 @@ interface HTMLElement extends Element {
focus(): void;
msGetInputContext(): MSInputMethodContext;
setActive(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8951,6 +8467,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8990,6 +8507,8 @@ interface HTMLFieldSetElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLFieldSetElement: {
@@ -9002,6 +8521,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM
* Sets or retrieves the current typeface family.
*/
face: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9077,6 +8597,8 @@ interface HTMLFormElement extends HTMLElement {
* Fires when a FORM is about to be submitted.
*/
submit(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -9085,6 +8607,10 @@ declare var HTMLFormElement: {
new(): HTMLFormElement;
}
+interface HTMLFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Specifies the properties of a border drawn around an object.
@@ -9137,7 +8663,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLFrameElement, ev: Event) => any;
/**
* Sets or retrieves whether the frame can be scrolled.
*/
@@ -9150,110 +8676,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string | number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameElementEventMap>(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9262,6 +8685,25 @@ declare var HTMLFrameElement: {
new(): HTMLFrameElement;
}
+interface HTMLFrameSetElementEventMap extends HTMLElementEventMap {
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLFrameSetElement extends HTMLElement {
border: string;
/**
@@ -9281,152 +8723,34 @@ interface HTMLFrameSetElement extends HTMLElement {
*/
frameSpacing: any;
name: string;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
+ onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;
/**
* Fires when the object loses the input focus.
*/
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLFrameSetElement, ev: Event) => any;
+ onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLFrameSetElement, ev: Event) => any;
+ ononline: (this: HTMLFrameSetElement, ev: Event) => any;
+ onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;
+ onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLFrameSetElement, ev: Event) => any;
/**
* Sets or retrieves the frame heights of the object.
*/
rows: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9448,6 +8772,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2
* Sets or retrieves the width of the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9458,6 +8783,8 @@ declare var HTMLHRElement: {
interface HTMLHeadElement extends HTMLElement {
profile: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadElement: {
@@ -9470,6 +8797,8 @@ interface HTMLHeadingElement extends HTMLElement {
* Sets or retrieves a value that indicates the table alignment.
*/
align: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadingElement: {
@@ -9482,6 +8811,8 @@ interface HTMLHtmlElement extends HTMLElement {
* Sets or retrieves the DTD version that governs the current document.
*/
version: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHtmlElement: {
@@ -9489,6 +8820,10 @@ declare var HTMLHtmlElement: {
new(): HTMLHtmlElement;
}
+interface HTMLIFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -9546,7 +8881,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLIFrameElement, ev: Event) => any;
readonly sandbox: DOMSettableTokenList;
/**
* Sets or retrieves whether the frame can be scrolled.
@@ -9564,110 +8899,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLIFrameElementEventMap>(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9758,6 +8990,8 @@ interface HTMLImageElement extends HTMLElement {
readonly x: number;
readonly y: number;
msGetAsCastingSource(): any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLImageElement: {
@@ -9969,6 +9203,8 @@ interface HTMLInputElement extends HTMLElement {
* @param n Value to increment the value by.
*/
stepUp(n?: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLInputElement: {
@@ -9982,6 +9218,8 @@ interface HTMLLIElement extends HTMLElement {
* Sets or retrieves the value of a list item.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLIElement: {
@@ -9998,6 +9236,8 @@ interface HTMLLabelElement extends HTMLElement {
* Sets or retrieves the object to which the given label object is assigned.
*/
htmlFor: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLabelElement: {
@@ -10014,6 +9254,8 @@ interface HTMLLegendElement extends HTMLElement {
* Retrieves a reference to the form that the object is embedded in.
*/
readonly form: HTMLFormElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLegendElement: {
@@ -10057,6 +9299,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
type: string;
import?: Document;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10074,6 +9317,8 @@ interface HTMLMapElement extends HTMLElement {
* Sets or retrieves the name of the object.
*/
name: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMapElement: {
@@ -10081,6 +9326,12 @@ declare var HTMLMapElement: {
new(): HTMLMapElement;
}
+interface HTMLMarqueeElementEventMap extends HTMLElementEventMap {
+ "bounce": Event;
+ "finish": Event;
+ "start": Event;
+}
+
interface HTMLMarqueeElement extends HTMLElement {
behavior: string;
bgColor: any;
@@ -10088,9 +9339,9 @@ interface HTMLMarqueeElement extends HTMLElement {
height: string;
hspace: number;
loop: number;
- onbounce: (this: this, ev: Event) => any;
- onfinish: (this: this, ev: Event) => any;
- onstart: (this: this, ev: Event) => any;
+ onbounce: (this: HTMLMarqueeElement, ev: Event) => any;
+ onfinish: (this: HTMLMarqueeElement, ev: Event) => any;
+ onstart: (this: HTMLMarqueeElement, ev: Event) => any;
scrollAmount: number;
scrollDelay: number;
trueSpeed: boolean;
@@ -10098,112 +9349,7 @@ interface HTMLMarqueeElement extends HTMLElement {
width: string;
start(): void;
stop(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10212,6 +9358,11 @@ declare var HTMLMarqueeElement: {
new(): HTMLMarqueeElement;
}
+interface HTMLMediaElementEventMap extends HTMLElementEventMap {
+ "encrypted": MediaEncryptedEvent;
+ "msneedkey": MSMediaKeyNeededEvent;
+}
+
interface HTMLMediaElement extends HTMLElement {
/**
* Returns an AudioTrackList object with the audio tracks for a given video element.
@@ -10301,8 +9452,8 @@ interface HTMLMediaElement extends HTMLElement {
* Gets the current network activity for the element.
*/
readonly networkState: number;
- onencrypted: (this: this, ev: MediaEncryptedEvent) => any;
- onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any;
+ onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;
+ onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;
/**
* Gets a flag that specifies whether playback is paused.
*/
@@ -10380,111 +9531,7 @@ interface HTMLMediaElement extends HTMLElement {
readonly NETWORK_IDLE: number;
readonly NETWORK_LOADING: number;
readonly NETWORK_NO_SOURCE: number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10505,6 +9552,8 @@ declare var HTMLMediaElement: {
interface HTMLMenuElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMenuElement: {
@@ -10537,6 +9586,8 @@ interface HTMLMetaElement extends HTMLElement {
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
*/
url: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMetaElement: {
@@ -10551,6 +9602,8 @@ interface HTMLMeterElement extends HTMLElement {
min: number;
optimum: number;
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMeterElement: {
@@ -10567,6 +9620,8 @@ interface HTMLModElement extends HTMLElement {
* Sets or retrieves the date and time of a modification to the object.
*/
dateTime: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLModElement: {
@@ -10581,6 +9636,8 @@ interface HTMLOListElement extends HTMLElement {
*/
start: number;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOListElement: {
@@ -10700,6 +9757,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10738,6 +9796,8 @@ interface HTMLOptGroupElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptGroupElement: {
@@ -10775,6 +9835,8 @@ interface HTMLOptionElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptionElement: {
@@ -10801,6 +9863,8 @@ interface HTMLParagraphElement extends HTMLElement {
*/
align: string;
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParagraphElement: {
@@ -10825,6 +9889,8 @@ interface HTMLParamElement extends HTMLElement {
* Sets or retrieves the data type of the value attribute.
*/
valueType: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParamElement: {
@@ -10833,6 +9899,8 @@ declare var HTMLParamElement: {
}
interface HTMLPictureElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPictureElement: {
@@ -10845,6 +9913,8 @@ interface HTMLPreElement extends HTMLElement {
* Sets or gets a value that you can use to implement your own width functionality for the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPreElement: {
@@ -10869,6 +9939,8 @@ interface HTMLProgressElement extends HTMLElement {
* Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLProgressElement: {
@@ -10881,6 +9953,8 @@ interface HTMLQuoteElement extends HTMLElement {
* Sets or retrieves reference information about the object.
*/
cite: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLQuoteElement: {
@@ -10919,6 +9993,8 @@ interface HTMLScriptElement extends HTMLElement {
*/
type: string;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLScriptElement: {
@@ -11013,6 +10089,8 @@ interface HTMLSelectElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -11037,6 +10115,8 @@ interface HTMLSourceElement extends HTMLElement {
* Gets or sets the MIME type of a media resource.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSourceElement: {
@@ -11045,6 +10125,8 @@ declare var HTMLSourceElement: {
}
interface HTMLSpanElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSpanElement: {
@@ -11062,6 +10144,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle {
* Retrieves the CSS language in which the style sheet is written.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11079,6 +10162,8 @@ interface HTMLTableCaptionElement extends HTMLElement {
* Sets or retrieves whether the caption appears at the top or bottom of the table.
*/
vAlign: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableCaptionElement: {
@@ -11132,6 +10217,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11153,6 +10239,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11273,6 +10360,8 @@ interface HTMLTableElement extends HTMLElement {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableElement: {
@@ -11324,6 +10413,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.
*/
insertCell(index?: number): HTMLTableDataCellElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11351,6 +10441,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11361,6 +10452,8 @@ declare var HTMLTableSectionElement: {
interface HTMLTemplateElement extends HTMLElement {
readonly content: DocumentFragment;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTemplateElement: {
@@ -11466,6 +10559,8 @@ interface HTMLTextAreaElement extends HTMLElement {
* @param end The offset into the text field for the end of the selection.
*/
setSelectionRange(start: number, end: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTextAreaElement: {
@@ -11478,6 +10573,8 @@ interface HTMLTitleElement extends HTMLElement {
* Retrieves or sets the text of the object as a string.
*/
text: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTitleElement: {
@@ -11497,6 +10594,8 @@ interface HTMLTrackElement extends HTMLElement {
readonly LOADED: number;
readonly LOADING: number;
readonly NONE: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTrackElement: {
@@ -11511,6 +10610,8 @@ declare var HTMLTrackElement: {
interface HTMLUListElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUListElement: {
@@ -11519,6 +10620,8 @@ declare var HTMLUListElement: {
}
interface HTMLUnknownElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUnknownElement: {
@@ -11526,6 +10629,12 @@ declare var HTMLUnknownElement: {
new(): HTMLUnknownElement;
}
+interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {
+ "MSVideoFormatChanged": Event;
+ "MSVideoFrameStepCompleted": Event;
+ "MSVideoOptimalLayoutChanged": Event;
+}
+
interface HTMLVideoElement extends HTMLMediaElement {
/**
* Gets or sets the height of the video element.
@@ -11537,9 +10646,9 @@ interface HTMLVideoElement extends HTMLMediaElement {
msStereo3DPackingMode: string;
msStereo3DRenderMode: string;
msZoom: boolean;
- onMSVideoFormatChanged: (this: this, ev: Event) => any;
- onMSVideoFrameStepCompleted: (this: this, ev: Event) => any;
- onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any;
+ onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;
/**
* Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available.
*/
@@ -11566,114 +10675,7 @@ interface HTMLVideoElement extends HTMLMediaElement {
webkitEnterFullscreen(): void;
webkitExitFullScreen(): void;
webkitExitFullscreen(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11741,11 +10743,16 @@ declare var IDBCursorWithValue: {
new(): IDBCursorWithValue;
}
+interface IDBDatabaseEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+}
+
interface IDBDatabase extends EventTarget {
readonly name: string;
readonly objectStoreNames: DOMStringList;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBDatabase, ev: Event) => any;
+ onerror: (this: IDBDatabase, ev: ErrorEvent) => any;
version: number;
onversionchange: (ev: IDBVersionChangeEvent) => any;
close(): void;
@@ -11753,8 +10760,7 @@ interface IDBDatabase extends EventTarget {
deleteObjectStore(name: string): void;
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11831,13 +10837,15 @@ declare var IDBObjectStore: {
new(): IDBObjectStore;
}
+interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
+ "blocked": Event;
+ "upgradeneeded": IDBVersionChangeEvent;
+}
+
interface IDBOpenDBRequest extends IDBRequest {
- onblocked: (this: this, ev: Event) => any;
- onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;
- addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
+ onblocked: (this: IDBOpenDBRequest, ev: Event) => any;
+ onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;
+ addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11846,16 +10854,20 @@ declare var IDBOpenDBRequest: {
new(): IDBOpenDBRequest;
}
+interface IDBRequestEventMap {
+ "error": ErrorEvent;
+ "success": Event;
+}
+
interface IDBRequest extends EventTarget {
readonly error: DOMError;
- onerror: (this: this, ev: ErrorEvent) => any;
- onsuccess: (this: this, ev: Event) => any;
+ onerror: (this: IDBRequest, ev: ErrorEvent) => any;
+ onsuccess: (this: IDBRequest, ev: Event) => any;
readonly readyState: string;
readonly result: any;
source: IDBObjectStore | IDBIndex | IDBCursor;
readonly transaction: IDBTransaction;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11864,21 +10876,25 @@ declare var IDBRequest: {
new(): IDBRequest;
}
+interface IDBTransactionEventMap {
+ "abort": Event;
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface IDBTransaction extends EventTarget {
readonly db: IDBDatabase;
readonly error: DOMError;
readonly mode: string;
- onabort: (this: this, ev: Event) => any;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBTransaction, ev: Event) => any;
+ oncomplete: (this: IDBTransaction, ev: Event) => any;
+ onerror: (this: IDBTransaction, ev: ErrorEvent) => any;
abort(): void;
objectStore(name: string): IDBObjectStore;
readonly READ_ONLY: string;
readonly READ_WRITE: string;
readonly VERSION_CHANGE: string;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12011,18 +11027,22 @@ interface MSApp {
}
declare var MSApp: MSApp;
+interface MSAppAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSAppAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;
+ onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
start(): void;
readonly COMPLETED: number;
readonly ERROR: number;
readonly STARTED: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12177,6 +11197,8 @@ interface MSHTMLWebViewElement extends HTMLElement {
navigateWithHttpRequestMessage(requestMessage: any): void;
refresh(): void;
stop(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSHTMLWebViewElement: {
@@ -12184,20 +11206,24 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
+interface MSInputMethodContextEventMap {
+ "MSCandidateWindowHide": Event;
+ "MSCandidateWindowShow": Event;
+ "MSCandidateWindowUpdate": Event;
+}
+
interface MSInputMethodContext extends EventTarget {
readonly compositionEndOffset: number;
readonly compositionStartOffset: number;
- oncandidatewindowhide: (this: this, ev: Event) => any;
- oncandidatewindowshow: (this: this, ev: Event) => any;
- oncandidatewindowupdate: (this: this, ev: Event) => any;
+ oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;
readonly target: HTMLElement;
getCandidateWindowClientRect(): ClientRect;
getCompositionAlternatives(): string[];
hasComposition(): boolean;
isCandidateWindowVisible(): boolean;
- addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSInputMethodContextEventMap>(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12363,6 +11389,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader {
readAsBlob(stream: MSStream, size?: number): void;
readAsDataURL(stream: MSStream, size?: number): void;
readAsText(stream: MSStream, encoding?: string, size?: number): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12371,10 +11398,15 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
+interface MSWebViewAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSWebViewAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;
+ onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
readonly target: MSHTMLWebViewElement;
@@ -12386,8 +11418,7 @@ interface MSWebViewAsyncOperation extends EventTarget {
readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;
readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;
readonly TYPE_INVOKE_SCRIPT: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSWebViewAsyncOperationEventMap>(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12424,12 +11455,16 @@ declare var MediaDeviceInfo: {
new(): MediaDeviceInfo;
}
+interface MediaDevicesEventMap {
+ "devicechange": Event;
+}
+
interface MediaDevices extends EventTarget {
- ondevicechange: (this: this, ev: Event) => any;
+ ondevicechange: (this: MediaDevices, ev: Event) => any;
enumerateDevices(): any;
getSupportedConstraints(): MediaTrackSupportedConstraints;
getUserMedia(constraints: MediaStreamConstraints): PromiseLike<MediaStream>;
- addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12579,13 +11614,20 @@ declare var MediaSource: {
isTypeSupported(type: string): boolean;
}
+interface MediaStreamEventMap {
+ "active": Event;
+ "addtrack": TrackEvent;
+ "inactive": Event;
+ "removetrack": TrackEvent;
+}
+
interface MediaStream extends EventTarget {
readonly active: boolean;
readonly id: string;
- onactive: (this: this, ev: Event) => any;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- oninactive: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onactive: (this: MediaStream, ev: Event) => any;
+ onaddtrack: (this: MediaStream, ev: TrackEvent) => any;
+ oninactive: (this: MediaStream, ev: Event) => any;
+ onremovetrack: (this: MediaStream, ev: TrackEvent) => any;
addTrack(track: MediaStreamTrack): void;
clone(): MediaStream;
getAudioTracks(): MediaStreamTrack[];
@@ -12594,10 +11636,7 @@ interface MediaStream extends EventTarget {
getVideoTracks(): MediaStreamTrack[];
removeTrack(track: MediaStreamTrack): void;
stop(): void;
- addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12634,16 +11673,23 @@ declare var MediaStreamErrorEvent: {
new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;
}
+interface MediaStreamTrackEventMap {
+ "ended": MediaStreamErrorEvent;
+ "mute": Event;
+ "overconstrained": MediaStreamErrorEvent;
+ "unmute": Event;
+}
+
interface MediaStreamTrack extends EventTarget {
enabled: boolean;
readonly id: string;
readonly kind: string;
readonly label: string;
readonly muted: boolean;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onmute: (this: this, ev: Event) => any;
- onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any;
- onunmute: (this: this, ev: Event) => any;
+ onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onmute: (this: MediaStreamTrack, ev: Event) => any;
+ onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onunmute: (this: MediaStreamTrack, ev: Event) => any;
readonly readonly: boolean;
readonly readyState: string;
readonly remote: boolean;
@@ -12653,10 +11699,7 @@ interface MediaStreamTrack extends EventTarget {
getConstraints(): MediaTrackConstraints;
getSettings(): MediaTrackSettings;
stop(): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12697,12 +11740,16 @@ declare var MessageEvent: {
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
}
+interface MessagePortEventMap {
+ "message": MessageEvent;
+}
+
interface MessagePort extends EventTarget {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: MessagePort, ev: MessageEvent) => any;
close(): void;
postMessage(message?: any, ports?: any): void;
start(): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12880,7 +11927,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike<MediaKeySystemAccess>;
vibrate(pattern: number | number[]): boolean;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var Navigator: {
@@ -13055,10 +12101,14 @@ declare var OfflineAudioCompletionEvent: {
new(): OfflineAudioCompletionEvent;
}
+interface OfflineAudioContextEventMap {
+ "complete": Event;
+}
+
interface OfflineAudioContext extends AudioContext {
- oncomplete: (this: this, ev: Event) => any;
+ oncomplete: (this: OfflineAudioContext, ev: Event) => any;
startRendering(): PromiseLike<AudioBuffer>;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13067,15 +12117,19 @@ declare var OfflineAudioContext: {
new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
+interface OscillatorNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface OscillatorNode extends AudioNode {
readonly detune: AudioParam;
readonly frequency: AudioParam;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;
type: string;
setPeriodicWave(periodicWave: PeriodicWave): void;
start(when?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OscillatorNodeEventMap>(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13454,9 +12508,14 @@ declare var RTCDTMFToneChangeEvent: {
new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;
}
+interface RTCDtlsTransportEventMap {
+ "dtlsstatechange": RTCDtlsTransportStateChangedEvent;
+ "error": ErrorEvent;
+}
+
interface RTCDtlsTransport extends RTCStatsProvider {
- ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
+ onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;
readonly state: string;
readonly transport: RTCIceTransport;
getLocalParameters(): RTCDtlsParameters;
@@ -13464,8 +12523,7 @@ interface RTCDtlsTransport extends RTCStatsProvider {
getRemoteParameters(): RTCDtlsParameters | null;
start(remoteParameters: RTCDtlsParameters): void;
stop(): void;
- addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtlsTransportEventMap>(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13483,15 +12541,19 @@ declare var RTCDtlsTransportStateChangedEvent: {
new(): RTCDtlsTransportStateChangedEvent;
}
+interface RTCDtmfSenderEventMap {
+ "tonechange": RTCDTMFToneChangeEvent;
+}
+
interface RTCDtmfSender extends EventTarget {
readonly canInsertDTMF: boolean;
readonly duration: number;
readonly interToneGap: number;
- ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any;
+ ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;
readonly sender: RTCRtpSender;
readonly toneBuffer: string;
insertDTMF(tones: string, duration?: number, interToneGap?: number): void;
- addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtmfSenderEventMap>(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13509,15 +12571,19 @@ declare var RTCIceCandidatePairChangedEvent: {
new(): RTCIceCandidatePairChangedEvent;
}
+interface RTCIceGathererEventMap {
+ "error": ErrorEvent;
+ "localcandidate": RTCIceGathererEvent;
+}
+
interface RTCIceGatherer extends RTCStatsProvider {
readonly component: string;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null;
+ onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;
+ onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;
createAssociatedGatherer(): RTCIceGatherer;
getLocalCandidates(): RTCIceCandidate[];
getLocalParameters(): RTCIceParameters;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceGathererEventMap>(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13535,11 +12601,16 @@ declare var RTCIceGathererEvent: {
new(): RTCIceGathererEvent;
}
+interface RTCIceTransportEventMap {
+ "candidatepairchange": RTCIceCandidatePairChangedEvent;
+ "icestatechange": RTCIceTransportStateChangedEvent;
+}
+
interface RTCIceTransport extends RTCStatsProvider {
readonly component: string;
readonly iceGatherer: RTCIceGatherer | null;
- oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null;
- onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null;
+ oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;
+ onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;
readonly role: string;
readonly state: string;
addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;
@@ -13550,8 +12621,7 @@ interface RTCIceTransport extends RTCStatsProvider {
setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;
start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;
stop(): void;
- addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13569,8 +12639,12 @@ declare var RTCIceTransportStateChangedEvent: {
new(): RTCIceTransportStateChangedEvent;
}
+interface RTCRtpReceiverEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCRtpReceiver extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack | null;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -13579,7 +12653,7 @@ interface RTCRtpReceiver extends RTCStatsProvider {
requestSendCSRC(csrc: number): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpReceiverEventMap>(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13589,9 +12663,14 @@ declare var RTCRtpReceiver: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCRtpSenderEventMap {
+ "error": ErrorEvent;
+ "ssrcconflict": RTCSsrcConflictEvent;
+}
+
interface RTCRtpSender extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null;
+ onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;
+ onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -13599,8 +12678,7 @@ interface RTCRtpSender extends RTCStatsProvider {
setTrack(track: MediaStreamTrack): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpSenderEventMap>(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13610,10 +12688,14 @@ declare var RTCRtpSender: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCSrtpSdesTransportEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCSrtpSdesTransport extends EventTarget {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;
readonly transport: RTCIceTransport;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCSrtpSdesTransportEventMap>(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13688,6 +12770,7 @@ declare var Range: {
interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {
readonly target: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13844,6 +12927,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
readonly r: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13854,6 +12938,7 @@ declare var SVGCircleElement: {
interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {
readonly clipPathUnits: SVGAnimatedEnumeration;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13876,6 +12961,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement {
readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGComponentTransferFunctionElement: {
@@ -13890,6 +12977,7 @@ declare var SVGComponentTransferFunctionElement: {
}
interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13899,6 +12987,7 @@ declare var SVGDefsElement: {
}
interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13907,67 +12996,35 @@ declare var SVGDescElement: {
new(): SVGDescElement;
}
+interface SVGElementEventMap extends ElementEventMap {
+ "click": MouseEvent;
+ "dblclick": MouseEvent;
+ "focusin": FocusEvent;
+ "focusout": FocusEvent;
+ "load": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+}
+
interface SVGElement extends Element {
- onclick: (this: this, ev: MouseEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- onfocusin: (this: this, ev: FocusEvent) => any;
- onfocusout: (this: this, ev: FocusEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onclick: (this: SVGElement, ev: MouseEvent) => any;
+ ondblclick: (this: SVGElement, ev: MouseEvent) => any;
+ onfocusin: (this: SVGElement, ev: FocusEvent) => any;
+ onfocusout: (this: SVGElement, ev: FocusEvent) => any;
+ onload: (this: SVGElement, ev: Event) => any;
+ onmousedown: (this: SVGElement, ev: MouseEvent) => any;
+ onmousemove: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseout: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseover: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseup: (this: SVGElement, ev: MouseEvent) => any;
readonly ownerSVGElement: SVGSVGElement;
readonly viewportElement: SVGElement;
xmlbase: string;
className: any;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14007,6 +13064,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S
readonly cy: SVGAnimatedLength;
readonly rx: SVGAnimatedLength;
readonly ry: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14036,6 +13094,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib
readonly SVG_FEBLEND_MODE_SCREEN: number;
readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;
readonly SVG_FEBLEND_MODE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14070,6 +13129,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard
readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;
readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;
readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14085,6 +13145,7 @@ declare var SVGFEColorMatrixElement: {
interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14108,6 +13169,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt
readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;
readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;
readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14140,6 +13202,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand
readonly SVG_EDGEMODE_NONE: number;
readonly SVG_EDGEMODE_UNKNOWN: number;
readonly SVG_EDGEMODE_WRAP: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14158,6 +13221,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan
readonly kernelUnitLengthX: SVGAnimatedNumber;
readonly kernelUnitLengthY: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14177,6 +13241,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan
readonly SVG_CHANNEL_G: number;
readonly SVG_CHANNEL_R: number;
readonly SVG_CHANNEL_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14193,6 +13258,8 @@ declare var SVGFEDisplacementMapElement: {
interface SVGFEDistantLightElement extends SVGElement {
readonly azimuth: SVGAnimatedNumber;
readonly elevation: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEDistantLightElement: {
@@ -14201,6 +13268,7 @@ declare var SVGFEDistantLightElement: {
}
interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14246,6 +13314,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar
readonly stdDeviationX: SVGAnimatedNumber;
readonly stdDeviationY: SVGAnimatedNumber;
setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14256,6 +13325,7 @@ declare var SVGFEGaussianBlurElement: {
interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {
readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14265,6 +13335,7 @@ declare var SVGFEImageElement: {
}
interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14275,6 +13346,8 @@ declare var SVGFEMergeElement: {
interface SVGFEMergeNodeElement extends SVGElement {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEMergeNodeElement: {
@@ -14290,6 +13363,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;
readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;
readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14305,6 +13379,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri
readonly dx: SVGAnimatedNumber;
readonly dy: SVGAnimatedNumber;
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14317,6 +13392,8 @@ interface SVGFEPointLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEPointLightElement: {
@@ -14331,6 +13408,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta
readonly specularConstant: SVGAnimatedNumber;
readonly specularExponent: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14348,6 +13426,8 @@ interface SVGFESpotLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFESpotLightElement: {
@@ -14357,6 +13437,7 @@ declare var SVGFESpotLightElement: {
interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14378,6 +13459,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;
readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;
readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14402,6 +13484,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
setFilterRes(filterResX: number, filterResY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14415,6 +13498,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14424,6 +13508,7 @@ declare var SVGForeignObjectElement: {
}
interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14440,6 +13525,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc
readonly SVG_SPREADMETHOD_REFLECT: number;
readonly SVG_SPREADMETHOD_REPEAT: number;
readonly SVG_SPREADMETHOD_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14458,6 +13544,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14523,6 +13610,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly x2: SVGAnimatedLength;
readonly y1: SVGAnimatedLength;
readonly y2: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14559,6 +13647,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt
readonly SVG_MARKER_ORIENT_ANGLE: number;
readonly SVG_MARKER_ORIENT_AUTO: number;
readonly SVG_MARKER_ORIENT_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14580,6 +13669,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14614,6 +13704,8 @@ declare var SVGMatrix: {
}
interface SVGMetadataElement extends SVGElement {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGMetadataElement: {
@@ -14669,6 +13761,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
getPathSegAtLength(distance: number): number;
getPointAtLength(distance: number): SVGPoint;
getTotalLength(): number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14961,6 +14054,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14997,6 +14091,7 @@ declare var SVGPointList: {
}
interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15006,6 +14101,7 @@ declare var SVGPolygonElement: {
}
interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15084,6 +14180,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15092,18 +14189,27 @@ declare var SVGRectElement: {
new(): SVGRectElement;
}
+interface SVGSVGElementEventMap extends SVGElementEventMap {
+ "SVGAbort": Event;
+ "SVGError": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "SVGUnload": Event;
+ "SVGZoom": SVGZoomEvent;
+}
+
interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
contentScriptType: string;
contentStyleType: string;
currentScale: number;
readonly currentTranslate: SVGPoint;
readonly height: SVGAnimatedLength;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onzoom: (this: this, ev: SVGZoomEvent) => any;
+ onabort: (this: SVGSVGElement, ev: Event) => any;
+ onerror: (this: SVGSVGElement, ev: Event) => any;
+ onresize: (this: SVGSVGElement, ev: UIEvent) => any;
+ onscroll: (this: SVGSVGElement, ev: UIEvent) => any;
+ onunload: (this: SVGSVGElement, ev: Event) => any;
+ onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;
readonly pixelUnitToMillimeterX: number;
readonly pixelUnitToMillimeterY: number;
readonly screenPixelToMillimeterX: number;
@@ -15135,58 +14241,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest
unpauseAnimations(): void;
unsuspendRedraw(suspendHandleID: number): void;
unsuspendRedrawAll(): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15197,6 +14252,7 @@ declare var SVGSVGElement: {
interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15207,6 +14263,7 @@ declare var SVGScriptElement: {
interface SVGStopElement extends SVGElement, SVGStylable {
readonly offset: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15236,6 +14293,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace {
media: string;
title: string;
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15245,6 +14303,7 @@ declare var SVGStyleElement: {
}
interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15254,6 +14313,7 @@ declare var SVGSwitchElement: {
}
interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15285,6 +14345,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa
readonly LENGTHADJUST_SPACING: number;
readonly LENGTHADJUST_SPACINGANDGLYPHS: number;
readonly LENGTHADJUST_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15297,7 +14358,6 @@ declare var SVGTextContentElement: {
}
interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextElement: {
@@ -15315,7 +14375,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {
readonly TEXTPATH_SPACINGTYPE_AUTO: number;
readonly TEXTPATH_SPACINGTYPE_EXACT: number;
readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextPathElement: {
@@ -15343,6 +14402,7 @@ declare var SVGTextPositioningElement: {
}
interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15414,6 +14474,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15424,6 +14485,7 @@ declare var SVGUseElement: {
interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
readonly viewTarget: SVGStringList;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15455,6 +14517,10 @@ declare var SVGZoomEvent: {
new(): SVGZoomEvent;
}
+interface ScreenEventMap {
+ "MSOrientationChange": Event;
+}
+
interface Screen extends EventTarget {
readonly availHeight: number;
readonly availWidth: number;
@@ -15467,14 +14533,14 @@ interface Screen extends EventTarget {
readonly logicalXDPI: number;
readonly logicalYDPI: number;
readonly msOrientation: string;
- onmsorientationchange: (this: this, ev: Event) => any;
+ onmsorientationchange: (this: Screen, ev: Event) => any;
readonly pixelDepth: number;
readonly systemXDPI: number;
readonly systemYDPI: number;
readonly width: number;
msLockOrientation(orientations: string | string[]): boolean;
msUnlockOrientation(): void;
- addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ScreenEventMap>(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15493,10 +14559,14 @@ declare var ScriptNotifyEvent: {
new(): ScriptNotifyEvent;
}
+interface ScriptProcessorNodeEventMap {
+ "audioprocess": AudioProcessingEvent;
+}
+
interface ScriptProcessorNode extends AudioNode {
readonly bufferSize: number;
- onaudioprocess: (this: this, ev: AudioProcessingEvent) => any;
- addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void;
+ onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;
+ addEventListener<K extends keyof ScriptProcessorNodeEventMap>(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15678,6 +14748,7 @@ declare var SubtleCrypto: {
interface Text extends CharacterData {
readonly wholeText: string;
+ readonly assignedSlot: HTMLSlotElement | null;
splitText(offset: number): Text;
}
@@ -15727,6 +14798,12 @@ declare var TextMetrics: {
new(): TextMetrics;
}
+interface TextTrackEventMap {
+ "cuechange": Event;
+ "error": ErrorEvent;
+ "load": Event;
+}
+
interface TextTrack extends EventTarget {
readonly activeCues: TextTrackCueList;
readonly cues: TextTrackCueList;
@@ -15735,9 +14812,9 @@ interface TextTrack extends EventTarget {
readonly label: string;
readonly language: string;
mode: any;
- oncuechange: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
+ oncuechange: (this: TextTrack, ev: Event) => any;
+ onerror: (this: TextTrack, ev: ErrorEvent) => any;
+ onload: (this: TextTrack, ev: Event) => any;
readonly readyState: number;
addCue(cue: TextTrackCue): void;
removeCue(cue: TextTrackCue): void;
@@ -15748,9 +14825,7 @@ interface TextTrack extends EventTarget {
readonly LOADING: number;
readonly NONE: number;
readonly SHOWING: number;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15766,18 +14841,22 @@ declare var TextTrack: {
readonly SHOWING: number;
}
+interface TextTrackCueEventMap {
+ "enter": Event;
+ "exit": Event;
+}
+
interface TextTrackCue extends EventTarget {
endTime: number;
id: string;
- onenter: (this: this, ev: Event) => any;
- onexit: (this: this, ev: Event) => any;
+ onenter: (this: TextTrackCue, ev: Event) => any;
+ onexit: (this: TextTrackCue, ev: Event) => any;
pauseOnExit: boolean;
startTime: number;
text: string;
readonly track: TextTrack;
getCueAsHTML(): DocumentFragment;
- addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15798,11 +14877,15 @@ declare var TextTrackCueList: {
new(): TextTrackCueList;
}
+interface TextTrackListEventMap {
+ "addtrack": TrackEvent;
+}
+
interface TextTrackList extends EventTarget {
readonly length: number;
- onaddtrack: ((this: this, ev: TrackEvent) => any) | null;
+ onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;
item(index: number): TextTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackListEventMap>(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: TextTrack;
}
@@ -15992,17 +15075,21 @@ declare var VideoTrack: {
new(): VideoTrack;
}
+interface VideoTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface VideoTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;
+ onchange: (this: VideoTrackList, ev: Event) => any;
+ onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;
readonly selectedIndex: number;
getTrackById(id: string): VideoTrack | null;
item(index: number): VideoTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof VideoTrackListEventMap>(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: VideoTrack;
}
@@ -16948,14 +16035,21 @@ declare var WebKitPoint: {
new(x?: number, y?: number): WebKitPoint;
}
+interface WebSocketEventMap {
+ "close": CloseEvent;
+ "error": ErrorEvent;
+ "message": MessageEvent;
+ "open": Event;
+}
+
interface WebSocket extends EventTarget {
binaryType: string;
readonly bufferedAmount: number;
readonly extensions: string;
- onclose: (this: this, ev: CloseEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onopen: (this: this, ev: Event) => any;
+ onclose: (this: WebSocket, ev: CloseEvent) => any;
+ onerror: (this: WebSocket, ev: ErrorEvent) => any;
+ onmessage: (this: WebSocket, ev: MessageEvent) => any;
+ onopen: (this: WebSocket, ev: Event) => any;
readonly protocol: string;
readonly readyState: number;
readonly url: string;
@@ -16965,10 +16059,7 @@ interface WebSocket extends EventTarget {
readonly CLOSING: number;
readonly CONNECTING: number;
readonly OPEN: number;
- addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17004,6 +16095,95 @@ declare var WheelEvent: {
readonly DOM_DELTA_PIXEL: number;
}
+interface WindowEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "compassneedscalibration": Event;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "devicelight": DeviceLightEvent;
+ "devicemotion": DeviceMotionEvent;
+ "deviceorientation": DeviceOrientationEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "message": MessageEvent;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "popstate": PopStateEvent;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "stalled": Event;
+ "storage": StorageEvent;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "unload": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {
readonly applicationCache: ApplicationCache;
readonly clientInformation: Navigator;
@@ -17028,97 +16208,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
name: string;
readonly navigator: Navigator;
offscreenBuffering: string | boolean;
- onabort: (this: this, ev: UIEvent) => any;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncompassneedscalibration: (this: this, ev: Event) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondevicelight: (this: this, ev: DeviceLightEvent) => any;
- ondevicemotion: (this: this, ev: DeviceMotionEvent) => any;
- ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onabort: (this: Window, ev: UIEvent) => any;
+ onafterprint: (this: Window, ev: Event) => any;
+ onbeforeprint: (this: Window, ev: Event) => any;
+ onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;
+ onblur: (this: Window, ev: FocusEvent) => any;
+ oncanplay: (this: Window, ev: Event) => any;
+ oncanplaythrough: (this: Window, ev: Event) => any;
+ onchange: (this: Window, ev: Event) => any;
+ onclick: (this: Window, ev: MouseEvent) => any;
+ oncompassneedscalibration: (this: Window, ev: Event) => any;
+ oncontextmenu: (this: Window, ev: PointerEvent) => any;
+ ondblclick: (this: Window, ev: MouseEvent) => any;
+ ondevicelight: (this: Window, ev: DeviceLightEvent) => any;
+ ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;
+ ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;
+ ondrag: (this: Window, ev: DragEvent) => any;
+ ondragend: (this: Window, ev: DragEvent) => any;
+ ondragenter: (this: Window, ev: DragEvent) => any;
+ ondragleave: (this: Window, ev: DragEvent) => any;
+ ondragover: (this: Window, ev: DragEvent) => any;
+ ondragstart: (this: Window, ev: DragEvent) => any;
+ ondrop: (this: Window, ev: DragEvent) => any;
+ ondurationchange: (this: Window, ev: Event) => any;
+ onemptied: (this: Window, ev: Event) => any;
+ onended: (this: Window, ev: MediaStreamErrorEvent) => any;
onerror: ErrorEventHandler;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
- onreset: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onstalled: (this: this, ev: Event) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
+ onfocus: (this: Window, ev: FocusEvent) => any;
+ onhashchange: (this: Window, ev: HashChangeEvent) => any;
+ oninput: (this: Window, ev: Event) => any;
+ oninvalid: (this: Window, ev: Event) => any;
+ onkeydown: (this: Window, ev: KeyboardEvent) => any;
+ onkeypress: (this: Window, ev: KeyboardEvent) => any;
+ onkeyup: (this: Window, ev: KeyboardEvent) => any;
+ onload: (this: Window, ev: Event) => any;
+ onloadeddata: (this: Window, ev: Event) => any;
+ onloadedmetadata: (this: Window, ev: Event) => any;
+ onloadstart: (this: Window, ev: Event) => any;
+ onmessage: (this: Window, ev: MessageEvent) => any;
+ onmousedown: (this: Window, ev: MouseEvent) => any;
+ onmouseenter: (this: Window, ev: MouseEvent) => any;
+ onmouseleave: (this: Window, ev: MouseEvent) => any;
+ onmousemove: (this: Window, ev: MouseEvent) => any;
+ onmouseout: (this: Window, ev: MouseEvent) => any;
+ onmouseover: (this: Window, ev: MouseEvent) => any;
+ onmouseup: (this: Window, ev: MouseEvent) => any;
+ onmousewheel: (this: Window, ev: WheelEvent) => any;
+ onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;
+ onmspointercancel: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Window, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Window, ev: MSPointerEvent) => any;
+ onoffline: (this: Window, ev: Event) => any;
+ ononline: (this: Window, ev: Event) => any;
+ onorientationchange: (this: Window, ev: Event) => any;
+ onpagehide: (this: Window, ev: PageTransitionEvent) => any;
+ onpageshow: (this: Window, ev: PageTransitionEvent) => any;
+ onpause: (this: Window, ev: Event) => any;
+ onplay: (this: Window, ev: Event) => any;
+ onplaying: (this: Window, ev: Event) => any;
+ onpopstate: (this: Window, ev: PopStateEvent) => any;
+ onprogress: (this: Window, ev: ProgressEvent) => any;
+ onratechange: (this: Window, ev: Event) => any;
+ onreadystatechange: (this: Window, ev: ProgressEvent) => any;
+ onreset: (this: Window, ev: Event) => any;
+ onresize: (this: Window, ev: UIEvent) => any;
+ onscroll: (this: Window, ev: UIEvent) => any;
+ onseeked: (this: Window, ev: Event) => any;
+ onseeking: (this: Window, ev: Event) => any;
+ onselect: (this: Window, ev: UIEvent) => any;
+ onstalled: (this: Window, ev: Event) => any;
+ onstorage: (this: Window, ev: StorageEvent) => any;
+ onsubmit: (this: Window, ev: Event) => any;
+ onsuspend: (this: Window, ev: Event) => any;
+ ontimeupdate: (this: Window, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onunload: (this: Window, ev: Event) => any;
+ onvolumechange: (this: Window, ev: Event) => any;
+ onwaiting: (this: Window, ev: Event) => any;
opener: any;
orientation: string | number;
readonly outerHeight: number;
@@ -17177,101 +16357,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17280,12 +16366,15 @@ declare var Window: {
new(): Window;
}
+interface WorkerEventMap extends AbstractWorkerEventMap {
+ "message": MessageEvent;
+}
+
interface Worker extends EventTarget, AbstractWorker {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: Worker, ev: MessageEvent) => any;
postMessage(message: any, ports?: any): void;
terminate(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17295,6 +16384,8 @@ declare var Worker: {
}
interface XMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLDocument: {
@@ -17302,8 +16393,12 @@ declare var XMLDocument: {
new(): XMLDocument;
}
+interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
+ "readystatechange": Event;
+}
+
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
- onreadystatechange: (this: this, ev: Event) => any;
+ onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
@@ -17331,14 +16426,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
- addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17354,6 +16442,7 @@ declare var XMLHttpRequest: {
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17374,7 +16463,7 @@ declare var XMLSerializer: {
interface XPathEvaluator {
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
createNSResolver(nodeResolver?: Node): XPathNSResolver;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathEvaluator: {
@@ -17383,7 +16472,7 @@ declare var XPathEvaluator: {
}
interface XPathExpression {
- evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression;
+ evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathExpression: {
@@ -17453,9 +16542,13 @@ declare var XSLTProcessor: {
new(): XSLTProcessor;
}
+interface AbstractWorkerEventMap {
+ "error": ErrorEvent;
+}
+
interface AbstractWorker {
- onerror: (this: this, ev: ErrorEvent) => any;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ onerror: (this: AbstractWorker, ev: ErrorEvent) => any;
+ addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17566,25 +16659,29 @@ interface GetSVGDocument {
getSVGDocument(): Document;
}
+interface GlobalEventHandlersEventMap {
+ "pointercancel": PointerEvent;
+ "pointerdown": PointerEvent;
+ "pointerenter": PointerEvent;
+ "pointerleave": PointerEvent;
+ "pointermove": PointerEvent;
+ "pointerout": PointerEvent;
+ "pointerover": PointerEvent;
+ "pointerup": PointerEvent;
+ "wheel": WheelEvent;
+}
+
interface GlobalEventHandlers {
- onpointercancel: (this: this, ev: PointerEvent) => any;
- onpointerdown: (this: this, ev: PointerEvent) => any;
- onpointerenter: (this: this, ev: PointerEvent) => any;
- onpointerleave: (this: this, ev: PointerEvent) => any;
- onpointermove: (this: this, ev: PointerEvent) => any;
- onpointerout: (this: this, ev: PointerEvent) => any;
- onpointerover: (this: this, ev: PointerEvent) => any;
- onpointerup: (this: this, ev: PointerEvent) => any;
- onwheel: (this: this, ev: WheelEvent) => any;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
+ addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17611,25 +16708,29 @@ interface LinkStyle {
readonly sheet: StyleSheet;
}
+interface MSBaseReaderEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+}
+
interface MSBaseReader {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onabort: (this: MSBaseReader, ev: Event) => any;
+ onerror: (this: MSBaseReader, ev: ErrorEvent) => any;
+ onload: (this: MSBaseReader, ev: Event) => any;
+ onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;
+ onloadstart: (this: MSBaseReader, ev: Event) => any;
+ onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;
readonly readyState: number;
readonly result: any;
abort(): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17678,359 +16779,9 @@ interface NavigatorUserMedia {
}
interface NodeSelector {
- querySelector(selectors: "a"): HTMLAnchorElement | null;
- querySelector(selectors: "abbr"): HTMLElement | null;
- querySelector(selectors: "acronym"): HTMLElement | null;
- querySelector(selectors: "address"): HTMLElement | null;
- querySelector(selectors: "applet"): HTMLAppletElement | null;
- querySelector(selectors: "area"): HTMLAreaElement | null;
- querySelector(selectors: "article"): HTMLElement | null;
- querySelector(selectors: "aside"): HTMLElement | null;
- querySelector(selectors: "audio"): HTMLAudioElement | null;
- querySelector(selectors: "b"): HTMLElement | null;
- querySelector(selectors: "base"): HTMLBaseElement | null;
- querySelector(selectors: "basefont"): HTMLBaseFontElement | null;
- querySelector(selectors: "bdo"): HTMLElement | null;
- querySelector(selectors: "big"): HTMLElement | null;
- querySelector(selectors: "blockquote"): HTMLQuoteElement | null;
- querySelector(selectors: "body"): HTMLBodyElement | null;
- querySelector(selectors: "br"): HTMLBRElement | null;
- querySelector(selectors: "button"): HTMLButtonElement | null;
- querySelector(selectors: "canvas"): HTMLCanvasElement | null;
- querySelector(selectors: "caption"): HTMLTableCaptionElement | null;
- querySelector(selectors: "center"): HTMLElement | null;
- querySelector(selectors: "circle"): SVGCircleElement | null;
- querySelector(selectors: "cite"): HTMLElement | null;
- querySelector(selectors: "clippath"): SVGClipPathElement | null;
- querySelector(selectors: "code"): HTMLElement | null;
- querySelector(selectors: "col"): HTMLTableColElement | null;
- querySelector(selectors: "colgroup"): HTMLTableColElement | null;
- querySelector(selectors: "datalist"): HTMLDataListElement | null;
- querySelector(selectors: "dd"): HTMLElement | null;
- querySelector(selectors: "defs"): SVGDefsElement | null;
- querySelector(selectors: "del"): HTMLModElement | null;
- querySelector(selectors: "desc"): SVGDescElement | null;
- querySelector(selectors: "dfn"): HTMLElement | null;
- querySelector(selectors: "dir"): HTMLDirectoryElement | null;
- querySelector(selectors: "div"): HTMLDivElement | null;
- querySelector(selectors: "dl"): HTMLDListElement | null;
- querySelector(selectors: "dt"): HTMLElement | null;
- querySelector(selectors: "ellipse"): SVGEllipseElement | null;
- querySelector(selectors: "em"): HTMLElement | null;
- querySelector(selectors: "embed"): HTMLEmbedElement | null;
- querySelector(selectors: "feblend"): SVGFEBlendElement | null;
- querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement | null;
- querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement | null;
- querySelector(selectors: "fecomposite"): SVGFECompositeElement | null;
- querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement | null;
- querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement | null;
- querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement | null;
- querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement | null;
- querySelector(selectors: "feflood"): SVGFEFloodElement | null;
- querySelector(selectors: "fefunca"): SVGFEFuncAElement | null;
- querySelector(selectors: "fefuncb"): SVGFEFuncBElement | null;
- querySelector(selectors: "fefuncg"): SVGFEFuncGElement | null;
- querySelector(selectors: "fefuncr"): SVGFEFuncRElement | null;
- querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement | null;
- querySelector(selectors: "feimage"): SVGFEImageElement | null;
- querySelector(selectors: "femerge"): SVGFEMergeElement | null;
- querySelector(selectors: "femergenode"): SVGFEMergeNodeElement | null;
- querySelector(selectors: "femorphology"): SVGFEMorphologyElement | null;
- querySelector(selectors: "feoffset"): SVGFEOffsetElement | null;
- querySelector(selectors: "fepointlight"): SVGFEPointLightElement | null;
- querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement | null;
- querySelector(selectors: "fespotlight"): SVGFESpotLightElement | null;
- querySelector(selectors: "fetile"): SVGFETileElement | null;
- querySelector(selectors: "feturbulence"): SVGFETurbulenceElement | null;
- querySelector(selectors: "fieldset"): HTMLFieldSetElement | null;
- querySelector(selectors: "figcaption"): HTMLElement | null;
- querySelector(selectors: "figure"): HTMLElement | null;
- querySelector(selectors: "filter"): SVGFilterElement | null;
- querySelector(selectors: "font"): HTMLFontElement | null;
- querySelector(selectors: "footer"): HTMLElement | null;
- querySelector(selectors: "foreignobject"): SVGForeignObjectElement | null;
- querySelector(selectors: "form"): HTMLFormElement | null;
- querySelector(selectors: "frame"): HTMLFrameElement | null;
- querySelector(selectors: "frameset"): HTMLFrameSetElement | null;
- querySelector(selectors: "g"): SVGGElement | null;
- querySelector(selectors: "h1"): HTMLHeadingElement | null;
- querySelector(selectors: "h2"): HTMLHeadingElement | null;
- querySelector(selectors: "h3"): HTMLHeadingElement | null;
- querySelector(selectors: "h4"): HTMLHeadingElement | null;
- querySelector(selectors: "h5"): HTMLHeadingElement | null;
- querySelector(selectors: "h6"): HTMLHeadingElement | null;
- querySelector(selectors: "head"): HTMLHeadElement | null;
- querySelector(selectors: "header"): HTMLElement | null;
- querySelector(selectors: "hgroup"): HTMLElement | null;
- querySelector(selectors: "hr"): HTMLHRElement | null;
- querySelector(selectors: "html"): HTMLHtmlElement | null;
- querySelector(selectors: "i"): HTMLElement | null;
- querySelector(selectors: "iframe"): HTMLIFrameElement | null;
- querySelector(selectors: "image"): SVGImageElement | null;
- querySelector(selectors: "img"): HTMLImageElement | null;
- querySelector(selectors: "input"): HTMLInputElement | null;
- querySelector(selectors: "ins"): HTMLModElement | null;
- querySelector(selectors: "isindex"): HTMLUnknownElement | null;
- querySelector(selectors: "kbd"): HTMLElement | null;
- querySelector(selectors: "keygen"): HTMLElement | null;
- querySelector(selectors: "label"): HTMLLabelElement | null;
- querySelector(selectors: "legend"): HTMLLegendElement | null;
- querySelector(selectors: "li"): HTMLLIElement | null;
- querySelector(selectors: "line"): SVGLineElement | null;
- querySelector(selectors: "lineargradient"): SVGLinearGradientElement | null;
- querySelector(selectors: "link"): HTMLLinkElement | null;
- querySelector(selectors: "listing"): HTMLPreElement | null;
- querySelector(selectors: "map"): HTMLMapElement | null;
- querySelector(selectors: "mark"): HTMLElement | null;
- querySelector(selectors: "marker"): SVGMarkerElement | null;
- querySelector(selectors: "marquee"): HTMLMarqueeElement | null;
- querySelector(selectors: "mask"): SVGMaskElement | null;
- querySelector(selectors: "menu"): HTMLMenuElement | null;
- querySelector(selectors: "meta"): HTMLMetaElement | null;
- querySelector(selectors: "metadata"): SVGMetadataElement | null;
- querySelector(selectors: "meter"): HTMLMeterElement | null;
- querySelector(selectors: "nav"): HTMLElement | null;
- querySelector(selectors: "nextid"): HTMLUnknownElement | null;
- querySelector(selectors: "nobr"): HTMLElement | null;
- querySelector(selectors: "noframes"): HTMLElement | null;
- querySelector(selectors: "noscript"): HTMLElement | null;
- querySelector(selectors: "object"): HTMLObjectElement | null;
- querySelector(selectors: "ol"): HTMLOListElement | null;
- querySelector(selectors: "optgroup"): HTMLOptGroupElement | null;
- querySelector(selectors: "option"): HTMLOptionElement | null;
- querySelector(selectors: "p"): HTMLParagraphElement | null;
- querySelector(selectors: "param"): HTMLParamElement | null;
- querySelector(selectors: "path"): SVGPathElement | null;
- querySelector(selectors: "pattern"): SVGPatternElement | null;
- querySelector(selectors: "picture"): HTMLPictureElement | null;
- querySelector(selectors: "plaintext"): HTMLElement | null;
- querySelector(selectors: "polygon"): SVGPolygonElement | null;
- querySelector(selectors: "polyline"): SVGPolylineElement | null;
- querySelector(selectors: "pre"): HTMLPreElement | null;
- querySelector(selectors: "progress"): HTMLProgressElement | null;
- querySelector(selectors: "q"): HTMLQuoteElement | null;
- querySelector(selectors: "radialgradient"): SVGRadialGradientElement | null;
- querySelector(selectors: "rect"): SVGRectElement | null;
- querySelector(selectors: "rt"): HTMLElement | null;
- querySelector(selectors: "ruby"): HTMLElement | null;
- querySelector(selectors: "s"): HTMLElement | null;
- querySelector(selectors: "samp"): HTMLElement | null;
- querySelector(selectors: "script"): HTMLScriptElement | null;
- querySelector(selectors: "section"): HTMLElement | null;
- querySelector(selectors: "select"): HTMLSelectElement | null;
- querySelector(selectors: "small"): HTMLElement | null;
- querySelector(selectors: "source"): HTMLSourceElement | null;
- querySelector(selectors: "span"): HTMLSpanElement | null;
- querySelector(selectors: "stop"): SVGStopElement | null;
- querySelector(selectors: "strike"): HTMLElement | null;
- querySelector(selectors: "strong"): HTMLElement | null;
- querySelector(selectors: "style"): HTMLStyleElement | null;
- querySelector(selectors: "sub"): HTMLElement | null;
- querySelector(selectors: "sup"): HTMLElement | null;
- querySelector(selectors: "svg"): SVGSVGElement | null;
- querySelector(selectors: "switch"): SVGSwitchElement | null;
- querySelector(selectors: "symbol"): SVGSymbolElement | null;
- querySelector(selectors: "table"): HTMLTableElement | null;
- querySelector(selectors: "tbody"): HTMLTableSectionElement | null;
- querySelector(selectors: "td"): HTMLTableDataCellElement | null;
- querySelector(selectors: "template"): HTMLTemplateElement | null;
- querySelector(selectors: "text"): SVGTextElement | null;
- querySelector(selectors: "textpath"): SVGTextPathElement | null;
- querySelector(selectors: "textarea"): HTMLTextAreaElement | null;
- querySelector(selectors: "tfoot"): HTMLTableSectionElement | null;
- querySelector(selectors: "th"): HTMLTableHeaderCellElement | null;
- querySelector(selectors: "thead"): HTMLTableSectionElement | null;
- querySelector(selectors: "title"): HTMLTitleElement | null;
- querySelector(selectors: "tr"): HTMLTableRowElement | null;
- querySelector(selectors: "track"): HTMLTrackElement | null;
- querySelector(selectors: "tspan"): SVGTSpanElement | null;
- querySelector(selectors: "tt"): HTMLElement | null;
- querySelector(selectors: "u"): HTMLElement | null;
- querySelector(selectors: "ul"): HTMLUListElement | null;
- querySelector(selectors: "use"): SVGUseElement | null;
- querySelector(selectors: "var"): HTMLElement | null;
- querySelector(selectors: "video"): HTMLVideoElement | null;
- querySelector(selectors: "view"): SVGViewElement | null;
- querySelector(selectors: "wbr"): HTMLElement | null;
- querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement | null;
- querySelector(selectors: "xmp"): HTMLPreElement | null;
+ querySelector<K extends keyof ElementTagNameMap>(selectors: K): ElementTagNameMap[K] | null;
querySelector(selectors: string): Element | null;
- querySelectorAll(selectors: "a"): NodeListOf<HTMLAnchorElement>;
- querySelectorAll(selectors: "abbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "acronym"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "address"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "applet"): NodeListOf<HTMLAppletElement>;
- querySelectorAll(selectors: "area"): NodeListOf<HTMLAreaElement>;
- querySelectorAll(selectors: "article"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "aside"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "audio"): NodeListOf<HTMLAudioElement>;
- querySelectorAll(selectors: "b"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "base"): NodeListOf<HTMLBaseElement>;
- querySelectorAll(selectors: "basefont"): NodeListOf<HTMLBaseFontElement>;
- querySelectorAll(selectors: "bdo"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "big"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "blockquote"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "body"): NodeListOf<HTMLBodyElement>;
- querySelectorAll(selectors: "br"): NodeListOf<HTMLBRElement>;
- querySelectorAll(selectors: "button"): NodeListOf<HTMLButtonElement>;
- querySelectorAll(selectors: "canvas"): NodeListOf<HTMLCanvasElement>;
- querySelectorAll(selectors: "caption"): NodeListOf<HTMLTableCaptionElement>;
- querySelectorAll(selectors: "center"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "circle"): NodeListOf<SVGCircleElement>;
- querySelectorAll(selectors: "cite"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "clippath"): NodeListOf<SVGClipPathElement>;
- querySelectorAll(selectors: "code"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "col"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "colgroup"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "datalist"): NodeListOf<HTMLDataListElement>;
- querySelectorAll(selectors: "dd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "defs"): NodeListOf<SVGDefsElement>;
- querySelectorAll(selectors: "del"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "desc"): NodeListOf<SVGDescElement>;
- querySelectorAll(selectors: "dfn"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "dir"): NodeListOf<HTMLDirectoryElement>;
- querySelectorAll(selectors: "div"): NodeListOf<HTMLDivElement>;
- querySelectorAll(selectors: "dl"): NodeListOf<HTMLDListElement>;
- querySelectorAll(selectors: "dt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ellipse"): NodeListOf<SVGEllipseElement>;
- querySelectorAll(selectors: "em"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "embed"): NodeListOf<HTMLEmbedElement>;
- querySelectorAll(selectors: "feblend"): NodeListOf<SVGFEBlendElement>;
- querySelectorAll(selectors: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- querySelectorAll(selectors: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- querySelectorAll(selectors: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- querySelectorAll(selectors: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- querySelectorAll(selectors: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- querySelectorAll(selectors: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- querySelectorAll(selectors: "feflood"): NodeListOf<SVGFEFloodElement>;
- querySelectorAll(selectors: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- querySelectorAll(selectors: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- querySelectorAll(selectors: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- querySelectorAll(selectors: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- querySelectorAll(selectors: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- querySelectorAll(selectors: "feimage"): NodeListOf<SVGFEImageElement>;
- querySelectorAll(selectors: "femerge"): NodeListOf<SVGFEMergeElement>;
- querySelectorAll(selectors: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- querySelectorAll(selectors: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- querySelectorAll(selectors: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- querySelectorAll(selectors: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- querySelectorAll(selectors: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- querySelectorAll(selectors: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- querySelectorAll(selectors: "fetile"): NodeListOf<SVGFETileElement>;
- querySelectorAll(selectors: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- querySelectorAll(selectors: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- querySelectorAll(selectors: "figcaption"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "figure"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "filter"): NodeListOf<SVGFilterElement>;
- querySelectorAll(selectors: "font"): NodeListOf<HTMLFontElement>;
- querySelectorAll(selectors: "footer"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- querySelectorAll(selectors: "form"): NodeListOf<HTMLFormElement>;
- querySelectorAll(selectors: "frame"): NodeListOf<HTMLFrameElement>;
- querySelectorAll(selectors: "frameset"): NodeListOf<HTMLFrameSetElement>;
- querySelectorAll(selectors: "g"): NodeListOf<SVGGElement>;
- querySelectorAll(selectors: "h1"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h2"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h3"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h4"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h5"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h6"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "head"): NodeListOf<HTMLHeadElement>;
- querySelectorAll(selectors: "header"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hgroup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hr"): NodeListOf<HTMLHRElement>;
- querySelectorAll(selectors: "html"): NodeListOf<HTMLHtmlElement>;
- querySelectorAll(selectors: "i"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "iframe"): NodeListOf<HTMLIFrameElement>;
- querySelectorAll(selectors: "image"): NodeListOf<SVGImageElement>;
- querySelectorAll(selectors: "img"): NodeListOf<HTMLImageElement>;
- querySelectorAll(selectors: "input"): NodeListOf<HTMLInputElement>;
- querySelectorAll(selectors: "ins"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "isindex"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "kbd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "keygen"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "label"): NodeListOf<HTMLLabelElement>;
- querySelectorAll(selectors: "legend"): NodeListOf<HTMLLegendElement>;
- querySelectorAll(selectors: "li"): NodeListOf<HTMLLIElement>;
- querySelectorAll(selectors: "line"): NodeListOf<SVGLineElement>;
- querySelectorAll(selectors: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- querySelectorAll(selectors: "link"): NodeListOf<HTMLLinkElement>;
- querySelectorAll(selectors: "listing"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "map"): NodeListOf<HTMLMapElement>;
- querySelectorAll(selectors: "mark"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "marker"): NodeListOf<SVGMarkerElement>;
- querySelectorAll(selectors: "marquee"): NodeListOf<HTMLMarqueeElement>;
- querySelectorAll(selectors: "mask"): NodeListOf<SVGMaskElement>;
- querySelectorAll(selectors: "menu"): NodeListOf<HTMLMenuElement>;
- querySelectorAll(selectors: "meta"): NodeListOf<HTMLMetaElement>;
- querySelectorAll(selectors: "metadata"): NodeListOf<SVGMetadataElement>;
- querySelectorAll(selectors: "meter"): NodeListOf<HTMLMeterElement>;
- querySelectorAll(selectors: "nav"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "nextid"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "nobr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noframes"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noscript"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "object"): NodeListOf<HTMLObjectElement>;
- querySelectorAll(selectors: "ol"): NodeListOf<HTMLOListElement>;
- querySelectorAll(selectors: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- querySelectorAll(selectors: "option"): NodeListOf<HTMLOptionElement>;
- querySelectorAll(selectors: "p"): NodeListOf<HTMLParagraphElement>;
- querySelectorAll(selectors: "param"): NodeListOf<HTMLParamElement>;
- querySelectorAll(selectors: "path"): NodeListOf<SVGPathElement>;
- querySelectorAll(selectors: "pattern"): NodeListOf<SVGPatternElement>;
- querySelectorAll(selectors: "picture"): NodeListOf<HTMLPictureElement>;
- querySelectorAll(selectors: "plaintext"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "polygon"): NodeListOf<SVGPolygonElement>;
- querySelectorAll(selectors: "polyline"): NodeListOf<SVGPolylineElement>;
- querySelectorAll(selectors: "pre"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "progress"): NodeListOf<HTMLProgressElement>;
- querySelectorAll(selectors: "q"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- querySelectorAll(selectors: "rect"): NodeListOf<SVGRectElement>;
- querySelectorAll(selectors: "rt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ruby"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "s"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "samp"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "script"): NodeListOf<HTMLScriptElement>;
- querySelectorAll(selectors: "section"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "select"): NodeListOf<HTMLSelectElement>;
- querySelectorAll(selectors: "small"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "source"): NodeListOf<HTMLSourceElement>;
- querySelectorAll(selectors: "span"): NodeListOf<HTMLSpanElement>;
- querySelectorAll(selectors: "stop"): NodeListOf<SVGStopElement>;
- querySelectorAll(selectors: "strike"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "strong"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "style"): NodeListOf<HTMLStyleElement>;
- querySelectorAll(selectors: "sub"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "sup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "svg"): NodeListOf<SVGSVGElement>;
- querySelectorAll(selectors: "switch"): NodeListOf<SVGSwitchElement>;
- querySelectorAll(selectors: "symbol"): NodeListOf<SVGSymbolElement>;
- querySelectorAll(selectors: "table"): NodeListOf<HTMLTableElement>;
- querySelectorAll(selectors: "tbody"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "td"): NodeListOf<HTMLTableDataCellElement>;
- querySelectorAll(selectors: "template"): NodeListOf<HTMLTemplateElement>;
- querySelectorAll(selectors: "text"): NodeListOf<SVGTextElement>;
- querySelectorAll(selectors: "textpath"): NodeListOf<SVGTextPathElement>;
- querySelectorAll(selectors: "textarea"): NodeListOf<HTMLTextAreaElement>;
- querySelectorAll(selectors: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- querySelectorAll(selectors: "thead"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "title"): NodeListOf<HTMLTitleElement>;
- querySelectorAll(selectors: "tr"): NodeListOf<HTMLTableRowElement>;
- querySelectorAll(selectors: "track"): NodeListOf<HTMLTrackElement>;
- querySelectorAll(selectors: "tspan"): NodeListOf<SVGTSpanElement>;
- querySelectorAll(selectors: "tt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "u"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ul"): NodeListOf<HTMLUListElement>;
- querySelectorAll(selectors: "use"): NodeListOf<SVGUseElement>;
- querySelectorAll(selectors: "var"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "video"): NodeListOf<HTMLVideoElement>;
- querySelectorAll(selectors: "view"): NodeListOf<SVGViewElement>;
- querySelectorAll(selectors: "wbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- querySelectorAll(selectors: "xmp"): NodeListOf<HTMLPreElement>;
+ querySelectorAll<K extends keyof ElementListTagNameMap>(selectors: K): ElementListTagNameMap[K];
querySelectorAll(selectors: string): NodeListOf<Element>;
}
@@ -18130,21 +16881,25 @@ interface WindowTimersExtension {
setImmediate(handler: any, ...args: any[]): number;
}
+interface XMLHttpRequestEventTargetEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+ "timeout": ProgressEvent;
+}
+
interface XMLHttpRequestEventTarget {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- ontimeout: (this: this, ev: ProgressEvent) => any;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;
+ onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -18404,6 +17159,33 @@ interface ParentNode {
readonly childElementCount: number;
}
+interface DocumentOrShadowRoot {
+ readonly activeElement: Element | null;
+ readonly stylesheets: StyleSheetList;
+ getSelection(): Selection | null;
+ elementFromPoint(x: number, y: number): Element | null;
+ elementsFromPoint(x: number, y: number): Element[];
+}
+
+interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {
+ readonly host: Element;
+ innerHTML: string;
+}
+
+interface ShadowRootInit {
+ mode: 'open'|'closed';
+ delegatesFocus?: boolean;
+}
+
+interface HTMLSlotElement extends HTMLElement {
+ name: string;
+ assignedNodes(options?: AssignedNodesOptions): Node[];
+}
+
+interface AssignedNodesOptions {
+ flatten?: boolean;
+}
+
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -18451,6 +17233,447 @@ interface NavigatorUserMediaErrorCallback {
interface ForEachCallback {
(keyId: any, status: string): void;
}
+interface HTMLElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "audio": HTMLAudioElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "del": HTMLModElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "embed": HTMLEmbedElement;
+ "fieldset": HTMLFieldSetElement;
+ "font": HTMLFontElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "iframe": HTMLIFrameElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "marquee": HTMLMarqueeElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "meter": HTMLMeterElement;
+ "nextid": HTMLUnknownElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "picture": HTMLPictureElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "script": HTMLScriptElement;
+ "select": HTMLSelectElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "style": HTMLStyleElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "ul": HTMLUListElement;
+ "video": HTMLVideoElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "abbr": HTMLElement;
+ "acronym": HTMLElement;
+ "address": HTMLElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "article": HTMLElement;
+ "aside": HTMLElement;
+ "audio": HTMLAudioElement;
+ "b": HTMLElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "bdo": HTMLElement;
+ "big": HTMLElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "center": HTMLElement;
+ "circle": SVGCircleElement;
+ "cite": HTMLElement;
+ "clippath": SVGClipPathElement;
+ "code": HTMLElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "dd": HTMLElement;
+ "defs": SVGDefsElement;
+ "del": HTMLModElement;
+ "desc": SVGDescElement;
+ "dfn": HTMLElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "dt": HTMLElement;
+ "ellipse": SVGEllipseElement;
+ "em": HTMLElement;
+ "embed": HTMLEmbedElement;
+ "feblend": SVGFEBlendElement;
+ "fecolormatrix": SVGFEColorMatrixElement;
+ "fecomponenttransfer": SVGFEComponentTransferElement;
+ "fecomposite": SVGFECompositeElement;
+ "feconvolvematrix": SVGFEConvolveMatrixElement;
+ "fediffuselighting": SVGFEDiffuseLightingElement;
+ "fedisplacementmap": SVGFEDisplacementMapElement;
+ "fedistantlight": SVGFEDistantLightElement;
+ "feflood": SVGFEFloodElement;
+ "fefunca": SVGFEFuncAElement;
+ "fefuncb": SVGFEFuncBElement;
+ "fefuncg": SVGFEFuncGElement;
+ "fefuncr": SVGFEFuncRElement;
+ "fegaussianblur": SVGFEGaussianBlurElement;
+ "feimage": SVGFEImageElement;
+ "femerge": SVGFEMergeElement;
+ "femergenode": SVGFEMergeNodeElement;
+ "femorphology": SVGFEMorphologyElement;
+ "feoffset": SVGFEOffsetElement;
+ "fepointlight": SVGFEPointLightElement;
+ "fespecularlighting": SVGFESpecularLightingElement;
+ "fespotlight": SVGFESpotLightElement;
+ "fetile": SVGFETileElement;
+ "feturbulence": SVGFETurbulenceElement;
+ "fieldset": HTMLFieldSetElement;
+ "figcaption": HTMLElement;
+ "figure": HTMLElement;
+ "filter": SVGFilterElement;
+ "font": HTMLFontElement;
+ "footer": HTMLElement;
+ "foreignobject": SVGForeignObjectElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "g": SVGGElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "header": HTMLElement;
+ "hgroup": HTMLElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "i": HTMLElement;
+ "iframe": HTMLIFrameElement;
+ "image": SVGImageElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "kbd": HTMLElement;
+ "keygen": HTMLElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "line": SVGLineElement;
+ "lineargradient": SVGLinearGradientElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "mark": HTMLElement;
+ "marker": SVGMarkerElement;
+ "marquee": HTMLMarqueeElement;
+ "mask": SVGMaskElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "metadata": SVGMetadataElement;
+ "meter": HTMLMeterElement;
+ "nav": HTMLElement;
+ "nextid": HTMLUnknownElement;
+ "nobr": HTMLElement;
+ "noframes": HTMLElement;
+ "noscript": HTMLElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "path": SVGPathElement;
+ "pattern": SVGPatternElement;
+ "picture": HTMLPictureElement;
+ "plaintext": HTMLElement;
+ "polygon": SVGPolygonElement;
+ "polyline": SVGPolylineElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "radialgradient": SVGRadialGradientElement;
+ "rect": SVGRectElement;
+ "rt": HTMLElement;
+ "ruby": HTMLElement;
+ "s": HTMLElement;
+ "samp": HTMLElement;
+ "script": HTMLScriptElement;
+ "section": HTMLElement;
+ "select": HTMLSelectElement;
+ "small": HTMLElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "stop": SVGStopElement;
+ "strike": HTMLElement;
+ "strong": HTMLElement;
+ "style": HTMLStyleElement;
+ "sub": HTMLElement;
+ "sup": HTMLElement;
+ "svg": SVGSVGElement;
+ "switch": SVGSwitchElement;
+ "symbol": SVGSymbolElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "text": SVGTextElement;
+ "textpath": SVGTextPathElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "tspan": SVGTSpanElement;
+ "tt": HTMLElement;
+ "u": HTMLElement;
+ "ul": HTMLUListElement;
+ "use": SVGUseElement;
+ "var": HTMLElement;
+ "video": HTMLVideoElement;
+ "view": SVGViewElement;
+ "wbr": HTMLElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementListTagNameMap {
+ "a": NodeListOf<HTMLAnchorElement>;
+ "abbr": NodeListOf<HTMLElement>;
+ "acronym": NodeListOf<HTMLElement>;
+ "address": NodeListOf<HTMLElement>;
+ "applet": NodeListOf<HTMLAppletElement>;
+ "area": NodeListOf<HTMLAreaElement>;
+ "article": NodeListOf<HTMLElement>;
+ "aside": NodeListOf<HTMLElement>;
+ "audio": NodeListOf<HTMLAudioElement>;
+ "b": NodeListOf<HTMLElement>;
+ "base": NodeListOf<HTMLBaseElement>;
+ "basefont": NodeListOf<HTMLBaseFontElement>;
+ "bdo": NodeListOf<HTMLElement>;
+ "big": NodeListOf<HTMLElement>;
+ "blockquote": NodeListOf<HTMLQuoteElement>;
+ "body": NodeListOf<HTMLBodyElement>;
+ "br": NodeListOf<HTMLBRElement>;
+ "button": NodeListOf<HTMLButtonElement>;
+ "canvas": NodeListOf<HTMLCanvasElement>;
+ "caption": NodeListOf<HTMLTableCaptionElement>;
+ "center": NodeListOf<HTMLElement>;
+ "circle": NodeListOf<SVGCircleElement>;
+ "cite": NodeListOf<HTMLElement>;
+ "clippath": NodeListOf<SVGClipPathElement>;
+ "code": NodeListOf<HTMLElement>;
+ "col": NodeListOf<HTMLTableColElement>;
+ "colgroup": NodeListOf<HTMLTableColElement>;
+ "datalist": NodeListOf<HTMLDataListElement>;
+ "dd": NodeListOf<HTMLElement>;
+ "defs": NodeListOf<SVGDefsElement>;
+ "del": NodeListOf<HTMLModElement>;
+ "desc": NodeListOf<SVGDescElement>;
+ "dfn": NodeListOf<HTMLElement>;
+ "dir": NodeListOf<HTMLDirectoryElement>;
+ "div": NodeListOf<HTMLDivElement>;
+ "dl": NodeListOf<HTMLDListElement>;
+ "dt": NodeListOf<HTMLElement>;
+ "ellipse": NodeListOf<SVGEllipseElement>;
+ "em": NodeListOf<HTMLElement>;
+ "embed": NodeListOf<HTMLEmbedElement>;
+ "feblend": NodeListOf<SVGFEBlendElement>;
+ "fecolormatrix": NodeListOf<SVGFEColorMatrixElement>;
+ "fecomponenttransfer": NodeListOf<SVGFEComponentTransferElement>;
+ "fecomposite": NodeListOf<SVGFECompositeElement>;
+ "feconvolvematrix": NodeListOf<SVGFEConvolveMatrixElement>;
+ "fediffuselighting": NodeListOf<SVGFEDiffuseLightingElement>;
+ "fedisplacementmap": NodeListOf<SVGFEDisplacementMapElement>;
+ "fedistantlight": NodeListOf<SVGFEDistantLightElement>;
+ "feflood": NodeListOf<SVGFEFloodElement>;
+ "fefunca": NodeListOf<SVGFEFuncAElement>;
+ "fefuncb": NodeListOf<SVGFEFuncBElement>;
+ "fefuncg": NodeListOf<SVGFEFuncGElement>;
+ "fefuncr": NodeListOf<SVGFEFuncRElement>;
+ "fegaussianblur": NodeListOf<SVGFEGaussianBlurElement>;
+ "feimage": NodeListOf<SVGFEImageElement>;
+ "femerge": NodeListOf<SVGFEMergeElement>;
+ "femergenode": NodeListOf<SVGFEMergeNodeElement>;
+ "femorphology": NodeListOf<SVGFEMorphologyElement>;
+ "feoffset": NodeListOf<SVGFEOffsetElement>;
+ "fepointlight": NodeListOf<SVGFEPointLightElement>;
+ "fespecularlighting": NodeListOf<SVGFESpecularLightingElement>;
+ "fespotlight": NodeListOf<SVGFESpotLightElement>;
+ "fetile": NodeListOf<SVGFETileElement>;
+ "feturbulence": NodeListOf<SVGFETurbulenceElement>;
+ "fieldset": NodeListOf<HTMLFieldSetElement>;
+ "figcaption": NodeListOf<HTMLElement>;
+ "figure": NodeListOf<HTMLElement>;
+ "filter": NodeListOf<SVGFilterElement>;
+ "font": NodeListOf<HTMLFontElement>;
+ "footer": NodeListOf<HTMLElement>;
+ "foreignobject": NodeListOf<SVGForeignObjectElement>;
+ "form": NodeListOf<HTMLFormElement>;
+ "frame": NodeListOf<HTMLFrameElement>;
+ "frameset": NodeListOf<HTMLFrameSetElement>;
+ "g": NodeListOf<SVGGElement>;
+ "h1": NodeListOf<HTMLHeadingElement>;
+ "h2": NodeListOf<HTMLHeadingElement>;
+ "h3": NodeListOf<HTMLHeadingElement>;
+ "h4": NodeListOf<HTMLHeadingElement>;
+ "h5": NodeListOf<HTMLHeadingElement>;
+ "h6": NodeListOf<HTMLHeadingElement>;
+ "head": NodeListOf<HTMLHeadElement>;
+ "header": NodeListOf<HTMLElement>;
+ "hgroup": NodeListOf<HTMLElement>;
+ "hr": NodeListOf<HTMLHRElement>;
+ "html": NodeListOf<HTMLHtmlElement>;
+ "i": NodeListOf<HTMLElement>;
+ "iframe": NodeListOf<HTMLIFrameElement>;
+ "image": NodeListOf<SVGImageElement>;
+ "img": NodeListOf<HTMLImageElement>;
+ "input": NodeListOf<HTMLInputElement>;
+ "ins": NodeListOf<HTMLModElement>;
+ "isindex": NodeListOf<HTMLUnknownElement>;
+ "kbd": NodeListOf<HTMLElement>;
+ "keygen": NodeListOf<HTMLElement>;
+ "label": NodeListOf<HTMLLabelElement>;
+ "legend": NodeListOf<HTMLLegendElement>;
+ "li": NodeListOf<HTMLLIElement>;
+ "line": NodeListOf<SVGLineElement>;
+ "lineargradient": NodeListOf<SVGLinearGradientElement>;
+ "link": NodeListOf<HTMLLinkElement>;
+ "listing": NodeListOf<HTMLPreElement>;
+ "map": NodeListOf<HTMLMapElement>;
+ "mark": NodeListOf<HTMLElement>;
+ "marker": NodeListOf<SVGMarkerElement>;
+ "marquee": NodeListOf<HTMLMarqueeElement>;
+ "mask": NodeListOf<SVGMaskElement>;
+ "menu": NodeListOf<HTMLMenuElement>;
+ "meta": NodeListOf<HTMLMetaElement>;
+ "metadata": NodeListOf<SVGMetadataElement>;
+ "meter": NodeListOf<HTMLMeterElement>;
+ "nav": NodeListOf<HTMLElement>;
+ "nextid": NodeListOf<HTMLUnknownElement>;
+ "nobr": NodeListOf<HTMLElement>;
+ "noframes": NodeListOf<HTMLElement>;
+ "noscript": NodeListOf<HTMLElement>;
+ "object": NodeListOf<HTMLObjectElement>;
+ "ol": NodeListOf<HTMLOListElement>;
+ "optgroup": NodeListOf<HTMLOptGroupElement>;
+ "option": NodeListOf<HTMLOptionElement>;
+ "p": NodeListOf<HTMLParagraphElement>;
+ "param": NodeListOf<HTMLParamElement>;
+ "path": NodeListOf<SVGPathElement>;
+ "pattern": NodeListOf<SVGPatternElement>;
+ "picture": NodeListOf<HTMLPictureElement>;
+ "plaintext": NodeListOf<HTMLElement>;
+ "polygon": NodeListOf<SVGPolygonElement>;
+ "polyline": NodeListOf<SVGPolylineElement>;
+ "pre": NodeListOf<HTMLPreElement>;
+ "progress": NodeListOf<HTMLProgressElement>;
+ "q": NodeListOf<HTMLQuoteElement>;
+ "radialgradient": NodeListOf<SVGRadialGradientElement>;
+ "rect": NodeListOf<SVGRectElement>;
+ "rt": NodeListOf<HTMLElement>;
+ "ruby": NodeListOf<HTMLElement>;
+ "s": NodeListOf<HTMLElement>;
+ "samp": NodeListOf<HTMLElement>;
+ "script": NodeListOf<HTMLScriptElement>;
+ "section": NodeListOf<HTMLElement>;
+ "select": NodeListOf<HTMLSelectElement>;
+ "small": NodeListOf<HTMLElement>;
+ "source": NodeListOf<HTMLSourceElement>;
+ "span": NodeListOf<HTMLSpanElement>;
+ "stop": NodeListOf<SVGStopElement>;
+ "strike": NodeListOf<HTMLElement>;
+ "strong": NodeListOf<HTMLElement>;
+ "style": NodeListOf<HTMLStyleElement>;
+ "sub": NodeListOf<HTMLElement>;
+ "sup": NodeListOf<HTMLElement>;
+ "svg": NodeListOf<SVGSVGElement>;
+ "switch": NodeListOf<SVGSwitchElement>;
+ "symbol": NodeListOf<SVGSymbolElement>;
+ "table": NodeListOf<HTMLTableElement>;
+ "tbody": NodeListOf<HTMLTableSectionElement>;
+ "td": NodeListOf<HTMLTableDataCellElement>;
+ "template": NodeListOf<HTMLTemplateElement>;
+ "text": NodeListOf<SVGTextElement>;
+ "textpath": NodeListOf<SVGTextPathElement>;
+ "textarea": NodeListOf<HTMLTextAreaElement>;
+ "tfoot": NodeListOf<HTMLTableSectionElement>;
+ "th": NodeListOf<HTMLTableHeaderCellElement>;
+ "thead": NodeListOf<HTMLTableSectionElement>;
+ "title": NodeListOf<HTMLTitleElement>;
+ "tr": NodeListOf<HTMLTableRowElement>;
+ "track": NodeListOf<HTMLTrackElement>;
+ "tspan": NodeListOf<SVGTSpanElement>;
+ "tt": NodeListOf<HTMLElement>;
+ "u": NodeListOf<HTMLElement>;
+ "ul": NodeListOf<HTMLUListElement>;
+ "use": NodeListOf<SVGUseElement>;
+ "var": NodeListOf<HTMLElement>;
+ "video": NodeListOf<HTMLVideoElement>;
+ "view": NodeListOf<SVGViewElement>;
+ "wbr": NodeListOf<HTMLElement>;
+ "x-ms-webview": NodeListOf<MSHTMLWebViewElement>;
+ "xmp": NodeListOf<HTMLPreElement>;
+}
+
declare var Audio: {new(src?: string): HTMLAudioElement; };
declare var Image: {new(width?: number, height?: number): HTMLImageElement; };
declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };
@@ -18625,7 +17848,6 @@ declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
-declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function clearInterval(handle: number): void;
@@ -18652,101 +17874,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any;
declare var indexedDB: IDBFactory;
declare function atob(encodedString: string): string;
declare function btoa(rawString: string): string;
-declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
+declare function addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
type AAGUID = string;
type AlgorithmIdentifier = string | Algorithm;
diff --git a/node_modules/typescript/lib/lib.dom.d.ts b/node_modules/typescript/lib/lib.dom.d.ts
index 217c7bf64..8fb1b0b0a 100644
--- a/node_modules/typescript/lib/lib.dom.d.ts
+++ b/node_modules/typescript/lib/lib.dom.d.ts
@@ -96,6 +96,7 @@ interface DoubleRange {
}
interface EventInit {
+ scoped?: boolean;
bubbles?: boolean;
cancelable?: boolean;
}
@@ -937,15 +938,26 @@ declare var AnimationEvent: {
new(): AnimationEvent;
}
+interface ApplicationCacheEventMap {
+ "cached": Event;
+ "checking": Event;
+ "downloading": Event;
+ "error": ErrorEvent;
+ "noupdate": Event;
+ "obsolete": Event;
+ "progress": ProgressEvent;
+ "updateready": Event;
+}
+
interface ApplicationCache extends EventTarget {
- oncached: (this: this, ev: Event) => any;
- onchecking: (this: this, ev: Event) => any;
- ondownloading: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onnoupdate: (this: this, ev: Event) => any;
- onobsolete: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onupdateready: (this: this, ev: Event) => any;
+ oncached: (this: ApplicationCache, ev: Event) => any;
+ onchecking: (this: ApplicationCache, ev: Event) => any;
+ ondownloading: (this: ApplicationCache, ev: Event) => any;
+ onerror: (this: ApplicationCache, ev: ErrorEvent) => any;
+ onnoupdate: (this: ApplicationCache, ev: Event) => any;
+ onobsolete: (this: ApplicationCache, ev: Event) => any;
+ onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;
+ onupdateready: (this: ApplicationCache, ev: Event) => any;
readonly status: number;
abort(): void;
swapCache(): void;
@@ -956,14 +968,7 @@ interface ApplicationCache extends EventTarget {
readonly OBSOLETE: number;
readonly UNCACHED: number;
readonly UPDATEREADY: number;
- addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ApplicationCacheEventMap>(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -1016,17 +1021,21 @@ declare var AudioBuffer: {
new(): AudioBuffer;
}
+interface AudioBufferSourceNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface AudioBufferSourceNode extends AudioNode {
buffer: AudioBuffer | null;
readonly detune: AudioParam;
loop: boolean;
loopEnd: number;
loopStart: number;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;
readonly playbackRate: AudioParam;
start(when?: number, offset?: number, duration?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioBufferSourceNodeEventMap>(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -1148,16 +1157,20 @@ declare var AudioTrack: {
new(): AudioTrack;
}
+interface AudioTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface AudioTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;
+ onchange: (this: AudioTrackList, ev: Event) => any;
+ onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;
getTrackById(id: string): AudioTrack | null;
item(index: number): AudioTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioTrackListEventMap>(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: AudioTrack;
}
@@ -1858,7 +1871,6 @@ interface CharacterData extends Node, ChildNode {
insertData(offset: number, arg: string): void;
replaceData(offset: number, count: number, arg: string): void;
substringData(offset: number, count: number): string;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var CharacterData: {
@@ -2183,6 +2195,8 @@ declare var DOMTokenList: {
interface DataCue extends TextTrackCue {
data: ArrayBuffer;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DataCue: {
@@ -2311,7 +2325,98 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
-interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
+interface DocumentEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforedeactivate": UIEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "fullscreenchange": Event;
+ "fullscreenerror": Event;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "mssitemodejumplistitemremoved": MSSiteModeEvent;
+ "msthumbnailclick": MSSiteModeEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "pointerlockchange": Event;
+ "pointerlockerror": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectionchange": Event;
+ "selectstart": Event;
+ "stalled": Event;
+ "stop": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "volumechange": Event;
+ "waiting": Event;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
+interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {
/**
* Sets or gets the URL for the current document.
*/
@@ -2434,294 +2539,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Fires when the user aborts the download.
* @param ev The event.
*/
- onabort: (this: this, ev: UIEvent) => any;
+ onabort: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object is set as the active element.
* @param ev The event.
*/
- onactivate: (this: this, ev: UIEvent) => any;
+ onactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the object is set as the active element.
* @param ev The event.
*/
- onbeforeactivate: (this: this, ev: UIEvent) => any;
+ onbeforeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the activeElement is changed from the current object to another object in the parent document.
* @param ev The event.
*/
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
+ onbeforedeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
*/
- onblur: (this: this, ev: FocusEvent) => any;
+ onblur: (this: Document, ev: FocusEvent) => any;
/**
* Occurs when playback is possible, but would require further buffering.
* @param ev The event.
*/
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
+ oncanplay: (this: Document, ev: Event) => any;
+ oncanplaythrough: (this: Document, ev: Event) => any;
/**
* Fires when the contents of the object or selection have changed.
* @param ev The event.
*/
- onchange: (this: this, ev: Event) => any;
+ onchange: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the left mouse button on the object
* @param ev The mouse event.
*/
- onclick: (this: this, ev: MouseEvent) => any;
+ onclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* @param ev The mouse event.
*/
- oncontextmenu: (this: this, ev: PointerEvent) => any;
+ oncontextmenu: (this: Document, ev: PointerEvent) => any;
/**
* Fires when the user double-clicks the object.
* @param ev The mouse event.
*/
- ondblclick: (this: this, ev: MouseEvent) => any;
+ ondblclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the activeElement is changed from the current object to another object in the parent document.
* @param ev The UI Event
*/
- ondeactivate: (this: this, ev: UIEvent) => any;
+ ondeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires on the source object continuously during a drag operation.
* @param ev The event.
*/
- ondrag: (this: this, ev: DragEvent) => any;
+ ondrag: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user releases the mouse at the close of a drag operation.
* @param ev The event.
*/
- ondragend: (this: this, ev: DragEvent) => any;
+ ondragend: (this: Document, 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: (this: this, ev: DragEvent) => any;
+ ondragenter: (this: Document, 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.
*/
- ondragleave: (this: this, ev: DragEvent) => any;
+ ondragleave: (this: Document, ev: DragEvent) => any;
/**
* Fires on the target element continuously while the user drags the object over a valid drop target.
* @param ev The event.
*/
- ondragover: (this: this, ev: DragEvent) => any;
+ ondragover: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user starts to drag a text selection or selected object.
* @param ev The event.
*/
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
+ ondragstart: (this: Document, ev: DragEvent) => any;
+ ondrop: (this: Document, ev: DragEvent) => any;
/**
* Occurs when the duration attribute is updated.
* @param ev The event.
*/
- ondurationchange: (this: this, ev: Event) => any;
+ ondurationchange: (this: Document, ev: Event) => any;
/**
* Occurs when the media element is reset to its initial state.
* @param ev The event.
*/
- onemptied: (this: this, ev: Event) => any;
+ onemptied: (this: Document, ev: Event) => any;
/**
* Occurs when the end of playback is reached.
* @param ev The event
*/
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: Document, ev: MediaStreamErrorEvent) => any;
/**
* Fires when an error occurs during object loading.
* @param ev The event.
*/
- onerror: (this: this, ev: ErrorEvent) => any;
+ onerror: (this: Document, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
* @param ev The event.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onfullscreenchange: (this: this, ev: Event) => any;
- onfullscreenerror: (this: this, ev: Event) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
+ onfocus: (this: Document, ev: FocusEvent) => any;
+ onfullscreenchange: (this: Document, ev: Event) => any;
+ onfullscreenerror: (this: Document, ev: Event) => any;
+ oninput: (this: Document, ev: Event) => any;
+ oninvalid: (this: Document, ev: Event) => any;
/**
* Fires when the user presses a key.
* @param ev The keyboard event
*/
- onkeydown: (this: this, ev: KeyboardEvent) => any;
+ onkeydown: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user presses an alphanumeric key.
* @param ev The event.
*/
- onkeypress: (this: this, ev: KeyboardEvent) => any;
+ onkeypress: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user releases a key.
* @param ev The keyboard event
*/
- onkeyup: (this: this, ev: KeyboardEvent) => any;
+ onkeyup: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires immediately after the browser loads the object.
* @param ev The event.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: Document, ev: Event) => any;
/**
* Occurs when media data is loaded at the current playback position.
* @param ev The event.
*/
- onloadeddata: (this: this, ev: Event) => any;
+ onloadeddata: (this: Document, ev: Event) => any;
/**
* Occurs when the duration and dimensions of the media have been determined.
* @param ev The event.
*/
- onloadedmetadata: (this: this, ev: Event) => any;
+ onloadedmetadata: (this: Document, ev: Event) => any;
/**
* Occurs when Internet Explorer begins looking for media data.
* @param ev The event.
*/
- onloadstart: (this: this, ev: Event) => any;
+ onloadstart: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the object with either mouse button.
* @param ev The mouse event.
*/
- onmousedown: (this: this, ev: MouseEvent) => any;
+ onmousedown: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse over the object.
* @param ev The mouse event.
*/
- onmousemove: (this: this, ev: MouseEvent) => any;
+ onmousemove: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* @param ev The mouse event.
*/
- onmouseout: (this: this, ev: MouseEvent) => any;
+ onmouseout: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer into the object.
* @param ev The mouse event.
*/
- onmouseover: (this: this, ev: MouseEvent) => any;
+ onmouseover: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user releases a mouse button while the mouse is over the object.
* @param ev The mouse event.
*/
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onmouseup: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the wheel button is rotated.
* @param ev The mouse event
*/
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onmousewheel: (this: Document, ev: WheelEvent) => any;
+ onmscontentzoom: (this: Document, ev: UIEvent) => any;
+ onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;
+ onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;
+ onmspointercancel: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Document, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Document, ev: MSPointerEvent) => any;
/**
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* @param ev The event.
*/
- onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any;
+ onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.
* @param ev The event.
*/
- onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any;
+ onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when playback is paused.
* @param ev The event.
*/
- onpause: (this: this, ev: Event) => any;
+ onpause: (this: Document, ev: Event) => any;
/**
* Occurs when the play method is requested.
* @param ev The event.
*/
- onplay: (this: this, ev: Event) => any;
+ onplay: (this: Document, ev: Event) => any;
/**
* Occurs when the audio or video has started playing.
* @param ev The event.
*/
- onplaying: (this: this, ev: Event) => any;
- onpointerlockchange: (this: this, ev: Event) => any;
- onpointerlockerror: (this: this, ev: Event) => any;
+ onplaying: (this: Document, ev: Event) => any;
+ onpointerlockchange: (this: Document, ev: Event) => any;
+ onpointerlockerror: (this: Document, ev: Event) => any;
/**
* Occurs to indicate progress while downloading media data.
* @param ev The event.
*/
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onprogress: (this: Document, ev: ProgressEvent) => any;
/**
* Occurs when the playback rate is increased or decreased.
* @param ev The event.
*/
- onratechange: (this: this, ev: Event) => any;
+ onratechange: (this: Document, ev: Event) => any;
/**
* Fires when the state of the object has changed.
* @param ev The event
*/
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
+ onreadystatechange: (this: Document, ev: ProgressEvent) => any;
/**
* Fires when the user resets a form.
* @param ev The event.
*/
- onreset: (this: this, ev: Event) => any;
+ onreset: (this: Document, ev: Event) => any;
/**
* Fires when the user repositions the scroll box in the scroll bar on the object.
* @param ev The event.
*/
- onscroll: (this: this, ev: UIEvent) => any;
+ onscroll: (this: Document, ev: UIEvent) => any;
/**
* Occurs when the seek operation ends.
* @param ev The event.
*/
- onseeked: (this: this, ev: Event) => any;
+ onseeked: (this: Document, ev: Event) => any;
/**
* Occurs when the current playback position is moved.
* @param ev The event.
*/
- onseeking: (this: this, ev: Event) => any;
+ onseeking: (this: Document, ev: Event) => any;
/**
* Fires when the current selection changes.
* @param ev The event.
*/
- onselect: (this: this, ev: UIEvent) => any;
+ onselect: (this: Document, ev: UIEvent) => any;
/**
* Fires when the selection state of a document changes.
* @param ev The event.
*/
- onselectionchange: (this: this, ev: Event) => any;
- onselectstart: (this: this, ev: Event) => any;
+ onselectionchange: (this: Document, ev: Event) => any;
+ onselectstart: (this: Document, ev: Event) => any;
/**
* Occurs when the download has stopped.
* @param ev The event.
*/
- onstalled: (this: this, ev: Event) => any;
+ onstalled: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the Stop button or leaves the Web page.
* @param ev The event.
*/
- onstop: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
+ onstop: (this: Document, ev: Event) => any;
+ onsubmit: (this: Document, ev: Event) => any;
/**
* Occurs if the load operation has been intentionally halted.
* @param ev The event.
*/
- onsuspend: (this: this, ev: Event) => any;
+ onsuspend: (this: Document, ev: Event) => any;
/**
* Occurs to indicate the current playback position.
* @param ev The event.
*/
- ontimeupdate: (this: this, ev: Event) => any;
+ ontimeupdate: (this: Document, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
@@ -2730,14 +2835,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Occurs when the volume is changed, or playback is muted or unmuted.
* @param ev The event.
*/
- onvolumechange: (this: this, ev: Event) => any;
+ onvolumechange: (this: Document, ev: Event) => any;
/**
* Occurs when playback stops because the next frame of a video resource is not available.
* @param ev The event.
*/
- onwaiting: (this: this, ev: Event) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwaiting: (this: Document, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Document, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Document, ev: Event) => any;
plugins: HTMLCollectionOf<HTMLEmbedElement>;
readonly pointerLockElement: Element;
/**
@@ -2808,86 +2913,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Creates an instance of the element for the specified tag.
* @param tagName The name of an element.
*/
- createElement(tagName: "a"): HTMLAnchorElement;
- createElement(tagName: "applet"): HTMLAppletElement;
- createElement(tagName: "area"): HTMLAreaElement;
- createElement(tagName: "audio"): HTMLAudioElement;
- createElement(tagName: "base"): HTMLBaseElement;
- createElement(tagName: "basefont"): HTMLBaseFontElement;
- createElement(tagName: "blockquote"): HTMLQuoteElement;
- createElement(tagName: "body"): HTMLBodyElement;
- createElement(tagName: "br"): HTMLBRElement;
- createElement(tagName: "button"): HTMLButtonElement;
- createElement(tagName: "canvas"): HTMLCanvasElement;
- createElement(tagName: "caption"): HTMLTableCaptionElement;
- createElement(tagName: "col"): HTMLTableColElement;
- createElement(tagName: "colgroup"): HTMLTableColElement;
- createElement(tagName: "datalist"): HTMLDataListElement;
- createElement(tagName: "del"): HTMLModElement;
- createElement(tagName: "dir"): HTMLDirectoryElement;
- createElement(tagName: "div"): HTMLDivElement;
- createElement(tagName: "dl"): HTMLDListElement;
- createElement(tagName: "embed"): HTMLEmbedElement;
- createElement(tagName: "fieldset"): HTMLFieldSetElement;
- createElement(tagName: "font"): HTMLFontElement;
- createElement(tagName: "form"): HTMLFormElement;
- createElement(tagName: "frame"): HTMLFrameElement;
- createElement(tagName: "frameset"): HTMLFrameSetElement;
- createElement(tagName: "h1"): HTMLHeadingElement;
- createElement(tagName: "h2"): HTMLHeadingElement;
- createElement(tagName: "h3"): HTMLHeadingElement;
- createElement(tagName: "h4"): HTMLHeadingElement;
- createElement(tagName: "h5"): HTMLHeadingElement;
- createElement(tagName: "h6"): HTMLHeadingElement;
- createElement(tagName: "head"): HTMLHeadElement;
- createElement(tagName: "hr"): HTMLHRElement;
- createElement(tagName: "html"): HTMLHtmlElement;
- createElement(tagName: "iframe"): HTMLIFrameElement;
- createElement(tagName: "img"): HTMLImageElement;
- createElement(tagName: "input"): HTMLInputElement;
- createElement(tagName: "ins"): HTMLModElement;
- createElement(tagName: "isindex"): HTMLUnknownElement;
- createElement(tagName: "label"): HTMLLabelElement;
- createElement(tagName: "legend"): HTMLLegendElement;
- createElement(tagName: "li"): HTMLLIElement;
- createElement(tagName: "link"): HTMLLinkElement;
- createElement(tagName: "listing"): HTMLPreElement;
- createElement(tagName: "map"): HTMLMapElement;
- createElement(tagName: "marquee"): HTMLMarqueeElement;
- createElement(tagName: "menu"): HTMLMenuElement;
- createElement(tagName: "meta"): HTMLMetaElement;
- createElement(tagName: "meter"): HTMLMeterElement;
- createElement(tagName: "nextid"): HTMLUnknownElement;
- createElement(tagName: "object"): HTMLObjectElement;
- createElement(tagName: "ol"): HTMLOListElement;
- createElement(tagName: "optgroup"): HTMLOptGroupElement;
- createElement(tagName: "option"): HTMLOptionElement;
- createElement(tagName: "p"): HTMLParagraphElement;
- createElement(tagName: "param"): HTMLParamElement;
- createElement(tagName: "picture"): HTMLPictureElement;
- createElement(tagName: "pre"): HTMLPreElement;
- createElement(tagName: "progress"): HTMLProgressElement;
- createElement(tagName: "q"): HTMLQuoteElement;
- createElement(tagName: "script"): HTMLScriptElement;
- createElement(tagName: "select"): HTMLSelectElement;
- createElement(tagName: "source"): HTMLSourceElement;
- createElement(tagName: "span"): HTMLSpanElement;
- createElement(tagName: "style"): HTMLStyleElement;
- createElement(tagName: "table"): HTMLTableElement;
- createElement(tagName: "tbody"): HTMLTableSectionElement;
- createElement(tagName: "td"): HTMLTableDataCellElement;
- createElement(tagName: "template"): HTMLTemplateElement;
- createElement(tagName: "textarea"): HTMLTextAreaElement;
- createElement(tagName: "tfoot"): HTMLTableSectionElement;
- createElement(tagName: "th"): HTMLTableHeaderCellElement;
- createElement(tagName: "thead"): HTMLTableSectionElement;
- createElement(tagName: "title"): HTMLTitleElement;
- createElement(tagName: "tr"): HTMLTableRowElement;
- createElement(tagName: "track"): HTMLTrackElement;
- createElement(tagName: "ul"): HTMLUListElement;
- createElement(tagName: "video"): HTMLVideoElement;
- createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement;
- createElement(tagName: "xmp"): HTMLPreElement;
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): HTMLElementTagNameMap[K];
createElement(tagName: string): HTMLElement;
createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement
@@ -2989,7 +3015,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
@@ -3023,182 +3049,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Retrieves a collection of objects based on the specified element name.
* @param name Specifies the name of an element.
*/
- getElementsByTagName(tagname: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(tagname: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(tagname: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(tagname: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(tagname: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(tagname: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(tagname: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(tagname: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(tagname: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(tagname: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(tagname: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(tagname: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(tagname: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(tagname: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(tagname: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(tagname: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(tagname: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(tagname: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(tagname: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(tagname: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(tagname: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(tagname: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(tagname: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(tagname: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(tagname: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(tagname: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(tagname: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(tagname: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(tagname: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(tagname: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(tagname: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(tagname: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(tagname: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(tagname: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(tagname: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(tagname: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(tagname: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(tagname: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(tagname: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(tagname: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(tagname: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(tagname: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(tagname: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(tagname: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(tagname: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(tagname: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(tagname: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(tagname: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(tagname: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(tagname: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(tagname: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(tagname: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(tagname: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(tagname: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(tagname: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(tagname: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(tagname: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(tagname: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(tagname: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(tagname: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(tagname: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(tagname: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(tagname: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(tagname: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(tagname: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(tagname: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(tagname: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(tagname: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(tagname: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(tagname: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(tagname: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(tagname: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(tagname: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(tagname: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(tagname: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(tagname: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(tagname: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(tagname: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(tagname: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(tagname: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(tagname: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(tagname: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(tagname: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(tagname: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(tagname: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(tagname: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(tagname: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(tagname: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(tagname: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(tagname: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(tagname: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(tagname: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(tagname: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(tagname: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(tagname: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(tagname: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(tagname: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(tagname: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(tagname: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(tagname: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(tagname: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(tagname: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(tagname: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(tagname: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(tagname: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(tagname: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(tagname: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(tagname: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(tagname: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(tagname: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(tagname: K): ElementListTagNameMap[K];
getElementsByTagName(tagname: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -3269,103 +3120,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -3375,7 +3130,6 @@ declare var Document: {
}
interface DocumentFragment extends Node, NodeSelector, ParentNode {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentFragment: {
@@ -3390,7 +3144,6 @@ interface DocumentType extends Node, ChildNode {
readonly notations: NamedNodeMap;
readonly publicId: string | null;
readonly systemId: string | null;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentType: {
@@ -3443,6 +3196,36 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
+interface ElementEventMap extends GlobalEventHandlersEventMap {
+ "ariarequest": AriaRequestEvent;
+ "command": CommandEvent;
+ "gotpointercapture": PointerEvent;
+ "lostpointercapture": PointerEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSGotPointerCapture": MSPointerEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSLostPointerCapture": MSPointerEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
@@ -3453,33 +3236,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
id: string;
msContentZoomFactor: number;
readonly msRegionOverflow: string;
- onariarequest: (this: this, ev: AriaRequestEvent) => any;
- oncommand: (this: this, ev: CommandEvent) => any;
- ongotpointercapture: (this: this, ev: PointerEvent) => any;
- onlostpointercapture: (this: this, ev: PointerEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmslostpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onariarequest: (this: Element, ev: AriaRequestEvent) => any;
+ oncommand: (this: Element, ev: CommandEvent) => any;
+ ongotpointercapture: (this: Element, ev: PointerEvent) => any;
+ onlostpointercapture: (this: Element, ev: PointerEvent) => any;
+ onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;
+ onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmspointercancel: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Element, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Element, ev: MSPointerEvent) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Element, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Element, ev: Event) => any;
readonly prefix: string | null;
readonly scrollHeight: number;
scrollLeft: number;
@@ -3487,188 +3270,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
readonly scrollWidth: number;
readonly tagName: string;
innerHTML: string;
+ readonly assignedSlot: HTMLSlotElement | null;
+ slot: string;
+ readonly shadowRoot: ShadowRoot | null;
getAttribute(name: string): string | null;
getAttributeNS(namespaceURI: string, localName: string): string;
getAttributeNode(name: string): Attr;
getAttributeNodeNS(namespaceURI: string, localName: string): Attr;
getBoundingClientRect(): ClientRect;
getClientRects(): ClientRectList;
- getElementsByTagName(name: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(name: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(name: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(name: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(name: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(name: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(name: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(name: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(name: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(name: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(name: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(name: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(name: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(name: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(name: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(name: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(name: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(name: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(name: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(name: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(name: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(name: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(name: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(name: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(name: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(name: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(name: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(name: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(name: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(name: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(name: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(name: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(name: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(name: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(name: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(name: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(name: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(name: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(name: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(name: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(name: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(name: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(name: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(name: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(name: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(name: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(name: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(name: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(name: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(name: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(name: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(name: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(name: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(name: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(name: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(name: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(name: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(name: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(name: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(name: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(name: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(name: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(name: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(name: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(name: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(name: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(name: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(name: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(name: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(name: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(name: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(name: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(name: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(name: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(name: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(name: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(name: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(name: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(name: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(name: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(name: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(name: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(name: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(name: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(name: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(name: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(name: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(name: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(name: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(name: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(name: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(name: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(name: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(name: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(name: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(name: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(name: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(name: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(name: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(name: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(name: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(name: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(name: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(name: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(name: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(name: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(name: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(name: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(name: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(name: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(name: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(name: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(name: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(name: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(name: K): ElementListTagNameMap[K];
getElementsByTagName(name: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -3708,42 +3319,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;
+ addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -3779,10 +3356,12 @@ interface Event {
readonly target: EventTarget;
readonly timeStamp: number;
readonly type: string;
+ readonly scoped: boolean;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
+ deepPath(): EventTarget[];
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
@@ -3843,6 +3422,7 @@ interface FileReader extends EventTarget, MSBaseReader {
readAsBinaryString(blob: Blob): void;
readAsDataURL(blob: Blob): void;
readAsText(blob: Blob, encoding?: string): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4013,6 +3593,8 @@ interface HTMLAnchorElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAnchorElement: {
@@ -4085,6 +3667,8 @@ interface HTMLAppletElement extends HTMLElement {
useMap: string;
vspace: number;
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAppletElement: {
@@ -4151,6 +3735,8 @@ interface HTMLAreaElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAreaElement: {
@@ -4175,6 +3761,8 @@ declare var HTMLAreasCollection: {
}
interface HTMLAudioElement extends HTMLMediaElement {
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAudioElement: {
@@ -4187,6 +3775,8 @@ interface HTMLBRElement extends HTMLElement {
* Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.
*/
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBRElement: {
@@ -4203,6 +3793,8 @@ interface HTMLBaseElement extends HTMLElement {
* Sets or retrieves the window or frame at which to target content.
*/
target: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBaseElement: {
@@ -4219,6 +3811,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty
* Sets or retrieves the font size of the object.
*/
size: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4227,6 +3820,27 @@ declare var HTMLBaseFontElement: {
new(): HTMLBaseFontElement;
}
+interface HTMLBodyElementEventMap extends HTMLElementEventMap {
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "popstate": PopStateEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLBodyElement extends HTMLElement {
aLink: any;
background: string;
@@ -4234,147 +3848,27 @@ interface HTMLBodyElement extends HTMLElement {
bgProperties: string;
link: any;
noWrap: boolean;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onafterprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;
+ onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLBodyElement, ev: Event) => any;
+ onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLBodyElement, ev: Event) => any;
+ ononline: (this: HTMLBodyElement, ev: Event) => any;
+ onorientationchange: (this: HTMLBodyElement, ev: Event) => any;
+ onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;
+ onresize: (this: HTMLBodyElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLBodyElement, ev: Event) => any;
text: any;
vLink: any;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4447,6 +3941,8 @@ interface HTMLButtonElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLButtonElement: {
@@ -4480,6 +3976,8 @@ interface HTMLCanvasElement extends HTMLElement {
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLCanvasElement: {
@@ -4510,6 +4008,8 @@ declare var HTMLCollection: {
interface HTMLDListElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDListElement: {
@@ -4519,6 +4019,8 @@ declare var HTMLDListElement: {
interface HTMLDataListElement extends HTMLElement {
options: HTMLCollectionOf<HTMLOptionElement>;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDataListElement: {
@@ -4528,6 +4030,8 @@ declare var HTMLDataListElement: {
interface HTMLDirectoryElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDirectoryElement: {
@@ -4544,6 +4048,8 @@ interface HTMLDivElement extends HTMLElement {
* Sets or retrieves whether the browser automatically performs wordwrap.
*/
noWrap: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDivElement: {
@@ -4552,6 +4058,8 @@ declare var HTMLDivElement: {
}
interface HTMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDocument: {
@@ -4559,6 +4067,76 @@ declare var HTMLDocument: {
new(): HTMLDocument;
}
+interface HTMLElementEventMap extends ElementEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforecopy": ClipboardEvent;
+ "beforecut": ClipboardEvent;
+ "beforedeactivate": UIEvent;
+ "beforepaste": ClipboardEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "copy": ClipboardEvent;
+ "cuechange": Event;
+ "cut": ClipboardEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "paste": ClipboardEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectstart": Event;
+ "stalled": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface HTMLElement extends Element {
accessKey: string;
readonly children: HTMLCollection;
@@ -4577,73 +4155,73 @@ interface HTMLElement extends Element {
readonly offsetParent: Element;
readonly offsetTop: number;
readonly offsetWidth: number;
- onabort: (this: this, ev: UIEvent) => any;
- onactivate: (this: this, ev: UIEvent) => any;
- onbeforeactivate: (this: this, ev: UIEvent) => any;
- onbeforecopy: (this: this, ev: ClipboardEvent) => any;
- onbeforecut: (this: this, ev: ClipboardEvent) => any;
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
- onbeforepaste: (this: this, ev: ClipboardEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- oncopy: (this: this, ev: ClipboardEvent) => any;
- oncuechange: (this: this, ev: Event) => any;
- oncut: (this: this, ev: ClipboardEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondeactivate: (this: this, ev: UIEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onpaste: (this: this, ev: ClipboardEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreset: (this: this, ev: Event) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onselectstart: (this: this, ev: Event) => any;
- onstalled: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onabort: (this: HTMLElement, ev: UIEvent) => any;
+ onactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onblur: (this: HTMLElement, ev: FocusEvent) => any;
+ oncanplay: (this: HTMLElement, ev: Event) => any;
+ oncanplaythrough: (this: HTMLElement, ev: Event) => any;
+ onchange: (this: HTMLElement, ev: Event) => any;
+ onclick: (this: HTMLElement, ev: MouseEvent) => any;
+ oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;
+ oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ oncuechange: (this: HTMLElement, ev: Event) => any;
+ oncut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ ondblclick: (this: HTMLElement, ev: MouseEvent) => any;
+ ondeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ ondrag: (this: HTMLElement, ev: DragEvent) => any;
+ ondragend: (this: HTMLElement, ev: DragEvent) => any;
+ ondragenter: (this: HTMLElement, ev: DragEvent) => any;
+ ondragleave: (this: HTMLElement, ev: DragEvent) => any;
+ ondragover: (this: HTMLElement, ev: DragEvent) => any;
+ ondragstart: (this: HTMLElement, ev: DragEvent) => any;
+ ondrop: (this: HTMLElement, ev: DragEvent) => any;
+ ondurationchange: (this: HTMLElement, ev: Event) => any;
+ onemptied: (this: HTMLElement, ev: Event) => any;
+ onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;
+ onerror: (this: HTMLElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLElement, ev: FocusEvent) => any;
+ oninput: (this: HTMLElement, ev: Event) => any;
+ oninvalid: (this: HTMLElement, ev: Event) => any;
+ onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onload: (this: HTMLElement, ev: Event) => any;
+ onloadeddata: (this: HTMLElement, ev: Event) => any;
+ onloadedmetadata: (this: HTMLElement, ev: Event) => any;
+ onloadstart: (this: HTMLElement, ev: Event) => any;
+ onmousedown: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousemove: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseout: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseover: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseup: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;
+ onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;
+ onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;
+ onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onpause: (this: HTMLElement, ev: Event) => any;
+ onplay: (this: HTMLElement, ev: Event) => any;
+ onplaying: (this: HTMLElement, ev: Event) => any;
+ onprogress: (this: HTMLElement, ev: ProgressEvent) => any;
+ onratechange: (this: HTMLElement, ev: Event) => any;
+ onreset: (this: HTMLElement, ev: Event) => any;
+ onscroll: (this: HTMLElement, ev: UIEvent) => any;
+ onseeked: (this: HTMLElement, ev: Event) => any;
+ onseeking: (this: HTMLElement, ev: Event) => any;
+ onselect: (this: HTMLElement, ev: UIEvent) => any;
+ onselectstart: (this: HTMLElement, ev: Event) => any;
+ onstalled: (this: HTMLElement, ev: Event) => any;
+ onsubmit: (this: HTMLElement, ev: Event) => any;
+ onsuspend: (this: HTMLElement, ev: Event) => any;
+ ontimeupdate: (this: HTMLElement, ev: Event) => any;
+ onvolumechange: (this: HTMLElement, ev: Event) => any;
+ onwaiting: (this: HTMLElement, ev: Event) => any;
outerHTML: string;
outerText: string;
spellcheck: boolean;
@@ -4656,109 +4234,7 @@ interface HTMLElement extends Element {
focus(): void;
msGetInputContext(): MSInputMethodContext;
setActive(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4814,6 +4290,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4853,6 +4330,8 @@ interface HTMLFieldSetElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLFieldSetElement: {
@@ -4865,6 +4344,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM
* Sets or retrieves the current typeface family.
*/
face: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -4940,6 +4420,8 @@ interface HTMLFormElement extends HTMLElement {
* Fires when a FORM is about to be submitted.
*/
submit(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -4948,6 +4430,10 @@ declare var HTMLFormElement: {
new(): HTMLFormElement;
}
+interface HTMLFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Specifies the properties of a border drawn around an object.
@@ -5000,7 +4486,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLFrameElement, ev: Event) => any;
/**
* Sets or retrieves whether the frame can be scrolled.
*/
@@ -5013,110 +4499,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string | number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameElementEventMap>(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5125,6 +4508,25 @@ declare var HTMLFrameElement: {
new(): HTMLFrameElement;
}
+interface HTMLFrameSetElementEventMap extends HTMLElementEventMap {
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLFrameSetElement extends HTMLElement {
border: string;
/**
@@ -5144,152 +4546,34 @@ interface HTMLFrameSetElement extends HTMLElement {
*/
frameSpacing: any;
name: string;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
+ onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;
/**
* Fires when the object loses the input focus.
*/
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLFrameSetElement, ev: Event) => any;
+ onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLFrameSetElement, ev: Event) => any;
+ ononline: (this: HTMLFrameSetElement, ev: Event) => any;
+ onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;
+ onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLFrameSetElement, ev: Event) => any;
/**
* Sets or retrieves the frame heights of the object.
*/
rows: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5311,6 +4595,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2
* Sets or retrieves the width of the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5321,6 +4606,8 @@ declare var HTMLHRElement: {
interface HTMLHeadElement extends HTMLElement {
profile: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadElement: {
@@ -5333,6 +4620,8 @@ interface HTMLHeadingElement extends HTMLElement {
* Sets or retrieves a value that indicates the table alignment.
*/
align: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadingElement: {
@@ -5345,6 +4634,8 @@ interface HTMLHtmlElement extends HTMLElement {
* Sets or retrieves the DTD version that governs the current document.
*/
version: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHtmlElement: {
@@ -5352,6 +4643,10 @@ declare var HTMLHtmlElement: {
new(): HTMLHtmlElement;
}
+interface HTMLIFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -5409,7 +4704,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLIFrameElement, ev: Event) => any;
readonly sandbox: DOMSettableTokenList;
/**
* Sets or retrieves whether the frame can be scrolled.
@@ -5427,110 +4722,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLIFrameElementEventMap>(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5621,6 +4813,8 @@ interface HTMLImageElement extends HTMLElement {
readonly x: number;
readonly y: number;
msGetAsCastingSource(): any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLImageElement: {
@@ -5832,6 +5026,8 @@ interface HTMLInputElement extends HTMLElement {
* @param n Value to increment the value by.
*/
stepUp(n?: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLInputElement: {
@@ -5845,6 +5041,8 @@ interface HTMLLIElement extends HTMLElement {
* Sets or retrieves the value of a list item.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLIElement: {
@@ -5861,6 +5059,8 @@ interface HTMLLabelElement extends HTMLElement {
* Sets or retrieves the object to which the given label object is assigned.
*/
htmlFor: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLabelElement: {
@@ -5877,6 +5077,8 @@ interface HTMLLegendElement extends HTMLElement {
* Retrieves a reference to the form that the object is embedded in.
*/
readonly form: HTMLFormElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLegendElement: {
@@ -5920,6 +5122,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
type: string;
import?: Document;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -5937,6 +5140,8 @@ interface HTMLMapElement extends HTMLElement {
* Sets or retrieves the name of the object.
*/
name: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMapElement: {
@@ -5944,6 +5149,12 @@ declare var HTMLMapElement: {
new(): HTMLMapElement;
}
+interface HTMLMarqueeElementEventMap extends HTMLElementEventMap {
+ "bounce": Event;
+ "finish": Event;
+ "start": Event;
+}
+
interface HTMLMarqueeElement extends HTMLElement {
behavior: string;
bgColor: any;
@@ -5951,9 +5162,9 @@ interface HTMLMarqueeElement extends HTMLElement {
height: string;
hspace: number;
loop: number;
- onbounce: (this: this, ev: Event) => any;
- onfinish: (this: this, ev: Event) => any;
- onstart: (this: this, ev: Event) => any;
+ onbounce: (this: HTMLMarqueeElement, ev: Event) => any;
+ onfinish: (this: HTMLMarqueeElement, ev: Event) => any;
+ onstart: (this: HTMLMarqueeElement, ev: Event) => any;
scrollAmount: number;
scrollDelay: number;
trueSpeed: boolean;
@@ -5961,112 +5172,7 @@ interface HTMLMarqueeElement extends HTMLElement {
width: string;
start(): void;
stop(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6075,6 +5181,11 @@ declare var HTMLMarqueeElement: {
new(): HTMLMarqueeElement;
}
+interface HTMLMediaElementEventMap extends HTMLElementEventMap {
+ "encrypted": MediaEncryptedEvent;
+ "msneedkey": MSMediaKeyNeededEvent;
+}
+
interface HTMLMediaElement extends HTMLElement {
/**
* Returns an AudioTrackList object with the audio tracks for a given video element.
@@ -6164,8 +5275,8 @@ interface HTMLMediaElement extends HTMLElement {
* Gets the current network activity for the element.
*/
readonly networkState: number;
- onencrypted: (this: this, ev: MediaEncryptedEvent) => any;
- onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any;
+ onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;
+ onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;
/**
* Gets a flag that specifies whether playback is paused.
*/
@@ -6243,111 +5354,7 @@ interface HTMLMediaElement extends HTMLElement {
readonly NETWORK_IDLE: number;
readonly NETWORK_LOADING: number;
readonly NETWORK_NO_SOURCE: number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6368,6 +5375,8 @@ declare var HTMLMediaElement: {
interface HTMLMenuElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMenuElement: {
@@ -6400,6 +5409,8 @@ interface HTMLMetaElement extends HTMLElement {
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
*/
url: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMetaElement: {
@@ -6414,6 +5425,8 @@ interface HTMLMeterElement extends HTMLElement {
min: number;
optimum: number;
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMeterElement: {
@@ -6430,6 +5443,8 @@ interface HTMLModElement extends HTMLElement {
* Sets or retrieves the date and time of a modification to the object.
*/
dateTime: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLModElement: {
@@ -6444,6 +5459,8 @@ interface HTMLOListElement extends HTMLElement {
*/
start: number;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOListElement: {
@@ -6563,6 +5580,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6601,6 +5619,8 @@ interface HTMLOptGroupElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptGroupElement: {
@@ -6638,6 +5658,8 @@ interface HTMLOptionElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptionElement: {
@@ -6664,6 +5686,8 @@ interface HTMLParagraphElement extends HTMLElement {
*/
align: string;
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParagraphElement: {
@@ -6688,6 +5712,8 @@ interface HTMLParamElement extends HTMLElement {
* Sets or retrieves the data type of the value attribute.
*/
valueType: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParamElement: {
@@ -6696,6 +5722,8 @@ declare var HTMLParamElement: {
}
interface HTMLPictureElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPictureElement: {
@@ -6708,6 +5736,8 @@ interface HTMLPreElement extends HTMLElement {
* Sets or gets a value that you can use to implement your own width functionality for the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPreElement: {
@@ -6732,6 +5762,8 @@ interface HTMLProgressElement extends HTMLElement {
* Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLProgressElement: {
@@ -6744,6 +5776,8 @@ interface HTMLQuoteElement extends HTMLElement {
* Sets or retrieves reference information about the object.
*/
cite: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLQuoteElement: {
@@ -6782,6 +5816,8 @@ interface HTMLScriptElement extends HTMLElement {
*/
type: string;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLScriptElement: {
@@ -6876,6 +5912,8 @@ interface HTMLSelectElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -6900,6 +5938,8 @@ interface HTMLSourceElement extends HTMLElement {
* Gets or sets the MIME type of a media resource.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSourceElement: {
@@ -6908,6 +5948,8 @@ declare var HTMLSourceElement: {
}
interface HTMLSpanElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSpanElement: {
@@ -6925,6 +5967,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle {
* Retrieves the CSS language in which the style sheet is written.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6942,6 +5985,8 @@ interface HTMLTableCaptionElement extends HTMLElement {
* Sets or retrieves whether the caption appears at the top or bottom of the table.
*/
vAlign: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableCaptionElement: {
@@ -6995,6 +6040,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7016,6 +6062,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7136,6 +6183,8 @@ interface HTMLTableElement extends HTMLElement {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableElement: {
@@ -7187,6 +6236,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.
*/
insertCell(index?: number): HTMLTableDataCellElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7214,6 +6264,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7224,6 +6275,8 @@ declare var HTMLTableSectionElement: {
interface HTMLTemplateElement extends HTMLElement {
readonly content: DocumentFragment;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTemplateElement: {
@@ -7329,6 +6382,8 @@ interface HTMLTextAreaElement extends HTMLElement {
* @param end The offset into the text field for the end of the selection.
*/
setSelectionRange(start: number, end: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTextAreaElement: {
@@ -7341,6 +6396,8 @@ interface HTMLTitleElement extends HTMLElement {
* Retrieves or sets the text of the object as a string.
*/
text: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTitleElement: {
@@ -7360,6 +6417,8 @@ interface HTMLTrackElement extends HTMLElement {
readonly LOADED: number;
readonly LOADING: number;
readonly NONE: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTrackElement: {
@@ -7374,6 +6433,8 @@ declare var HTMLTrackElement: {
interface HTMLUListElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUListElement: {
@@ -7382,6 +6443,8 @@ declare var HTMLUListElement: {
}
interface HTMLUnknownElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUnknownElement: {
@@ -7389,6 +6452,12 @@ declare var HTMLUnknownElement: {
new(): HTMLUnknownElement;
}
+interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {
+ "MSVideoFormatChanged": Event;
+ "MSVideoFrameStepCompleted": Event;
+ "MSVideoOptimalLayoutChanged": Event;
+}
+
interface HTMLVideoElement extends HTMLMediaElement {
/**
* Gets or sets the height of the video element.
@@ -7400,9 +6469,9 @@ interface HTMLVideoElement extends HTMLMediaElement {
msStereo3DPackingMode: string;
msStereo3DRenderMode: string;
msZoom: boolean;
- onMSVideoFormatChanged: (this: this, ev: Event) => any;
- onMSVideoFrameStepCompleted: (this: this, ev: Event) => any;
- onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any;
+ onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;
/**
* Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available.
*/
@@ -7429,114 +6498,7 @@ interface HTMLVideoElement extends HTMLMediaElement {
webkitEnterFullscreen(): void;
webkitExitFullScreen(): void;
webkitExitFullscreen(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7604,11 +6566,16 @@ declare var IDBCursorWithValue: {
new(): IDBCursorWithValue;
}
+interface IDBDatabaseEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+}
+
interface IDBDatabase extends EventTarget {
readonly name: string;
readonly objectStoreNames: DOMStringList;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBDatabase, ev: Event) => any;
+ onerror: (this: IDBDatabase, ev: ErrorEvent) => any;
version: number;
onversionchange: (ev: IDBVersionChangeEvent) => any;
close(): void;
@@ -7616,8 +6583,7 @@ interface IDBDatabase extends EventTarget {
deleteObjectStore(name: string): void;
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7694,13 +6660,15 @@ declare var IDBObjectStore: {
new(): IDBObjectStore;
}
+interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
+ "blocked": Event;
+ "upgradeneeded": IDBVersionChangeEvent;
+}
+
interface IDBOpenDBRequest extends IDBRequest {
- onblocked: (this: this, ev: Event) => any;
- onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;
- addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
+ onblocked: (this: IDBOpenDBRequest, ev: Event) => any;
+ onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;
+ addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7709,16 +6677,20 @@ declare var IDBOpenDBRequest: {
new(): IDBOpenDBRequest;
}
+interface IDBRequestEventMap {
+ "error": ErrorEvent;
+ "success": Event;
+}
+
interface IDBRequest extends EventTarget {
readonly error: DOMError;
- onerror: (this: this, ev: ErrorEvent) => any;
- onsuccess: (this: this, ev: Event) => any;
+ onerror: (this: IDBRequest, ev: ErrorEvent) => any;
+ onsuccess: (this: IDBRequest, ev: Event) => any;
readonly readyState: string;
readonly result: any;
source: IDBObjectStore | IDBIndex | IDBCursor;
readonly transaction: IDBTransaction;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7727,21 +6699,25 @@ declare var IDBRequest: {
new(): IDBRequest;
}
+interface IDBTransactionEventMap {
+ "abort": Event;
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface IDBTransaction extends EventTarget {
readonly db: IDBDatabase;
readonly error: DOMError;
readonly mode: string;
- onabort: (this: this, ev: Event) => any;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBTransaction, ev: Event) => any;
+ oncomplete: (this: IDBTransaction, ev: Event) => any;
+ onerror: (this: IDBTransaction, ev: ErrorEvent) => any;
abort(): void;
objectStore(name: string): IDBObjectStore;
readonly READ_ONLY: string;
readonly READ_WRITE: string;
readonly VERSION_CHANGE: string;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7874,18 +6850,22 @@ interface MSApp {
}
declare var MSApp: MSApp;
+interface MSAppAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSAppAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;
+ onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
start(): void;
readonly COMPLETED: number;
readonly ERROR: number;
readonly STARTED: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8040,6 +7020,8 @@ interface MSHTMLWebViewElement extends HTMLElement {
navigateWithHttpRequestMessage(requestMessage: any): void;
refresh(): void;
stop(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSHTMLWebViewElement: {
@@ -8047,20 +7029,24 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
+interface MSInputMethodContextEventMap {
+ "MSCandidateWindowHide": Event;
+ "MSCandidateWindowShow": Event;
+ "MSCandidateWindowUpdate": Event;
+}
+
interface MSInputMethodContext extends EventTarget {
readonly compositionEndOffset: number;
readonly compositionStartOffset: number;
- oncandidatewindowhide: (this: this, ev: Event) => any;
- oncandidatewindowshow: (this: this, ev: Event) => any;
- oncandidatewindowupdate: (this: this, ev: Event) => any;
+ oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;
readonly target: HTMLElement;
getCandidateWindowClientRect(): ClientRect;
getCompositionAlternatives(): string[];
hasComposition(): boolean;
isCandidateWindowVisible(): boolean;
- addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSInputMethodContextEventMap>(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8226,6 +7212,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader {
readAsBlob(stream: MSStream, size?: number): void;
readAsDataURL(stream: MSStream, size?: number): void;
readAsText(stream: MSStream, encoding?: string, size?: number): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8234,10 +7221,15 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
+interface MSWebViewAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSWebViewAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;
+ onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
readonly target: MSHTMLWebViewElement;
@@ -8249,8 +7241,7 @@ interface MSWebViewAsyncOperation extends EventTarget {
readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;
readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;
readonly TYPE_INVOKE_SCRIPT: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSWebViewAsyncOperationEventMap>(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8287,12 +7278,16 @@ declare var MediaDeviceInfo: {
new(): MediaDeviceInfo;
}
+interface MediaDevicesEventMap {
+ "devicechange": Event;
+}
+
interface MediaDevices extends EventTarget {
- ondevicechange: (this: this, ev: Event) => any;
+ ondevicechange: (this: MediaDevices, ev: Event) => any;
enumerateDevices(): any;
getSupportedConstraints(): MediaTrackSupportedConstraints;
getUserMedia(constraints: MediaStreamConstraints): PromiseLike<MediaStream>;
- addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8442,13 +7437,20 @@ declare var MediaSource: {
isTypeSupported(type: string): boolean;
}
+interface MediaStreamEventMap {
+ "active": Event;
+ "addtrack": TrackEvent;
+ "inactive": Event;
+ "removetrack": TrackEvent;
+}
+
interface MediaStream extends EventTarget {
readonly active: boolean;
readonly id: string;
- onactive: (this: this, ev: Event) => any;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- oninactive: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onactive: (this: MediaStream, ev: Event) => any;
+ onaddtrack: (this: MediaStream, ev: TrackEvent) => any;
+ oninactive: (this: MediaStream, ev: Event) => any;
+ onremovetrack: (this: MediaStream, ev: TrackEvent) => any;
addTrack(track: MediaStreamTrack): void;
clone(): MediaStream;
getAudioTracks(): MediaStreamTrack[];
@@ -8457,10 +7459,7 @@ interface MediaStream extends EventTarget {
getVideoTracks(): MediaStreamTrack[];
removeTrack(track: MediaStreamTrack): void;
stop(): void;
- addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8497,16 +7496,23 @@ declare var MediaStreamErrorEvent: {
new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;
}
+interface MediaStreamTrackEventMap {
+ "ended": MediaStreamErrorEvent;
+ "mute": Event;
+ "overconstrained": MediaStreamErrorEvent;
+ "unmute": Event;
+}
+
interface MediaStreamTrack extends EventTarget {
enabled: boolean;
readonly id: string;
readonly kind: string;
readonly label: string;
readonly muted: boolean;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onmute: (this: this, ev: Event) => any;
- onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any;
- onunmute: (this: this, ev: Event) => any;
+ onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onmute: (this: MediaStreamTrack, ev: Event) => any;
+ onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onunmute: (this: MediaStreamTrack, ev: Event) => any;
readonly readonly: boolean;
readonly readyState: string;
readonly remote: boolean;
@@ -8516,10 +7522,7 @@ interface MediaStreamTrack extends EventTarget {
getConstraints(): MediaTrackConstraints;
getSettings(): MediaTrackSettings;
stop(): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8560,12 +7563,16 @@ declare var MessageEvent: {
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
}
+interface MessagePortEventMap {
+ "message": MessageEvent;
+}
+
interface MessagePort extends EventTarget {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: MessagePort, ev: MessageEvent) => any;
close(): void;
postMessage(message?: any, ports?: any): void;
start(): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8743,7 +7750,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike<MediaKeySystemAccess>;
vibrate(pattern: number | number[]): boolean;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var Navigator: {
@@ -8918,10 +7924,14 @@ declare var OfflineAudioCompletionEvent: {
new(): OfflineAudioCompletionEvent;
}
+interface OfflineAudioContextEventMap {
+ "complete": Event;
+}
+
interface OfflineAudioContext extends AudioContext {
- oncomplete: (this: this, ev: Event) => any;
+ oncomplete: (this: OfflineAudioContext, ev: Event) => any;
startRendering(): PromiseLike<AudioBuffer>;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -8930,15 +7940,19 @@ declare var OfflineAudioContext: {
new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
+interface OscillatorNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface OscillatorNode extends AudioNode {
readonly detune: AudioParam;
readonly frequency: AudioParam;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;
type: string;
setPeriodicWave(periodicWave: PeriodicWave): void;
start(when?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OscillatorNodeEventMap>(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9317,9 +8331,14 @@ declare var RTCDTMFToneChangeEvent: {
new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;
}
+interface RTCDtlsTransportEventMap {
+ "dtlsstatechange": RTCDtlsTransportStateChangedEvent;
+ "error": ErrorEvent;
+}
+
interface RTCDtlsTransport extends RTCStatsProvider {
- ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
+ onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;
readonly state: string;
readonly transport: RTCIceTransport;
getLocalParameters(): RTCDtlsParameters;
@@ -9327,8 +8346,7 @@ interface RTCDtlsTransport extends RTCStatsProvider {
getRemoteParameters(): RTCDtlsParameters | null;
start(remoteParameters: RTCDtlsParameters): void;
stop(): void;
- addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtlsTransportEventMap>(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9346,15 +8364,19 @@ declare var RTCDtlsTransportStateChangedEvent: {
new(): RTCDtlsTransportStateChangedEvent;
}
+interface RTCDtmfSenderEventMap {
+ "tonechange": RTCDTMFToneChangeEvent;
+}
+
interface RTCDtmfSender extends EventTarget {
readonly canInsertDTMF: boolean;
readonly duration: number;
readonly interToneGap: number;
- ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any;
+ ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;
readonly sender: RTCRtpSender;
readonly toneBuffer: string;
insertDTMF(tones: string, duration?: number, interToneGap?: number): void;
- addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtmfSenderEventMap>(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9372,15 +8394,19 @@ declare var RTCIceCandidatePairChangedEvent: {
new(): RTCIceCandidatePairChangedEvent;
}
+interface RTCIceGathererEventMap {
+ "error": ErrorEvent;
+ "localcandidate": RTCIceGathererEvent;
+}
+
interface RTCIceGatherer extends RTCStatsProvider {
readonly component: string;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null;
+ onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;
+ onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;
createAssociatedGatherer(): RTCIceGatherer;
getLocalCandidates(): RTCIceCandidate[];
getLocalParameters(): RTCIceParameters;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceGathererEventMap>(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9398,11 +8424,16 @@ declare var RTCIceGathererEvent: {
new(): RTCIceGathererEvent;
}
+interface RTCIceTransportEventMap {
+ "candidatepairchange": RTCIceCandidatePairChangedEvent;
+ "icestatechange": RTCIceTransportStateChangedEvent;
+}
+
interface RTCIceTransport extends RTCStatsProvider {
readonly component: string;
readonly iceGatherer: RTCIceGatherer | null;
- oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null;
- onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null;
+ oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;
+ onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;
readonly role: string;
readonly state: string;
addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;
@@ -9413,8 +8444,7 @@ interface RTCIceTransport extends RTCStatsProvider {
setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;
start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;
stop(): void;
- addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9432,8 +8462,12 @@ declare var RTCIceTransportStateChangedEvent: {
new(): RTCIceTransportStateChangedEvent;
}
+interface RTCRtpReceiverEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCRtpReceiver extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack | null;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -9442,7 +8476,7 @@ interface RTCRtpReceiver extends RTCStatsProvider {
requestSendCSRC(csrc: number): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpReceiverEventMap>(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9452,9 +8486,14 @@ declare var RTCRtpReceiver: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCRtpSenderEventMap {
+ "error": ErrorEvent;
+ "ssrcconflict": RTCSsrcConflictEvent;
+}
+
interface RTCRtpSender extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null;
+ onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;
+ onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -9462,8 +8501,7 @@ interface RTCRtpSender extends RTCStatsProvider {
setTrack(track: MediaStreamTrack): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpSenderEventMap>(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9473,10 +8511,14 @@ declare var RTCRtpSender: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCSrtpSdesTransportEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCSrtpSdesTransport extends EventTarget {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;
readonly transport: RTCIceTransport;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCSrtpSdesTransportEventMap>(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9551,6 +8593,7 @@ declare var Range: {
interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {
readonly target: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9707,6 +8750,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
readonly r: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9717,6 +8761,7 @@ declare var SVGCircleElement: {
interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {
readonly clipPathUnits: SVGAnimatedEnumeration;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9739,6 +8784,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement {
readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGComponentTransferFunctionElement: {
@@ -9753,6 +8800,7 @@ declare var SVGComponentTransferFunctionElement: {
}
interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9762,6 +8810,7 @@ declare var SVGDefsElement: {
}
interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9770,67 +8819,35 @@ declare var SVGDescElement: {
new(): SVGDescElement;
}
+interface SVGElementEventMap extends ElementEventMap {
+ "click": MouseEvent;
+ "dblclick": MouseEvent;
+ "focusin": FocusEvent;
+ "focusout": FocusEvent;
+ "load": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+}
+
interface SVGElement extends Element {
- onclick: (this: this, ev: MouseEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- onfocusin: (this: this, ev: FocusEvent) => any;
- onfocusout: (this: this, ev: FocusEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onclick: (this: SVGElement, ev: MouseEvent) => any;
+ ondblclick: (this: SVGElement, ev: MouseEvent) => any;
+ onfocusin: (this: SVGElement, ev: FocusEvent) => any;
+ onfocusout: (this: SVGElement, ev: FocusEvent) => any;
+ onload: (this: SVGElement, ev: Event) => any;
+ onmousedown: (this: SVGElement, ev: MouseEvent) => any;
+ onmousemove: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseout: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseover: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseup: (this: SVGElement, ev: MouseEvent) => any;
readonly ownerSVGElement: SVGSVGElement;
readonly viewportElement: SVGElement;
xmlbase: string;
className: any;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9870,6 +8887,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S
readonly cy: SVGAnimatedLength;
readonly rx: SVGAnimatedLength;
readonly ry: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9899,6 +8917,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib
readonly SVG_FEBLEND_MODE_SCREEN: number;
readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;
readonly SVG_FEBLEND_MODE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9933,6 +8952,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard
readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;
readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;
readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9948,6 +8968,7 @@ declare var SVGFEColorMatrixElement: {
interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9971,6 +8992,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt
readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;
readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;
readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10003,6 +9025,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand
readonly SVG_EDGEMODE_NONE: number;
readonly SVG_EDGEMODE_UNKNOWN: number;
readonly SVG_EDGEMODE_WRAP: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10021,6 +9044,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan
readonly kernelUnitLengthX: SVGAnimatedNumber;
readonly kernelUnitLengthY: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10040,6 +9064,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan
readonly SVG_CHANNEL_G: number;
readonly SVG_CHANNEL_R: number;
readonly SVG_CHANNEL_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10056,6 +9081,8 @@ declare var SVGFEDisplacementMapElement: {
interface SVGFEDistantLightElement extends SVGElement {
readonly azimuth: SVGAnimatedNumber;
readonly elevation: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEDistantLightElement: {
@@ -10064,6 +9091,7 @@ declare var SVGFEDistantLightElement: {
}
interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10109,6 +9137,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar
readonly stdDeviationX: SVGAnimatedNumber;
readonly stdDeviationY: SVGAnimatedNumber;
setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10119,6 +9148,7 @@ declare var SVGFEGaussianBlurElement: {
interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {
readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10128,6 +9158,7 @@ declare var SVGFEImageElement: {
}
interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10138,6 +9169,8 @@ declare var SVGFEMergeElement: {
interface SVGFEMergeNodeElement extends SVGElement {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEMergeNodeElement: {
@@ -10153,6 +9186,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;
readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;
readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10168,6 +9202,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri
readonly dx: SVGAnimatedNumber;
readonly dy: SVGAnimatedNumber;
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10180,6 +9215,8 @@ interface SVGFEPointLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEPointLightElement: {
@@ -10194,6 +9231,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta
readonly specularConstant: SVGAnimatedNumber;
readonly specularExponent: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10211,6 +9249,8 @@ interface SVGFESpotLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFESpotLightElement: {
@@ -10220,6 +9260,7 @@ declare var SVGFESpotLightElement: {
interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10241,6 +9282,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;
readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;
readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10265,6 +9307,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
setFilterRes(filterResX: number, filterResY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10278,6 +9321,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10287,6 +9331,7 @@ declare var SVGForeignObjectElement: {
}
interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10303,6 +9348,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc
readonly SVG_SPREADMETHOD_REFLECT: number;
readonly SVG_SPREADMETHOD_REPEAT: number;
readonly SVG_SPREADMETHOD_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10321,6 +9367,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10386,6 +9433,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly x2: SVGAnimatedLength;
readonly y1: SVGAnimatedLength;
readonly y2: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10422,6 +9470,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt
readonly SVG_MARKER_ORIENT_ANGLE: number;
readonly SVG_MARKER_ORIENT_AUTO: number;
readonly SVG_MARKER_ORIENT_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10443,6 +9492,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10477,6 +9527,8 @@ declare var SVGMatrix: {
}
interface SVGMetadataElement extends SVGElement {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGMetadataElement: {
@@ -10532,6 +9584,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
getPathSegAtLength(distance: number): number;
getPointAtLength(distance: number): SVGPoint;
getTotalLength(): number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10824,6 +9877,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10860,6 +9914,7 @@ declare var SVGPointList: {
}
interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10869,6 +9924,7 @@ declare var SVGPolygonElement: {
}
interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10947,6 +10003,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10955,18 +10012,27 @@ declare var SVGRectElement: {
new(): SVGRectElement;
}
+interface SVGSVGElementEventMap extends SVGElementEventMap {
+ "SVGAbort": Event;
+ "SVGError": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "SVGUnload": Event;
+ "SVGZoom": SVGZoomEvent;
+}
+
interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
contentScriptType: string;
contentStyleType: string;
currentScale: number;
readonly currentTranslate: SVGPoint;
readonly height: SVGAnimatedLength;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onzoom: (this: this, ev: SVGZoomEvent) => any;
+ onabort: (this: SVGSVGElement, ev: Event) => any;
+ onerror: (this: SVGSVGElement, ev: Event) => any;
+ onresize: (this: SVGSVGElement, ev: UIEvent) => any;
+ onscroll: (this: SVGSVGElement, ev: UIEvent) => any;
+ onunload: (this: SVGSVGElement, ev: Event) => any;
+ onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;
readonly pixelUnitToMillimeterX: number;
readonly pixelUnitToMillimeterY: number;
readonly screenPixelToMillimeterX: number;
@@ -10998,58 +10064,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest
unpauseAnimations(): void;
unsuspendRedraw(suspendHandleID: number): void;
unsuspendRedrawAll(): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11060,6 +10075,7 @@ declare var SVGSVGElement: {
interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11070,6 +10086,7 @@ declare var SVGScriptElement: {
interface SVGStopElement extends SVGElement, SVGStylable {
readonly offset: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11099,6 +10116,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace {
media: string;
title: string;
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11108,6 +10126,7 @@ declare var SVGStyleElement: {
}
interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11117,6 +10136,7 @@ declare var SVGSwitchElement: {
}
interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11148,6 +10168,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa
readonly LENGTHADJUST_SPACING: number;
readonly LENGTHADJUST_SPACINGANDGLYPHS: number;
readonly LENGTHADJUST_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11160,7 +10181,6 @@ declare var SVGTextContentElement: {
}
interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextElement: {
@@ -11178,7 +10198,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {
readonly TEXTPATH_SPACINGTYPE_AUTO: number;
readonly TEXTPATH_SPACINGTYPE_EXACT: number;
readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextPathElement: {
@@ -11206,6 +10225,7 @@ declare var SVGTextPositioningElement: {
}
interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11277,6 +10297,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11287,6 +10308,7 @@ declare var SVGUseElement: {
interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
readonly viewTarget: SVGStringList;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11318,6 +10340,10 @@ declare var SVGZoomEvent: {
new(): SVGZoomEvent;
}
+interface ScreenEventMap {
+ "MSOrientationChange": Event;
+}
+
interface Screen extends EventTarget {
readonly availHeight: number;
readonly availWidth: number;
@@ -11330,14 +10356,14 @@ interface Screen extends EventTarget {
readonly logicalXDPI: number;
readonly logicalYDPI: number;
readonly msOrientation: string;
- onmsorientationchange: (this: this, ev: Event) => any;
+ onmsorientationchange: (this: Screen, ev: Event) => any;
readonly pixelDepth: number;
readonly systemXDPI: number;
readonly systemYDPI: number;
readonly width: number;
msLockOrientation(orientations: string | string[]): boolean;
msUnlockOrientation(): void;
- addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ScreenEventMap>(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11356,10 +10382,14 @@ declare var ScriptNotifyEvent: {
new(): ScriptNotifyEvent;
}
+interface ScriptProcessorNodeEventMap {
+ "audioprocess": AudioProcessingEvent;
+}
+
interface ScriptProcessorNode extends AudioNode {
readonly bufferSize: number;
- onaudioprocess: (this: this, ev: AudioProcessingEvent) => any;
- addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void;
+ onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;
+ addEventListener<K extends keyof ScriptProcessorNodeEventMap>(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11541,6 +10571,7 @@ declare var SubtleCrypto: {
interface Text extends CharacterData {
readonly wholeText: string;
+ readonly assignedSlot: HTMLSlotElement | null;
splitText(offset: number): Text;
}
@@ -11590,6 +10621,12 @@ declare var TextMetrics: {
new(): TextMetrics;
}
+interface TextTrackEventMap {
+ "cuechange": Event;
+ "error": ErrorEvent;
+ "load": Event;
+}
+
interface TextTrack extends EventTarget {
readonly activeCues: TextTrackCueList;
readonly cues: TextTrackCueList;
@@ -11598,9 +10635,9 @@ interface TextTrack extends EventTarget {
readonly label: string;
readonly language: string;
mode: any;
- oncuechange: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
+ oncuechange: (this: TextTrack, ev: Event) => any;
+ onerror: (this: TextTrack, ev: ErrorEvent) => any;
+ onload: (this: TextTrack, ev: Event) => any;
readonly readyState: number;
addCue(cue: TextTrackCue): void;
removeCue(cue: TextTrackCue): void;
@@ -11611,9 +10648,7 @@ interface TextTrack extends EventTarget {
readonly LOADING: number;
readonly NONE: number;
readonly SHOWING: number;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11629,18 +10664,22 @@ declare var TextTrack: {
readonly SHOWING: number;
}
+interface TextTrackCueEventMap {
+ "enter": Event;
+ "exit": Event;
+}
+
interface TextTrackCue extends EventTarget {
endTime: number;
id: string;
- onenter: (this: this, ev: Event) => any;
- onexit: (this: this, ev: Event) => any;
+ onenter: (this: TextTrackCue, ev: Event) => any;
+ onexit: (this: TextTrackCue, ev: Event) => any;
pauseOnExit: boolean;
startTime: number;
text: string;
readonly track: TextTrack;
getCueAsHTML(): DocumentFragment;
- addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11661,11 +10700,15 @@ declare var TextTrackCueList: {
new(): TextTrackCueList;
}
+interface TextTrackListEventMap {
+ "addtrack": TrackEvent;
+}
+
interface TextTrackList extends EventTarget {
readonly length: number;
- onaddtrack: ((this: this, ev: TrackEvent) => any) | null;
+ onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;
item(index: number): TextTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackListEventMap>(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: TextTrack;
}
@@ -11855,17 +10898,21 @@ declare var VideoTrack: {
new(): VideoTrack;
}
+interface VideoTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface VideoTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;
+ onchange: (this: VideoTrackList, ev: Event) => any;
+ onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;
readonly selectedIndex: number;
getTrackById(id: string): VideoTrack | null;
item(index: number): VideoTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof VideoTrackListEventMap>(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: VideoTrack;
}
@@ -12811,14 +11858,21 @@ declare var WebKitPoint: {
new(x?: number, y?: number): WebKitPoint;
}
+interface WebSocketEventMap {
+ "close": CloseEvent;
+ "error": ErrorEvent;
+ "message": MessageEvent;
+ "open": Event;
+}
+
interface WebSocket extends EventTarget {
binaryType: string;
readonly bufferedAmount: number;
readonly extensions: string;
- onclose: (this: this, ev: CloseEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onopen: (this: this, ev: Event) => any;
+ onclose: (this: WebSocket, ev: CloseEvent) => any;
+ onerror: (this: WebSocket, ev: ErrorEvent) => any;
+ onmessage: (this: WebSocket, ev: MessageEvent) => any;
+ onopen: (this: WebSocket, ev: Event) => any;
readonly protocol: string;
readonly readyState: number;
readonly url: string;
@@ -12828,10 +11882,7 @@ interface WebSocket extends EventTarget {
readonly CLOSING: number;
readonly CONNECTING: number;
readonly OPEN: number;
- addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12867,6 +11918,95 @@ declare var WheelEvent: {
readonly DOM_DELTA_PIXEL: number;
}
+interface WindowEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "compassneedscalibration": Event;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "devicelight": DeviceLightEvent;
+ "devicemotion": DeviceMotionEvent;
+ "deviceorientation": DeviceOrientationEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "message": MessageEvent;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "popstate": PopStateEvent;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "stalled": Event;
+ "storage": StorageEvent;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "unload": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {
readonly applicationCache: ApplicationCache;
readonly clientInformation: Navigator;
@@ -12891,97 +12031,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
name: string;
readonly navigator: Navigator;
offscreenBuffering: string | boolean;
- onabort: (this: this, ev: UIEvent) => any;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncompassneedscalibration: (this: this, ev: Event) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondevicelight: (this: this, ev: DeviceLightEvent) => any;
- ondevicemotion: (this: this, ev: DeviceMotionEvent) => any;
- ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onabort: (this: Window, ev: UIEvent) => any;
+ onafterprint: (this: Window, ev: Event) => any;
+ onbeforeprint: (this: Window, ev: Event) => any;
+ onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;
+ onblur: (this: Window, ev: FocusEvent) => any;
+ oncanplay: (this: Window, ev: Event) => any;
+ oncanplaythrough: (this: Window, ev: Event) => any;
+ onchange: (this: Window, ev: Event) => any;
+ onclick: (this: Window, ev: MouseEvent) => any;
+ oncompassneedscalibration: (this: Window, ev: Event) => any;
+ oncontextmenu: (this: Window, ev: PointerEvent) => any;
+ ondblclick: (this: Window, ev: MouseEvent) => any;
+ ondevicelight: (this: Window, ev: DeviceLightEvent) => any;
+ ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;
+ ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;
+ ondrag: (this: Window, ev: DragEvent) => any;
+ ondragend: (this: Window, ev: DragEvent) => any;
+ ondragenter: (this: Window, ev: DragEvent) => any;
+ ondragleave: (this: Window, ev: DragEvent) => any;
+ ondragover: (this: Window, ev: DragEvent) => any;
+ ondragstart: (this: Window, ev: DragEvent) => any;
+ ondrop: (this: Window, ev: DragEvent) => any;
+ ondurationchange: (this: Window, ev: Event) => any;
+ onemptied: (this: Window, ev: Event) => any;
+ onended: (this: Window, ev: MediaStreamErrorEvent) => any;
onerror: ErrorEventHandler;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
- onreset: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onstalled: (this: this, ev: Event) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
+ onfocus: (this: Window, ev: FocusEvent) => any;
+ onhashchange: (this: Window, ev: HashChangeEvent) => any;
+ oninput: (this: Window, ev: Event) => any;
+ oninvalid: (this: Window, ev: Event) => any;
+ onkeydown: (this: Window, ev: KeyboardEvent) => any;
+ onkeypress: (this: Window, ev: KeyboardEvent) => any;
+ onkeyup: (this: Window, ev: KeyboardEvent) => any;
+ onload: (this: Window, ev: Event) => any;
+ onloadeddata: (this: Window, ev: Event) => any;
+ onloadedmetadata: (this: Window, ev: Event) => any;
+ onloadstart: (this: Window, ev: Event) => any;
+ onmessage: (this: Window, ev: MessageEvent) => any;
+ onmousedown: (this: Window, ev: MouseEvent) => any;
+ onmouseenter: (this: Window, ev: MouseEvent) => any;
+ onmouseleave: (this: Window, ev: MouseEvent) => any;
+ onmousemove: (this: Window, ev: MouseEvent) => any;
+ onmouseout: (this: Window, ev: MouseEvent) => any;
+ onmouseover: (this: Window, ev: MouseEvent) => any;
+ onmouseup: (this: Window, ev: MouseEvent) => any;
+ onmousewheel: (this: Window, ev: WheelEvent) => any;
+ onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;
+ onmspointercancel: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Window, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Window, ev: MSPointerEvent) => any;
+ onoffline: (this: Window, ev: Event) => any;
+ ononline: (this: Window, ev: Event) => any;
+ onorientationchange: (this: Window, ev: Event) => any;
+ onpagehide: (this: Window, ev: PageTransitionEvent) => any;
+ onpageshow: (this: Window, ev: PageTransitionEvent) => any;
+ onpause: (this: Window, ev: Event) => any;
+ onplay: (this: Window, ev: Event) => any;
+ onplaying: (this: Window, ev: Event) => any;
+ onpopstate: (this: Window, ev: PopStateEvent) => any;
+ onprogress: (this: Window, ev: ProgressEvent) => any;
+ onratechange: (this: Window, ev: Event) => any;
+ onreadystatechange: (this: Window, ev: ProgressEvent) => any;
+ onreset: (this: Window, ev: Event) => any;
+ onresize: (this: Window, ev: UIEvent) => any;
+ onscroll: (this: Window, ev: UIEvent) => any;
+ onseeked: (this: Window, ev: Event) => any;
+ onseeking: (this: Window, ev: Event) => any;
+ onselect: (this: Window, ev: UIEvent) => any;
+ onstalled: (this: Window, ev: Event) => any;
+ onstorage: (this: Window, ev: StorageEvent) => any;
+ onsubmit: (this: Window, ev: Event) => any;
+ onsuspend: (this: Window, ev: Event) => any;
+ ontimeupdate: (this: Window, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onunload: (this: Window, ev: Event) => any;
+ onvolumechange: (this: Window, ev: Event) => any;
+ onwaiting: (this: Window, ev: Event) => any;
opener: any;
orientation: string | number;
readonly outerHeight: number;
@@ -13040,101 +12180,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13143,12 +12189,15 @@ declare var Window: {
new(): Window;
}
+interface WorkerEventMap extends AbstractWorkerEventMap {
+ "message": MessageEvent;
+}
+
interface Worker extends EventTarget, AbstractWorker {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: Worker, ev: MessageEvent) => any;
postMessage(message: any, ports?: any): void;
terminate(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13158,6 +12207,8 @@ declare var Worker: {
}
interface XMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLDocument: {
@@ -13165,8 +12216,12 @@ declare var XMLDocument: {
new(): XMLDocument;
}
+interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
+ "readystatechange": Event;
+}
+
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
- onreadystatechange: (this: this, ev: Event) => any;
+ onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
@@ -13194,14 +12249,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
- addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13217,6 +12265,7 @@ declare var XMLHttpRequest: {
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13237,7 +12286,7 @@ declare var XMLSerializer: {
interface XPathEvaluator {
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
createNSResolver(nodeResolver?: Node): XPathNSResolver;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathEvaluator: {
@@ -13246,7 +12295,7 @@ declare var XPathEvaluator: {
}
interface XPathExpression {
- evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression;
+ evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathExpression: {
@@ -13316,9 +12365,13 @@ declare var XSLTProcessor: {
new(): XSLTProcessor;
}
+interface AbstractWorkerEventMap {
+ "error": ErrorEvent;
+}
+
interface AbstractWorker {
- onerror: (this: this, ev: ErrorEvent) => any;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ onerror: (this: AbstractWorker, ev: ErrorEvent) => any;
+ addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13429,25 +12482,29 @@ interface GetSVGDocument {
getSVGDocument(): Document;
}
+interface GlobalEventHandlersEventMap {
+ "pointercancel": PointerEvent;
+ "pointerdown": PointerEvent;
+ "pointerenter": PointerEvent;
+ "pointerleave": PointerEvent;
+ "pointermove": PointerEvent;
+ "pointerout": PointerEvent;
+ "pointerover": PointerEvent;
+ "pointerup": PointerEvent;
+ "wheel": WheelEvent;
+}
+
interface GlobalEventHandlers {
- onpointercancel: (this: this, ev: PointerEvent) => any;
- onpointerdown: (this: this, ev: PointerEvent) => any;
- onpointerenter: (this: this, ev: PointerEvent) => any;
- onpointerleave: (this: this, ev: PointerEvent) => any;
- onpointermove: (this: this, ev: PointerEvent) => any;
- onpointerout: (this: this, ev: PointerEvent) => any;
- onpointerover: (this: this, ev: PointerEvent) => any;
- onpointerup: (this: this, ev: PointerEvent) => any;
- onwheel: (this: this, ev: WheelEvent) => any;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
+ addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13474,25 +12531,29 @@ interface LinkStyle {
readonly sheet: StyleSheet;
}
+interface MSBaseReaderEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+}
+
interface MSBaseReader {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onabort: (this: MSBaseReader, ev: Event) => any;
+ onerror: (this: MSBaseReader, ev: ErrorEvent) => any;
+ onload: (this: MSBaseReader, ev: Event) => any;
+ onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;
+ onloadstart: (this: MSBaseReader, ev: Event) => any;
+ onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;
readonly readyState: number;
readonly result: any;
abort(): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13541,359 +12602,9 @@ interface NavigatorUserMedia {
}
interface NodeSelector {
- querySelector(selectors: "a"): HTMLAnchorElement | null;
- querySelector(selectors: "abbr"): HTMLElement | null;
- querySelector(selectors: "acronym"): HTMLElement | null;
- querySelector(selectors: "address"): HTMLElement | null;
- querySelector(selectors: "applet"): HTMLAppletElement | null;
- querySelector(selectors: "area"): HTMLAreaElement | null;
- querySelector(selectors: "article"): HTMLElement | null;
- querySelector(selectors: "aside"): HTMLElement | null;
- querySelector(selectors: "audio"): HTMLAudioElement | null;
- querySelector(selectors: "b"): HTMLElement | null;
- querySelector(selectors: "base"): HTMLBaseElement | null;
- querySelector(selectors: "basefont"): HTMLBaseFontElement | null;
- querySelector(selectors: "bdo"): HTMLElement | null;
- querySelector(selectors: "big"): HTMLElement | null;
- querySelector(selectors: "blockquote"): HTMLQuoteElement | null;
- querySelector(selectors: "body"): HTMLBodyElement | null;
- querySelector(selectors: "br"): HTMLBRElement | null;
- querySelector(selectors: "button"): HTMLButtonElement | null;
- querySelector(selectors: "canvas"): HTMLCanvasElement | null;
- querySelector(selectors: "caption"): HTMLTableCaptionElement | null;
- querySelector(selectors: "center"): HTMLElement | null;
- querySelector(selectors: "circle"): SVGCircleElement | null;
- querySelector(selectors: "cite"): HTMLElement | null;
- querySelector(selectors: "clippath"): SVGClipPathElement | null;
- querySelector(selectors: "code"): HTMLElement | null;
- querySelector(selectors: "col"): HTMLTableColElement | null;
- querySelector(selectors: "colgroup"): HTMLTableColElement | null;
- querySelector(selectors: "datalist"): HTMLDataListElement | null;
- querySelector(selectors: "dd"): HTMLElement | null;
- querySelector(selectors: "defs"): SVGDefsElement | null;
- querySelector(selectors: "del"): HTMLModElement | null;
- querySelector(selectors: "desc"): SVGDescElement | null;
- querySelector(selectors: "dfn"): HTMLElement | null;
- querySelector(selectors: "dir"): HTMLDirectoryElement | null;
- querySelector(selectors: "div"): HTMLDivElement | null;
- querySelector(selectors: "dl"): HTMLDListElement | null;
- querySelector(selectors: "dt"): HTMLElement | null;
- querySelector(selectors: "ellipse"): SVGEllipseElement | null;
- querySelector(selectors: "em"): HTMLElement | null;
- querySelector(selectors: "embed"): HTMLEmbedElement | null;
- querySelector(selectors: "feblend"): SVGFEBlendElement | null;
- querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement | null;
- querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement | null;
- querySelector(selectors: "fecomposite"): SVGFECompositeElement | null;
- querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement | null;
- querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement | null;
- querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement | null;
- querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement | null;
- querySelector(selectors: "feflood"): SVGFEFloodElement | null;
- querySelector(selectors: "fefunca"): SVGFEFuncAElement | null;
- querySelector(selectors: "fefuncb"): SVGFEFuncBElement | null;
- querySelector(selectors: "fefuncg"): SVGFEFuncGElement | null;
- querySelector(selectors: "fefuncr"): SVGFEFuncRElement | null;
- querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement | null;
- querySelector(selectors: "feimage"): SVGFEImageElement | null;
- querySelector(selectors: "femerge"): SVGFEMergeElement | null;
- querySelector(selectors: "femergenode"): SVGFEMergeNodeElement | null;
- querySelector(selectors: "femorphology"): SVGFEMorphologyElement | null;
- querySelector(selectors: "feoffset"): SVGFEOffsetElement | null;
- querySelector(selectors: "fepointlight"): SVGFEPointLightElement | null;
- querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement | null;
- querySelector(selectors: "fespotlight"): SVGFESpotLightElement | null;
- querySelector(selectors: "fetile"): SVGFETileElement | null;
- querySelector(selectors: "feturbulence"): SVGFETurbulenceElement | null;
- querySelector(selectors: "fieldset"): HTMLFieldSetElement | null;
- querySelector(selectors: "figcaption"): HTMLElement | null;
- querySelector(selectors: "figure"): HTMLElement | null;
- querySelector(selectors: "filter"): SVGFilterElement | null;
- querySelector(selectors: "font"): HTMLFontElement | null;
- querySelector(selectors: "footer"): HTMLElement | null;
- querySelector(selectors: "foreignobject"): SVGForeignObjectElement | null;
- querySelector(selectors: "form"): HTMLFormElement | null;
- querySelector(selectors: "frame"): HTMLFrameElement | null;
- querySelector(selectors: "frameset"): HTMLFrameSetElement | null;
- querySelector(selectors: "g"): SVGGElement | null;
- querySelector(selectors: "h1"): HTMLHeadingElement | null;
- querySelector(selectors: "h2"): HTMLHeadingElement | null;
- querySelector(selectors: "h3"): HTMLHeadingElement | null;
- querySelector(selectors: "h4"): HTMLHeadingElement | null;
- querySelector(selectors: "h5"): HTMLHeadingElement | null;
- querySelector(selectors: "h6"): HTMLHeadingElement | null;
- querySelector(selectors: "head"): HTMLHeadElement | null;
- querySelector(selectors: "header"): HTMLElement | null;
- querySelector(selectors: "hgroup"): HTMLElement | null;
- querySelector(selectors: "hr"): HTMLHRElement | null;
- querySelector(selectors: "html"): HTMLHtmlElement | null;
- querySelector(selectors: "i"): HTMLElement | null;
- querySelector(selectors: "iframe"): HTMLIFrameElement | null;
- querySelector(selectors: "image"): SVGImageElement | null;
- querySelector(selectors: "img"): HTMLImageElement | null;
- querySelector(selectors: "input"): HTMLInputElement | null;
- querySelector(selectors: "ins"): HTMLModElement | null;
- querySelector(selectors: "isindex"): HTMLUnknownElement | null;
- querySelector(selectors: "kbd"): HTMLElement | null;
- querySelector(selectors: "keygen"): HTMLElement | null;
- querySelector(selectors: "label"): HTMLLabelElement | null;
- querySelector(selectors: "legend"): HTMLLegendElement | null;
- querySelector(selectors: "li"): HTMLLIElement | null;
- querySelector(selectors: "line"): SVGLineElement | null;
- querySelector(selectors: "lineargradient"): SVGLinearGradientElement | null;
- querySelector(selectors: "link"): HTMLLinkElement | null;
- querySelector(selectors: "listing"): HTMLPreElement | null;
- querySelector(selectors: "map"): HTMLMapElement | null;
- querySelector(selectors: "mark"): HTMLElement | null;
- querySelector(selectors: "marker"): SVGMarkerElement | null;
- querySelector(selectors: "marquee"): HTMLMarqueeElement | null;
- querySelector(selectors: "mask"): SVGMaskElement | null;
- querySelector(selectors: "menu"): HTMLMenuElement | null;
- querySelector(selectors: "meta"): HTMLMetaElement | null;
- querySelector(selectors: "metadata"): SVGMetadataElement | null;
- querySelector(selectors: "meter"): HTMLMeterElement | null;
- querySelector(selectors: "nav"): HTMLElement | null;
- querySelector(selectors: "nextid"): HTMLUnknownElement | null;
- querySelector(selectors: "nobr"): HTMLElement | null;
- querySelector(selectors: "noframes"): HTMLElement | null;
- querySelector(selectors: "noscript"): HTMLElement | null;
- querySelector(selectors: "object"): HTMLObjectElement | null;
- querySelector(selectors: "ol"): HTMLOListElement | null;
- querySelector(selectors: "optgroup"): HTMLOptGroupElement | null;
- querySelector(selectors: "option"): HTMLOptionElement | null;
- querySelector(selectors: "p"): HTMLParagraphElement | null;
- querySelector(selectors: "param"): HTMLParamElement | null;
- querySelector(selectors: "path"): SVGPathElement | null;
- querySelector(selectors: "pattern"): SVGPatternElement | null;
- querySelector(selectors: "picture"): HTMLPictureElement | null;
- querySelector(selectors: "plaintext"): HTMLElement | null;
- querySelector(selectors: "polygon"): SVGPolygonElement | null;
- querySelector(selectors: "polyline"): SVGPolylineElement | null;
- querySelector(selectors: "pre"): HTMLPreElement | null;
- querySelector(selectors: "progress"): HTMLProgressElement | null;
- querySelector(selectors: "q"): HTMLQuoteElement | null;
- querySelector(selectors: "radialgradient"): SVGRadialGradientElement | null;
- querySelector(selectors: "rect"): SVGRectElement | null;
- querySelector(selectors: "rt"): HTMLElement | null;
- querySelector(selectors: "ruby"): HTMLElement | null;
- querySelector(selectors: "s"): HTMLElement | null;
- querySelector(selectors: "samp"): HTMLElement | null;
- querySelector(selectors: "script"): HTMLScriptElement | null;
- querySelector(selectors: "section"): HTMLElement | null;
- querySelector(selectors: "select"): HTMLSelectElement | null;
- querySelector(selectors: "small"): HTMLElement | null;
- querySelector(selectors: "source"): HTMLSourceElement | null;
- querySelector(selectors: "span"): HTMLSpanElement | null;
- querySelector(selectors: "stop"): SVGStopElement | null;
- querySelector(selectors: "strike"): HTMLElement | null;
- querySelector(selectors: "strong"): HTMLElement | null;
- querySelector(selectors: "style"): HTMLStyleElement | null;
- querySelector(selectors: "sub"): HTMLElement | null;
- querySelector(selectors: "sup"): HTMLElement | null;
- querySelector(selectors: "svg"): SVGSVGElement | null;
- querySelector(selectors: "switch"): SVGSwitchElement | null;
- querySelector(selectors: "symbol"): SVGSymbolElement | null;
- querySelector(selectors: "table"): HTMLTableElement | null;
- querySelector(selectors: "tbody"): HTMLTableSectionElement | null;
- querySelector(selectors: "td"): HTMLTableDataCellElement | null;
- querySelector(selectors: "template"): HTMLTemplateElement | null;
- querySelector(selectors: "text"): SVGTextElement | null;
- querySelector(selectors: "textpath"): SVGTextPathElement | null;
- querySelector(selectors: "textarea"): HTMLTextAreaElement | null;
- querySelector(selectors: "tfoot"): HTMLTableSectionElement | null;
- querySelector(selectors: "th"): HTMLTableHeaderCellElement | null;
- querySelector(selectors: "thead"): HTMLTableSectionElement | null;
- querySelector(selectors: "title"): HTMLTitleElement | null;
- querySelector(selectors: "tr"): HTMLTableRowElement | null;
- querySelector(selectors: "track"): HTMLTrackElement | null;
- querySelector(selectors: "tspan"): SVGTSpanElement | null;
- querySelector(selectors: "tt"): HTMLElement | null;
- querySelector(selectors: "u"): HTMLElement | null;
- querySelector(selectors: "ul"): HTMLUListElement | null;
- querySelector(selectors: "use"): SVGUseElement | null;
- querySelector(selectors: "var"): HTMLElement | null;
- querySelector(selectors: "video"): HTMLVideoElement | null;
- querySelector(selectors: "view"): SVGViewElement | null;
- querySelector(selectors: "wbr"): HTMLElement | null;
- querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement | null;
- querySelector(selectors: "xmp"): HTMLPreElement | null;
+ querySelector<K extends keyof ElementTagNameMap>(selectors: K): ElementTagNameMap[K] | null;
querySelector(selectors: string): Element | null;
- querySelectorAll(selectors: "a"): NodeListOf<HTMLAnchorElement>;
- querySelectorAll(selectors: "abbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "acronym"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "address"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "applet"): NodeListOf<HTMLAppletElement>;
- querySelectorAll(selectors: "area"): NodeListOf<HTMLAreaElement>;
- querySelectorAll(selectors: "article"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "aside"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "audio"): NodeListOf<HTMLAudioElement>;
- querySelectorAll(selectors: "b"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "base"): NodeListOf<HTMLBaseElement>;
- querySelectorAll(selectors: "basefont"): NodeListOf<HTMLBaseFontElement>;
- querySelectorAll(selectors: "bdo"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "big"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "blockquote"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "body"): NodeListOf<HTMLBodyElement>;
- querySelectorAll(selectors: "br"): NodeListOf<HTMLBRElement>;
- querySelectorAll(selectors: "button"): NodeListOf<HTMLButtonElement>;
- querySelectorAll(selectors: "canvas"): NodeListOf<HTMLCanvasElement>;
- querySelectorAll(selectors: "caption"): NodeListOf<HTMLTableCaptionElement>;
- querySelectorAll(selectors: "center"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "circle"): NodeListOf<SVGCircleElement>;
- querySelectorAll(selectors: "cite"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "clippath"): NodeListOf<SVGClipPathElement>;
- querySelectorAll(selectors: "code"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "col"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "colgroup"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "datalist"): NodeListOf<HTMLDataListElement>;
- querySelectorAll(selectors: "dd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "defs"): NodeListOf<SVGDefsElement>;
- querySelectorAll(selectors: "del"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "desc"): NodeListOf<SVGDescElement>;
- querySelectorAll(selectors: "dfn"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "dir"): NodeListOf<HTMLDirectoryElement>;
- querySelectorAll(selectors: "div"): NodeListOf<HTMLDivElement>;
- querySelectorAll(selectors: "dl"): NodeListOf<HTMLDListElement>;
- querySelectorAll(selectors: "dt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ellipse"): NodeListOf<SVGEllipseElement>;
- querySelectorAll(selectors: "em"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "embed"): NodeListOf<HTMLEmbedElement>;
- querySelectorAll(selectors: "feblend"): NodeListOf<SVGFEBlendElement>;
- querySelectorAll(selectors: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- querySelectorAll(selectors: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- querySelectorAll(selectors: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- querySelectorAll(selectors: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- querySelectorAll(selectors: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- querySelectorAll(selectors: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- querySelectorAll(selectors: "feflood"): NodeListOf<SVGFEFloodElement>;
- querySelectorAll(selectors: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- querySelectorAll(selectors: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- querySelectorAll(selectors: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- querySelectorAll(selectors: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- querySelectorAll(selectors: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- querySelectorAll(selectors: "feimage"): NodeListOf<SVGFEImageElement>;
- querySelectorAll(selectors: "femerge"): NodeListOf<SVGFEMergeElement>;
- querySelectorAll(selectors: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- querySelectorAll(selectors: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- querySelectorAll(selectors: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- querySelectorAll(selectors: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- querySelectorAll(selectors: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- querySelectorAll(selectors: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- querySelectorAll(selectors: "fetile"): NodeListOf<SVGFETileElement>;
- querySelectorAll(selectors: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- querySelectorAll(selectors: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- querySelectorAll(selectors: "figcaption"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "figure"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "filter"): NodeListOf<SVGFilterElement>;
- querySelectorAll(selectors: "font"): NodeListOf<HTMLFontElement>;
- querySelectorAll(selectors: "footer"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- querySelectorAll(selectors: "form"): NodeListOf<HTMLFormElement>;
- querySelectorAll(selectors: "frame"): NodeListOf<HTMLFrameElement>;
- querySelectorAll(selectors: "frameset"): NodeListOf<HTMLFrameSetElement>;
- querySelectorAll(selectors: "g"): NodeListOf<SVGGElement>;
- querySelectorAll(selectors: "h1"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h2"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h3"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h4"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h5"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h6"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "head"): NodeListOf<HTMLHeadElement>;
- querySelectorAll(selectors: "header"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hgroup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hr"): NodeListOf<HTMLHRElement>;
- querySelectorAll(selectors: "html"): NodeListOf<HTMLHtmlElement>;
- querySelectorAll(selectors: "i"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "iframe"): NodeListOf<HTMLIFrameElement>;
- querySelectorAll(selectors: "image"): NodeListOf<SVGImageElement>;
- querySelectorAll(selectors: "img"): NodeListOf<HTMLImageElement>;
- querySelectorAll(selectors: "input"): NodeListOf<HTMLInputElement>;
- querySelectorAll(selectors: "ins"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "isindex"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "kbd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "keygen"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "label"): NodeListOf<HTMLLabelElement>;
- querySelectorAll(selectors: "legend"): NodeListOf<HTMLLegendElement>;
- querySelectorAll(selectors: "li"): NodeListOf<HTMLLIElement>;
- querySelectorAll(selectors: "line"): NodeListOf<SVGLineElement>;
- querySelectorAll(selectors: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- querySelectorAll(selectors: "link"): NodeListOf<HTMLLinkElement>;
- querySelectorAll(selectors: "listing"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "map"): NodeListOf<HTMLMapElement>;
- querySelectorAll(selectors: "mark"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "marker"): NodeListOf<SVGMarkerElement>;
- querySelectorAll(selectors: "marquee"): NodeListOf<HTMLMarqueeElement>;
- querySelectorAll(selectors: "mask"): NodeListOf<SVGMaskElement>;
- querySelectorAll(selectors: "menu"): NodeListOf<HTMLMenuElement>;
- querySelectorAll(selectors: "meta"): NodeListOf<HTMLMetaElement>;
- querySelectorAll(selectors: "metadata"): NodeListOf<SVGMetadataElement>;
- querySelectorAll(selectors: "meter"): NodeListOf<HTMLMeterElement>;
- querySelectorAll(selectors: "nav"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "nextid"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "nobr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noframes"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noscript"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "object"): NodeListOf<HTMLObjectElement>;
- querySelectorAll(selectors: "ol"): NodeListOf<HTMLOListElement>;
- querySelectorAll(selectors: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- querySelectorAll(selectors: "option"): NodeListOf<HTMLOptionElement>;
- querySelectorAll(selectors: "p"): NodeListOf<HTMLParagraphElement>;
- querySelectorAll(selectors: "param"): NodeListOf<HTMLParamElement>;
- querySelectorAll(selectors: "path"): NodeListOf<SVGPathElement>;
- querySelectorAll(selectors: "pattern"): NodeListOf<SVGPatternElement>;
- querySelectorAll(selectors: "picture"): NodeListOf<HTMLPictureElement>;
- querySelectorAll(selectors: "plaintext"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "polygon"): NodeListOf<SVGPolygonElement>;
- querySelectorAll(selectors: "polyline"): NodeListOf<SVGPolylineElement>;
- querySelectorAll(selectors: "pre"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "progress"): NodeListOf<HTMLProgressElement>;
- querySelectorAll(selectors: "q"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- querySelectorAll(selectors: "rect"): NodeListOf<SVGRectElement>;
- querySelectorAll(selectors: "rt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ruby"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "s"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "samp"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "script"): NodeListOf<HTMLScriptElement>;
- querySelectorAll(selectors: "section"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "select"): NodeListOf<HTMLSelectElement>;
- querySelectorAll(selectors: "small"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "source"): NodeListOf<HTMLSourceElement>;
- querySelectorAll(selectors: "span"): NodeListOf<HTMLSpanElement>;
- querySelectorAll(selectors: "stop"): NodeListOf<SVGStopElement>;
- querySelectorAll(selectors: "strike"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "strong"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "style"): NodeListOf<HTMLStyleElement>;
- querySelectorAll(selectors: "sub"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "sup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "svg"): NodeListOf<SVGSVGElement>;
- querySelectorAll(selectors: "switch"): NodeListOf<SVGSwitchElement>;
- querySelectorAll(selectors: "symbol"): NodeListOf<SVGSymbolElement>;
- querySelectorAll(selectors: "table"): NodeListOf<HTMLTableElement>;
- querySelectorAll(selectors: "tbody"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "td"): NodeListOf<HTMLTableDataCellElement>;
- querySelectorAll(selectors: "template"): NodeListOf<HTMLTemplateElement>;
- querySelectorAll(selectors: "text"): NodeListOf<SVGTextElement>;
- querySelectorAll(selectors: "textpath"): NodeListOf<SVGTextPathElement>;
- querySelectorAll(selectors: "textarea"): NodeListOf<HTMLTextAreaElement>;
- querySelectorAll(selectors: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- querySelectorAll(selectors: "thead"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "title"): NodeListOf<HTMLTitleElement>;
- querySelectorAll(selectors: "tr"): NodeListOf<HTMLTableRowElement>;
- querySelectorAll(selectors: "track"): NodeListOf<HTMLTrackElement>;
- querySelectorAll(selectors: "tspan"): NodeListOf<SVGTSpanElement>;
- querySelectorAll(selectors: "tt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "u"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ul"): NodeListOf<HTMLUListElement>;
- querySelectorAll(selectors: "use"): NodeListOf<SVGUseElement>;
- querySelectorAll(selectors: "var"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "video"): NodeListOf<HTMLVideoElement>;
- querySelectorAll(selectors: "view"): NodeListOf<SVGViewElement>;
- querySelectorAll(selectors: "wbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- querySelectorAll(selectors: "xmp"): NodeListOf<HTMLPreElement>;
+ querySelectorAll<K extends keyof ElementListTagNameMap>(selectors: K): ElementListTagNameMap[K];
querySelectorAll(selectors: string): NodeListOf<Element>;
}
@@ -13993,21 +12704,25 @@ interface WindowTimersExtension {
setImmediate(handler: any, ...args: any[]): number;
}
+interface XMLHttpRequestEventTargetEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+ "timeout": ProgressEvent;
+}
+
interface XMLHttpRequestEventTarget {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- ontimeout: (this: this, ev: ProgressEvent) => any;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;
+ onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14267,6 +12982,33 @@ interface ParentNode {
readonly childElementCount: number;
}
+interface DocumentOrShadowRoot {
+ readonly activeElement: Element | null;
+ readonly stylesheets: StyleSheetList;
+ getSelection(): Selection | null;
+ elementFromPoint(x: number, y: number): Element | null;
+ elementsFromPoint(x: number, y: number): Element[];
+}
+
+interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {
+ readonly host: Element;
+ innerHTML: string;
+}
+
+interface ShadowRootInit {
+ mode: 'open'|'closed';
+ delegatesFocus?: boolean;
+}
+
+interface HTMLSlotElement extends HTMLElement {
+ name: string;
+ assignedNodes(options?: AssignedNodesOptions): Node[];
+}
+
+interface AssignedNodesOptions {
+ flatten?: boolean;
+}
+
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -14314,6 +13056,447 @@ interface NavigatorUserMediaErrorCallback {
interface ForEachCallback {
(keyId: any, status: string): void;
}
+interface HTMLElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "audio": HTMLAudioElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "del": HTMLModElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "embed": HTMLEmbedElement;
+ "fieldset": HTMLFieldSetElement;
+ "font": HTMLFontElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "iframe": HTMLIFrameElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "marquee": HTMLMarqueeElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "meter": HTMLMeterElement;
+ "nextid": HTMLUnknownElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "picture": HTMLPictureElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "script": HTMLScriptElement;
+ "select": HTMLSelectElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "style": HTMLStyleElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "ul": HTMLUListElement;
+ "video": HTMLVideoElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "abbr": HTMLElement;
+ "acronym": HTMLElement;
+ "address": HTMLElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "article": HTMLElement;
+ "aside": HTMLElement;
+ "audio": HTMLAudioElement;
+ "b": HTMLElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "bdo": HTMLElement;
+ "big": HTMLElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "center": HTMLElement;
+ "circle": SVGCircleElement;
+ "cite": HTMLElement;
+ "clippath": SVGClipPathElement;
+ "code": HTMLElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "dd": HTMLElement;
+ "defs": SVGDefsElement;
+ "del": HTMLModElement;
+ "desc": SVGDescElement;
+ "dfn": HTMLElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "dt": HTMLElement;
+ "ellipse": SVGEllipseElement;
+ "em": HTMLElement;
+ "embed": HTMLEmbedElement;
+ "feblend": SVGFEBlendElement;
+ "fecolormatrix": SVGFEColorMatrixElement;
+ "fecomponenttransfer": SVGFEComponentTransferElement;
+ "fecomposite": SVGFECompositeElement;
+ "feconvolvematrix": SVGFEConvolveMatrixElement;
+ "fediffuselighting": SVGFEDiffuseLightingElement;
+ "fedisplacementmap": SVGFEDisplacementMapElement;
+ "fedistantlight": SVGFEDistantLightElement;
+ "feflood": SVGFEFloodElement;
+ "fefunca": SVGFEFuncAElement;
+ "fefuncb": SVGFEFuncBElement;
+ "fefuncg": SVGFEFuncGElement;
+ "fefuncr": SVGFEFuncRElement;
+ "fegaussianblur": SVGFEGaussianBlurElement;
+ "feimage": SVGFEImageElement;
+ "femerge": SVGFEMergeElement;
+ "femergenode": SVGFEMergeNodeElement;
+ "femorphology": SVGFEMorphologyElement;
+ "feoffset": SVGFEOffsetElement;
+ "fepointlight": SVGFEPointLightElement;
+ "fespecularlighting": SVGFESpecularLightingElement;
+ "fespotlight": SVGFESpotLightElement;
+ "fetile": SVGFETileElement;
+ "feturbulence": SVGFETurbulenceElement;
+ "fieldset": HTMLFieldSetElement;
+ "figcaption": HTMLElement;
+ "figure": HTMLElement;
+ "filter": SVGFilterElement;
+ "font": HTMLFontElement;
+ "footer": HTMLElement;
+ "foreignobject": SVGForeignObjectElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "g": SVGGElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "header": HTMLElement;
+ "hgroup": HTMLElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "i": HTMLElement;
+ "iframe": HTMLIFrameElement;
+ "image": SVGImageElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "kbd": HTMLElement;
+ "keygen": HTMLElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "line": SVGLineElement;
+ "lineargradient": SVGLinearGradientElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "mark": HTMLElement;
+ "marker": SVGMarkerElement;
+ "marquee": HTMLMarqueeElement;
+ "mask": SVGMaskElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "metadata": SVGMetadataElement;
+ "meter": HTMLMeterElement;
+ "nav": HTMLElement;
+ "nextid": HTMLUnknownElement;
+ "nobr": HTMLElement;
+ "noframes": HTMLElement;
+ "noscript": HTMLElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "path": SVGPathElement;
+ "pattern": SVGPatternElement;
+ "picture": HTMLPictureElement;
+ "plaintext": HTMLElement;
+ "polygon": SVGPolygonElement;
+ "polyline": SVGPolylineElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "radialgradient": SVGRadialGradientElement;
+ "rect": SVGRectElement;
+ "rt": HTMLElement;
+ "ruby": HTMLElement;
+ "s": HTMLElement;
+ "samp": HTMLElement;
+ "script": HTMLScriptElement;
+ "section": HTMLElement;
+ "select": HTMLSelectElement;
+ "small": HTMLElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "stop": SVGStopElement;
+ "strike": HTMLElement;
+ "strong": HTMLElement;
+ "style": HTMLStyleElement;
+ "sub": HTMLElement;
+ "sup": HTMLElement;
+ "svg": SVGSVGElement;
+ "switch": SVGSwitchElement;
+ "symbol": SVGSymbolElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "text": SVGTextElement;
+ "textpath": SVGTextPathElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "tspan": SVGTSpanElement;
+ "tt": HTMLElement;
+ "u": HTMLElement;
+ "ul": HTMLUListElement;
+ "use": SVGUseElement;
+ "var": HTMLElement;
+ "video": HTMLVideoElement;
+ "view": SVGViewElement;
+ "wbr": HTMLElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementListTagNameMap {
+ "a": NodeListOf<HTMLAnchorElement>;
+ "abbr": NodeListOf<HTMLElement>;
+ "acronym": NodeListOf<HTMLElement>;
+ "address": NodeListOf<HTMLElement>;
+ "applet": NodeListOf<HTMLAppletElement>;
+ "area": NodeListOf<HTMLAreaElement>;
+ "article": NodeListOf<HTMLElement>;
+ "aside": NodeListOf<HTMLElement>;
+ "audio": NodeListOf<HTMLAudioElement>;
+ "b": NodeListOf<HTMLElement>;
+ "base": NodeListOf<HTMLBaseElement>;
+ "basefont": NodeListOf<HTMLBaseFontElement>;
+ "bdo": NodeListOf<HTMLElement>;
+ "big": NodeListOf<HTMLElement>;
+ "blockquote": NodeListOf<HTMLQuoteElement>;
+ "body": NodeListOf<HTMLBodyElement>;
+ "br": NodeListOf<HTMLBRElement>;
+ "button": NodeListOf<HTMLButtonElement>;
+ "canvas": NodeListOf<HTMLCanvasElement>;
+ "caption": NodeListOf<HTMLTableCaptionElement>;
+ "center": NodeListOf<HTMLElement>;
+ "circle": NodeListOf<SVGCircleElement>;
+ "cite": NodeListOf<HTMLElement>;
+ "clippath": NodeListOf<SVGClipPathElement>;
+ "code": NodeListOf<HTMLElement>;
+ "col": NodeListOf<HTMLTableColElement>;
+ "colgroup": NodeListOf<HTMLTableColElement>;
+ "datalist": NodeListOf<HTMLDataListElement>;
+ "dd": NodeListOf<HTMLElement>;
+ "defs": NodeListOf<SVGDefsElement>;
+ "del": NodeListOf<HTMLModElement>;
+ "desc": NodeListOf<SVGDescElement>;
+ "dfn": NodeListOf<HTMLElement>;
+ "dir": NodeListOf<HTMLDirectoryElement>;
+ "div": NodeListOf<HTMLDivElement>;
+ "dl": NodeListOf<HTMLDListElement>;
+ "dt": NodeListOf<HTMLElement>;
+ "ellipse": NodeListOf<SVGEllipseElement>;
+ "em": NodeListOf<HTMLElement>;
+ "embed": NodeListOf<HTMLEmbedElement>;
+ "feblend": NodeListOf<SVGFEBlendElement>;
+ "fecolormatrix": NodeListOf<SVGFEColorMatrixElement>;
+ "fecomponenttransfer": NodeListOf<SVGFEComponentTransferElement>;
+ "fecomposite": NodeListOf<SVGFECompositeElement>;
+ "feconvolvematrix": NodeListOf<SVGFEConvolveMatrixElement>;
+ "fediffuselighting": NodeListOf<SVGFEDiffuseLightingElement>;
+ "fedisplacementmap": NodeListOf<SVGFEDisplacementMapElement>;
+ "fedistantlight": NodeListOf<SVGFEDistantLightElement>;
+ "feflood": NodeListOf<SVGFEFloodElement>;
+ "fefunca": NodeListOf<SVGFEFuncAElement>;
+ "fefuncb": NodeListOf<SVGFEFuncBElement>;
+ "fefuncg": NodeListOf<SVGFEFuncGElement>;
+ "fefuncr": NodeListOf<SVGFEFuncRElement>;
+ "fegaussianblur": NodeListOf<SVGFEGaussianBlurElement>;
+ "feimage": NodeListOf<SVGFEImageElement>;
+ "femerge": NodeListOf<SVGFEMergeElement>;
+ "femergenode": NodeListOf<SVGFEMergeNodeElement>;
+ "femorphology": NodeListOf<SVGFEMorphologyElement>;
+ "feoffset": NodeListOf<SVGFEOffsetElement>;
+ "fepointlight": NodeListOf<SVGFEPointLightElement>;
+ "fespecularlighting": NodeListOf<SVGFESpecularLightingElement>;
+ "fespotlight": NodeListOf<SVGFESpotLightElement>;
+ "fetile": NodeListOf<SVGFETileElement>;
+ "feturbulence": NodeListOf<SVGFETurbulenceElement>;
+ "fieldset": NodeListOf<HTMLFieldSetElement>;
+ "figcaption": NodeListOf<HTMLElement>;
+ "figure": NodeListOf<HTMLElement>;
+ "filter": NodeListOf<SVGFilterElement>;
+ "font": NodeListOf<HTMLFontElement>;
+ "footer": NodeListOf<HTMLElement>;
+ "foreignobject": NodeListOf<SVGForeignObjectElement>;
+ "form": NodeListOf<HTMLFormElement>;
+ "frame": NodeListOf<HTMLFrameElement>;
+ "frameset": NodeListOf<HTMLFrameSetElement>;
+ "g": NodeListOf<SVGGElement>;
+ "h1": NodeListOf<HTMLHeadingElement>;
+ "h2": NodeListOf<HTMLHeadingElement>;
+ "h3": NodeListOf<HTMLHeadingElement>;
+ "h4": NodeListOf<HTMLHeadingElement>;
+ "h5": NodeListOf<HTMLHeadingElement>;
+ "h6": NodeListOf<HTMLHeadingElement>;
+ "head": NodeListOf<HTMLHeadElement>;
+ "header": NodeListOf<HTMLElement>;
+ "hgroup": NodeListOf<HTMLElement>;
+ "hr": NodeListOf<HTMLHRElement>;
+ "html": NodeListOf<HTMLHtmlElement>;
+ "i": NodeListOf<HTMLElement>;
+ "iframe": NodeListOf<HTMLIFrameElement>;
+ "image": NodeListOf<SVGImageElement>;
+ "img": NodeListOf<HTMLImageElement>;
+ "input": NodeListOf<HTMLInputElement>;
+ "ins": NodeListOf<HTMLModElement>;
+ "isindex": NodeListOf<HTMLUnknownElement>;
+ "kbd": NodeListOf<HTMLElement>;
+ "keygen": NodeListOf<HTMLElement>;
+ "label": NodeListOf<HTMLLabelElement>;
+ "legend": NodeListOf<HTMLLegendElement>;
+ "li": NodeListOf<HTMLLIElement>;
+ "line": NodeListOf<SVGLineElement>;
+ "lineargradient": NodeListOf<SVGLinearGradientElement>;
+ "link": NodeListOf<HTMLLinkElement>;
+ "listing": NodeListOf<HTMLPreElement>;
+ "map": NodeListOf<HTMLMapElement>;
+ "mark": NodeListOf<HTMLElement>;
+ "marker": NodeListOf<SVGMarkerElement>;
+ "marquee": NodeListOf<HTMLMarqueeElement>;
+ "mask": NodeListOf<SVGMaskElement>;
+ "menu": NodeListOf<HTMLMenuElement>;
+ "meta": NodeListOf<HTMLMetaElement>;
+ "metadata": NodeListOf<SVGMetadataElement>;
+ "meter": NodeListOf<HTMLMeterElement>;
+ "nav": NodeListOf<HTMLElement>;
+ "nextid": NodeListOf<HTMLUnknownElement>;
+ "nobr": NodeListOf<HTMLElement>;
+ "noframes": NodeListOf<HTMLElement>;
+ "noscript": NodeListOf<HTMLElement>;
+ "object": NodeListOf<HTMLObjectElement>;
+ "ol": NodeListOf<HTMLOListElement>;
+ "optgroup": NodeListOf<HTMLOptGroupElement>;
+ "option": NodeListOf<HTMLOptionElement>;
+ "p": NodeListOf<HTMLParagraphElement>;
+ "param": NodeListOf<HTMLParamElement>;
+ "path": NodeListOf<SVGPathElement>;
+ "pattern": NodeListOf<SVGPatternElement>;
+ "picture": NodeListOf<HTMLPictureElement>;
+ "plaintext": NodeListOf<HTMLElement>;
+ "polygon": NodeListOf<SVGPolygonElement>;
+ "polyline": NodeListOf<SVGPolylineElement>;
+ "pre": NodeListOf<HTMLPreElement>;
+ "progress": NodeListOf<HTMLProgressElement>;
+ "q": NodeListOf<HTMLQuoteElement>;
+ "radialgradient": NodeListOf<SVGRadialGradientElement>;
+ "rect": NodeListOf<SVGRectElement>;
+ "rt": NodeListOf<HTMLElement>;
+ "ruby": NodeListOf<HTMLElement>;
+ "s": NodeListOf<HTMLElement>;
+ "samp": NodeListOf<HTMLElement>;
+ "script": NodeListOf<HTMLScriptElement>;
+ "section": NodeListOf<HTMLElement>;
+ "select": NodeListOf<HTMLSelectElement>;
+ "small": NodeListOf<HTMLElement>;
+ "source": NodeListOf<HTMLSourceElement>;
+ "span": NodeListOf<HTMLSpanElement>;
+ "stop": NodeListOf<SVGStopElement>;
+ "strike": NodeListOf<HTMLElement>;
+ "strong": NodeListOf<HTMLElement>;
+ "style": NodeListOf<HTMLStyleElement>;
+ "sub": NodeListOf<HTMLElement>;
+ "sup": NodeListOf<HTMLElement>;
+ "svg": NodeListOf<SVGSVGElement>;
+ "switch": NodeListOf<SVGSwitchElement>;
+ "symbol": NodeListOf<SVGSymbolElement>;
+ "table": NodeListOf<HTMLTableElement>;
+ "tbody": NodeListOf<HTMLTableSectionElement>;
+ "td": NodeListOf<HTMLTableDataCellElement>;
+ "template": NodeListOf<HTMLTemplateElement>;
+ "text": NodeListOf<SVGTextElement>;
+ "textpath": NodeListOf<SVGTextPathElement>;
+ "textarea": NodeListOf<HTMLTextAreaElement>;
+ "tfoot": NodeListOf<HTMLTableSectionElement>;
+ "th": NodeListOf<HTMLTableHeaderCellElement>;
+ "thead": NodeListOf<HTMLTableSectionElement>;
+ "title": NodeListOf<HTMLTitleElement>;
+ "tr": NodeListOf<HTMLTableRowElement>;
+ "track": NodeListOf<HTMLTrackElement>;
+ "tspan": NodeListOf<SVGTSpanElement>;
+ "tt": NodeListOf<HTMLElement>;
+ "u": NodeListOf<HTMLElement>;
+ "ul": NodeListOf<HTMLUListElement>;
+ "use": NodeListOf<SVGUseElement>;
+ "var": NodeListOf<HTMLElement>;
+ "video": NodeListOf<HTMLVideoElement>;
+ "view": NodeListOf<SVGViewElement>;
+ "wbr": NodeListOf<HTMLElement>;
+ "x-ms-webview": NodeListOf<MSHTMLWebViewElement>;
+ "xmp": NodeListOf<HTMLPreElement>;
+}
+
declare var Audio: {new(src?: string): HTMLAudioElement; };
declare var Image: {new(width?: number, height?: number): HTMLImageElement; };
declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };
@@ -14488,7 +13671,6 @@ declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
-declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function clearInterval(handle: number): void;
@@ -14515,101 +13697,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any;
declare var indexedDB: IDBFactory;
declare function atob(encodedString: string): string;
declare function btoa(rawString: string): string;
-declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
+declare function addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
type AAGUID = string;
type AlgorithmIdentifier = string | Algorithm;
diff --git a/node_modules/typescript/lib/lib.es2015.core.d.ts b/node_modules/typescript/lib/lib.es2015.core.d.ts
index 82e2761b7..499d0de52 100644
--- a/node_modules/typescript/lib/lib.es2015.core.d.ts
+++ b/node_modules/typescript/lib/lib.es2015.core.d.ts
@@ -225,13 +225,13 @@ interface NumberConstructor {
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
- isFinite(value: any): value is number;
+ isFinite(number: number): boolean;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
- isInteger(value: any): value is number;
+ isInteger(number: number): boolean;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
@@ -239,13 +239,13 @@ interface NumberConstructor {
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
- isNaN(value: any): value is number;
+ isNaN(number: number): boolean;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
- isSafeInteger(value: any): value is number;
+ isSafeInteger(number: number): boolean;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
diff --git a/node_modules/typescript/lib/lib.es5.d.ts b/node_modules/typescript/lib/lib.es5.d.ts
index 2cf3f7425..8e8b3b1b8 100644
--- a/node_modules/typescript/lib/lib.es5.d.ts
+++ b/node_modules/typescript/lib/lib.es5.d.ts
@@ -200,7 +200,19 @@ interface ObjectConstructor {
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
*/
- freeze<T>(o: T): T;
+ freeze<T>(a: T[]): ReadonlyArray<T>;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T extends Function>(f: T): T;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T>(o: T): Readonly<T>;
/**
* Prevents the addition of new properties to an object.
@@ -1364,6 +1376,34 @@ interface ArrayLike<T> {
}
/**
+ * Make all properties in T optional
+ */
+type Partial<T> = {
+ [P in keyof T]?: T[P];
+};
+
+/**
+ * Make all properties in T readonly
+ */
+type Readonly<T> = {
+ readonly [P in keyof T]: T[P];
+};
+
+/**
+ * From T pick a set of properties K
+ */
+type Pick<T, K extends keyof T> = {
+ [P in K]: T[P];
+}
+
+/**
+ * Construct a type with a set of properties K of type T
+ */
+type Record<K extends string, T> = {
+ [P in K]: T;
+}
+
+/**
* Represents a raw buffer of binary data, which is used to store data for the
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
* but can be passed to a typed array or DataView Object to interpret the raw
diff --git a/node_modules/typescript/lib/lib.es6.d.ts b/node_modules/typescript/lib/lib.es6.d.ts
index 27a57bd91..e2b9565d8 100644
--- a/node_modules/typescript/lib/lib.es6.d.ts
+++ b/node_modules/typescript/lib/lib.es6.d.ts
@@ -200,7 +200,19 @@ interface ObjectConstructor {
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
*/
- freeze<T>(o: T): T;
+ freeze<T>(a: T[]): ReadonlyArray<T>;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T extends Function>(f: T): T;
+
+ /**
+ * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
+ * @param o Object on which to lock the attributes.
+ */
+ freeze<T>(o: T): Readonly<T>;
/**
* Prevents the addition of new properties to an object.
@@ -1364,6 +1376,34 @@ interface ArrayLike<T> {
}
/**
+ * Make all properties in T optional
+ */
+type Partial<T> = {
+ [P in keyof T]?: T[P];
+};
+
+/**
+ * Make all properties in T readonly
+ */
+type Readonly<T> = {
+ readonly [P in keyof T]: T[P];
+};
+
+/**
+ * From T pick a set of properties K
+ */
+type Pick<T, K extends keyof T> = {
+ [P in K]: T[P];
+}
+
+/**
+ * Construct a type with a set of properties K of type T
+ */
+type Record<K extends string, T> = {
+ [P in K]: T;
+}
+
+/**
* Represents a raw buffer of binary data, which is used to store data for the
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
* but can be passed to a typed array or DataView Object to interpret the raw
@@ -4362,13 +4402,13 @@ interface NumberConstructor {
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
- isFinite(value: any): value is number;
+ isFinite(number: number): boolean;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
- isInteger(value: any): value is number;
+ isInteger(number: number): boolean;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
@@ -4376,13 +4416,13 @@ interface NumberConstructor {
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
- isNaN(value: any): value is number;
+ isNaN(number: number): boolean;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
- isSafeInteger(value: any): value is number;
+ isSafeInteger(number: number): boolean;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
@@ -5953,6 +5993,7 @@ interface DoubleRange {
}
interface EventInit {
+ scoped?: boolean;
bubbles?: boolean;
cancelable?: boolean;
}
@@ -6794,15 +6835,26 @@ declare var AnimationEvent: {
new(): AnimationEvent;
}
+interface ApplicationCacheEventMap {
+ "cached": Event;
+ "checking": Event;
+ "downloading": Event;
+ "error": ErrorEvent;
+ "noupdate": Event;
+ "obsolete": Event;
+ "progress": ProgressEvent;
+ "updateready": Event;
+}
+
interface ApplicationCache extends EventTarget {
- oncached: (this: this, ev: Event) => any;
- onchecking: (this: this, ev: Event) => any;
- ondownloading: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onnoupdate: (this: this, ev: Event) => any;
- onobsolete: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onupdateready: (this: this, ev: Event) => any;
+ oncached: (this: ApplicationCache, ev: Event) => any;
+ onchecking: (this: ApplicationCache, ev: Event) => any;
+ ondownloading: (this: ApplicationCache, ev: Event) => any;
+ onerror: (this: ApplicationCache, ev: ErrorEvent) => any;
+ onnoupdate: (this: ApplicationCache, ev: Event) => any;
+ onobsolete: (this: ApplicationCache, ev: Event) => any;
+ onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;
+ onupdateready: (this: ApplicationCache, ev: Event) => any;
readonly status: number;
abort(): void;
swapCache(): void;
@@ -6813,14 +6865,7 @@ interface ApplicationCache extends EventTarget {
readonly OBSOLETE: number;
readonly UNCACHED: number;
readonly UPDATEREADY: number;
- addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ApplicationCacheEventMap>(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -6873,17 +6918,21 @@ declare var AudioBuffer: {
new(): AudioBuffer;
}
+interface AudioBufferSourceNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface AudioBufferSourceNode extends AudioNode {
buffer: AudioBuffer | null;
readonly detune: AudioParam;
loop: boolean;
loopEnd: number;
loopStart: number;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;
readonly playbackRate: AudioParam;
start(when?: number, offset?: number, duration?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioBufferSourceNodeEventMap>(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -7005,16 +7054,20 @@ declare var AudioTrack: {
new(): AudioTrack;
}
+interface AudioTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface AudioTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;
+ onchange: (this: AudioTrackList, ev: Event) => any;
+ onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;
getTrackById(id: string): AudioTrack | null;
item(index: number): AudioTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof AudioTrackListEventMap>(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: AudioTrack;
}
@@ -7715,7 +7768,6 @@ interface CharacterData extends Node, ChildNode {
insertData(offset: number, arg: string): void;
replaceData(offset: number, count: number, arg: string): void;
substringData(offset: number, count: number): string;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var CharacterData: {
@@ -8040,6 +8092,8 @@ declare var DOMTokenList: {
interface DataCue extends TextTrackCue {
data: ArrayBuffer;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DataCue: {
@@ -8168,7 +8222,98 @@ declare var DeviceRotationRate: {
new(): DeviceRotationRate;
}
-interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {
+interface DocumentEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforedeactivate": UIEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "fullscreenchange": Event;
+ "fullscreenerror": Event;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "mssitemodejumplistitemremoved": MSSiteModeEvent;
+ "msthumbnailclick": MSSiteModeEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "pointerlockchange": Event;
+ "pointerlockerror": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectionchange": Event;
+ "selectstart": Event;
+ "stalled": Event;
+ "stop": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "volumechange": Event;
+ "waiting": Event;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
+interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {
/**
* Sets or gets the URL for the current document.
*/
@@ -8291,294 +8436,294 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Fires when the user aborts the download.
* @param ev The event.
*/
- onabort: (this: this, ev: UIEvent) => any;
+ onabort: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object is set as the active element.
* @param ev The event.
*/
- onactivate: (this: this, ev: UIEvent) => any;
+ onactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the object is set as the active element.
* @param ev The event.
*/
- onbeforeactivate: (this: this, ev: UIEvent) => any;
+ onbeforeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires immediately before the activeElement is changed from the current object to another object in the parent document.
* @param ev The event.
*/
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
+ onbeforedeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
*/
- onblur: (this: this, ev: FocusEvent) => any;
+ onblur: (this: Document, ev: FocusEvent) => any;
/**
* Occurs when playback is possible, but would require further buffering.
* @param ev The event.
*/
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
+ oncanplay: (this: Document, ev: Event) => any;
+ oncanplaythrough: (this: Document, ev: Event) => any;
/**
* Fires when the contents of the object or selection have changed.
* @param ev The event.
*/
- onchange: (this: this, ev: Event) => any;
+ onchange: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the left mouse button on the object
* @param ev The mouse event.
*/
- onclick: (this: this, ev: MouseEvent) => any;
+ onclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user clicks the right mouse button in the client area, opening the context menu.
* @param ev The mouse event.
*/
- oncontextmenu: (this: this, ev: PointerEvent) => any;
+ oncontextmenu: (this: Document, ev: PointerEvent) => any;
/**
* Fires when the user double-clicks the object.
* @param ev The mouse event.
*/
- ondblclick: (this: this, ev: MouseEvent) => any;
+ ondblclick: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the activeElement is changed from the current object to another object in the parent document.
* @param ev The UI Event
*/
- ondeactivate: (this: this, ev: UIEvent) => any;
+ ondeactivate: (this: Document, ev: UIEvent) => any;
/**
* Fires on the source object continuously during a drag operation.
* @param ev The event.
*/
- ondrag: (this: this, ev: DragEvent) => any;
+ ondrag: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user releases the mouse at the close of a drag operation.
* @param ev The event.
*/
- ondragend: (this: this, ev: DragEvent) => any;
+ ondragend: (this: Document, 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: (this: this, ev: DragEvent) => any;
+ ondragenter: (this: Document, 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.
*/
- ondragleave: (this: this, ev: DragEvent) => any;
+ ondragleave: (this: Document, ev: DragEvent) => any;
/**
* Fires on the target element continuously while the user drags the object over a valid drop target.
* @param ev The event.
*/
- ondragover: (this: this, ev: DragEvent) => any;
+ ondragover: (this: Document, ev: DragEvent) => any;
/**
* Fires on the source object when the user starts to drag a text selection or selected object.
* @param ev The event.
*/
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
+ ondragstart: (this: Document, ev: DragEvent) => any;
+ ondrop: (this: Document, ev: DragEvent) => any;
/**
* Occurs when the duration attribute is updated.
* @param ev The event.
*/
- ondurationchange: (this: this, ev: Event) => any;
+ ondurationchange: (this: Document, ev: Event) => any;
/**
* Occurs when the media element is reset to its initial state.
* @param ev The event.
*/
- onemptied: (this: this, ev: Event) => any;
+ onemptied: (this: Document, ev: Event) => any;
/**
* Occurs when the end of playback is reached.
* @param ev The event
*/
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: Document, ev: MediaStreamErrorEvent) => any;
/**
* Fires when an error occurs during object loading.
* @param ev The event.
*/
- onerror: (this: this, ev: ErrorEvent) => any;
+ onerror: (this: Document, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
* @param ev The event.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onfullscreenchange: (this: this, ev: Event) => any;
- onfullscreenerror: (this: this, ev: Event) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
+ onfocus: (this: Document, ev: FocusEvent) => any;
+ onfullscreenchange: (this: Document, ev: Event) => any;
+ onfullscreenerror: (this: Document, ev: Event) => any;
+ oninput: (this: Document, ev: Event) => any;
+ oninvalid: (this: Document, ev: Event) => any;
/**
* Fires when the user presses a key.
* @param ev The keyboard event
*/
- onkeydown: (this: this, ev: KeyboardEvent) => any;
+ onkeydown: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user presses an alphanumeric key.
* @param ev The event.
*/
- onkeypress: (this: this, ev: KeyboardEvent) => any;
+ onkeypress: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires when the user releases a key.
* @param ev The keyboard event
*/
- onkeyup: (this: this, ev: KeyboardEvent) => any;
+ onkeyup: (this: Document, ev: KeyboardEvent) => any;
/**
* Fires immediately after the browser loads the object.
* @param ev The event.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: Document, ev: Event) => any;
/**
* Occurs when media data is loaded at the current playback position.
* @param ev The event.
*/
- onloadeddata: (this: this, ev: Event) => any;
+ onloadeddata: (this: Document, ev: Event) => any;
/**
* Occurs when the duration and dimensions of the media have been determined.
* @param ev The event.
*/
- onloadedmetadata: (this: this, ev: Event) => any;
+ onloadedmetadata: (this: Document, ev: Event) => any;
/**
* Occurs when Internet Explorer begins looking for media data.
* @param ev The event.
*/
- onloadstart: (this: this, ev: Event) => any;
+ onloadstart: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the object with either mouse button.
* @param ev The mouse event.
*/
- onmousedown: (this: this, ev: MouseEvent) => any;
+ onmousedown: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse over the object.
* @param ev The mouse event.
*/
- onmousemove: (this: this, ev: MouseEvent) => any;
+ onmousemove: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer outside the boundaries of the object.
* @param ev The mouse event.
*/
- onmouseout: (this: this, ev: MouseEvent) => any;
+ onmouseout: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user moves the mouse pointer into the object.
* @param ev The mouse event.
*/
- onmouseover: (this: this, ev: MouseEvent) => any;
+ onmouseover: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the user releases a mouse button while the mouse is over the object.
* @param ev The mouse event.
*/
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onmouseup: (this: Document, ev: MouseEvent) => any;
/**
* Fires when the wheel button is rotated.
* @param ev The mouse event
*/
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onmousewheel: (this: Document, ev: WheelEvent) => any;
+ onmscontentzoom: (this: Document, ev: UIEvent) => any;
+ onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;
+ onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;
+ onmspointercancel: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Document, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Document, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Document, ev: MSPointerEvent) => any;
/**
* Occurs when an item is removed from a Jump List of a webpage running in Site Mode.
* @param ev The event.
*/
- onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any;
+ onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.
* @param ev The event.
*/
- onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any;
+ onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;
/**
* Occurs when playback is paused.
* @param ev The event.
*/
- onpause: (this: this, ev: Event) => any;
+ onpause: (this: Document, ev: Event) => any;
/**
* Occurs when the play method is requested.
* @param ev The event.
*/
- onplay: (this: this, ev: Event) => any;
+ onplay: (this: Document, ev: Event) => any;
/**
* Occurs when the audio or video has started playing.
* @param ev The event.
*/
- onplaying: (this: this, ev: Event) => any;
- onpointerlockchange: (this: this, ev: Event) => any;
- onpointerlockerror: (this: this, ev: Event) => any;
+ onplaying: (this: Document, ev: Event) => any;
+ onpointerlockchange: (this: Document, ev: Event) => any;
+ onpointerlockerror: (this: Document, ev: Event) => any;
/**
* Occurs to indicate progress while downloading media data.
* @param ev The event.
*/
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onprogress: (this: Document, ev: ProgressEvent) => any;
/**
* Occurs when the playback rate is increased or decreased.
* @param ev The event.
*/
- onratechange: (this: this, ev: Event) => any;
+ onratechange: (this: Document, ev: Event) => any;
/**
* Fires when the state of the object has changed.
* @param ev The event
*/
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
+ onreadystatechange: (this: Document, ev: ProgressEvent) => any;
/**
* Fires when the user resets a form.
* @param ev The event.
*/
- onreset: (this: this, ev: Event) => any;
+ onreset: (this: Document, ev: Event) => any;
/**
* Fires when the user repositions the scroll box in the scroll bar on the object.
* @param ev The event.
*/
- onscroll: (this: this, ev: UIEvent) => any;
+ onscroll: (this: Document, ev: UIEvent) => any;
/**
* Occurs when the seek operation ends.
* @param ev The event.
*/
- onseeked: (this: this, ev: Event) => any;
+ onseeked: (this: Document, ev: Event) => any;
/**
* Occurs when the current playback position is moved.
* @param ev The event.
*/
- onseeking: (this: this, ev: Event) => any;
+ onseeking: (this: Document, ev: Event) => any;
/**
* Fires when the current selection changes.
* @param ev The event.
*/
- onselect: (this: this, ev: UIEvent) => any;
+ onselect: (this: Document, ev: UIEvent) => any;
/**
* Fires when the selection state of a document changes.
* @param ev The event.
*/
- onselectionchange: (this: this, ev: Event) => any;
- onselectstart: (this: this, ev: Event) => any;
+ onselectionchange: (this: Document, ev: Event) => any;
+ onselectstart: (this: Document, ev: Event) => any;
/**
* Occurs when the download has stopped.
* @param ev The event.
*/
- onstalled: (this: this, ev: Event) => any;
+ onstalled: (this: Document, ev: Event) => any;
/**
* Fires when the user clicks the Stop button or leaves the Web page.
* @param ev The event.
*/
- onstop: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
+ onstop: (this: Document, ev: Event) => any;
+ onsubmit: (this: Document, ev: Event) => any;
/**
* Occurs if the load operation has been intentionally halted.
* @param ev The event.
*/
- onsuspend: (this: this, ev: Event) => any;
+ onsuspend: (this: Document, ev: Event) => any;
/**
* Occurs to indicate the current playback position.
* @param ev The event.
*/
- ontimeupdate: (this: this, ev: Event) => any;
+ ontimeupdate: (this: Document, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
@@ -8587,14 +8732,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Occurs when the volume is changed, or playback is muted or unmuted.
* @param ev The event.
*/
- onvolumechange: (this: this, ev: Event) => any;
+ onvolumechange: (this: Document, ev: Event) => any;
/**
* Occurs when playback stops because the next frame of a video resource is not available.
* @param ev The event.
*/
- onwaiting: (this: this, ev: Event) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwaiting: (this: Document, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Document, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Document, ev: Event) => any;
plugins: HTMLCollectionOf<HTMLEmbedElement>;
readonly pointerLockElement: Element;
/**
@@ -8665,86 +8810,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Creates an instance of the element for the specified tag.
* @param tagName The name of an element.
*/
- createElement(tagName: "a"): HTMLAnchorElement;
- createElement(tagName: "applet"): HTMLAppletElement;
- createElement(tagName: "area"): HTMLAreaElement;
- createElement(tagName: "audio"): HTMLAudioElement;
- createElement(tagName: "base"): HTMLBaseElement;
- createElement(tagName: "basefont"): HTMLBaseFontElement;
- createElement(tagName: "blockquote"): HTMLQuoteElement;
- createElement(tagName: "body"): HTMLBodyElement;
- createElement(tagName: "br"): HTMLBRElement;
- createElement(tagName: "button"): HTMLButtonElement;
- createElement(tagName: "canvas"): HTMLCanvasElement;
- createElement(tagName: "caption"): HTMLTableCaptionElement;
- createElement(tagName: "col"): HTMLTableColElement;
- createElement(tagName: "colgroup"): HTMLTableColElement;
- createElement(tagName: "datalist"): HTMLDataListElement;
- createElement(tagName: "del"): HTMLModElement;
- createElement(tagName: "dir"): HTMLDirectoryElement;
- createElement(tagName: "div"): HTMLDivElement;
- createElement(tagName: "dl"): HTMLDListElement;
- createElement(tagName: "embed"): HTMLEmbedElement;
- createElement(tagName: "fieldset"): HTMLFieldSetElement;
- createElement(tagName: "font"): HTMLFontElement;
- createElement(tagName: "form"): HTMLFormElement;
- createElement(tagName: "frame"): HTMLFrameElement;
- createElement(tagName: "frameset"): HTMLFrameSetElement;
- createElement(tagName: "h1"): HTMLHeadingElement;
- createElement(tagName: "h2"): HTMLHeadingElement;
- createElement(tagName: "h3"): HTMLHeadingElement;
- createElement(tagName: "h4"): HTMLHeadingElement;
- createElement(tagName: "h5"): HTMLHeadingElement;
- createElement(tagName: "h6"): HTMLHeadingElement;
- createElement(tagName: "head"): HTMLHeadElement;
- createElement(tagName: "hr"): HTMLHRElement;
- createElement(tagName: "html"): HTMLHtmlElement;
- createElement(tagName: "iframe"): HTMLIFrameElement;
- createElement(tagName: "img"): HTMLImageElement;
- createElement(tagName: "input"): HTMLInputElement;
- createElement(tagName: "ins"): HTMLModElement;
- createElement(tagName: "isindex"): HTMLUnknownElement;
- createElement(tagName: "label"): HTMLLabelElement;
- createElement(tagName: "legend"): HTMLLegendElement;
- createElement(tagName: "li"): HTMLLIElement;
- createElement(tagName: "link"): HTMLLinkElement;
- createElement(tagName: "listing"): HTMLPreElement;
- createElement(tagName: "map"): HTMLMapElement;
- createElement(tagName: "marquee"): HTMLMarqueeElement;
- createElement(tagName: "menu"): HTMLMenuElement;
- createElement(tagName: "meta"): HTMLMetaElement;
- createElement(tagName: "meter"): HTMLMeterElement;
- createElement(tagName: "nextid"): HTMLUnknownElement;
- createElement(tagName: "object"): HTMLObjectElement;
- createElement(tagName: "ol"): HTMLOListElement;
- createElement(tagName: "optgroup"): HTMLOptGroupElement;
- createElement(tagName: "option"): HTMLOptionElement;
- createElement(tagName: "p"): HTMLParagraphElement;
- createElement(tagName: "param"): HTMLParamElement;
- createElement(tagName: "picture"): HTMLPictureElement;
- createElement(tagName: "pre"): HTMLPreElement;
- createElement(tagName: "progress"): HTMLProgressElement;
- createElement(tagName: "q"): HTMLQuoteElement;
- createElement(tagName: "script"): HTMLScriptElement;
- createElement(tagName: "select"): HTMLSelectElement;
- createElement(tagName: "source"): HTMLSourceElement;
- createElement(tagName: "span"): HTMLSpanElement;
- createElement(tagName: "style"): HTMLStyleElement;
- createElement(tagName: "table"): HTMLTableElement;
- createElement(tagName: "tbody"): HTMLTableSectionElement;
- createElement(tagName: "td"): HTMLTableDataCellElement;
- createElement(tagName: "template"): HTMLTemplateElement;
- createElement(tagName: "textarea"): HTMLTextAreaElement;
- createElement(tagName: "tfoot"): HTMLTableSectionElement;
- createElement(tagName: "th"): HTMLTableHeaderCellElement;
- createElement(tagName: "thead"): HTMLTableSectionElement;
- createElement(tagName: "title"): HTMLTitleElement;
- createElement(tagName: "tr"): HTMLTableRowElement;
- createElement(tagName: "track"): HTMLTrackElement;
- createElement(tagName: "ul"): HTMLUListElement;
- createElement(tagName: "video"): HTMLVideoElement;
- createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement;
- createElement(tagName: "xmp"): HTMLPreElement;
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): HTMLElementTagNameMap[K];
createElement(tagName: string): HTMLElement;
createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement
@@ -8846,7 +8912,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param y The y-offset
*/
elementFromPoint(x: number, y: number): Element;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
@@ -8880,182 +8946,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* Retrieves a collection of objects based on the specified element name.
* @param name Specifies the name of an element.
*/
- getElementsByTagName(tagname: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(tagname: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(tagname: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(tagname: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(tagname: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(tagname: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(tagname: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(tagname: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(tagname: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(tagname: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(tagname: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(tagname: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(tagname: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(tagname: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(tagname: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(tagname: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(tagname: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(tagname: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(tagname: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(tagname: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(tagname: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(tagname: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(tagname: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(tagname: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(tagname: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(tagname: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(tagname: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(tagname: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(tagname: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(tagname: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(tagname: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(tagname: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(tagname: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(tagname: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(tagname: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(tagname: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(tagname: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(tagname: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(tagname: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(tagname: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(tagname: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(tagname: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(tagname: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(tagname: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(tagname: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(tagname: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(tagname: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(tagname: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(tagname: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(tagname: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(tagname: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(tagname: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(tagname: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(tagname: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(tagname: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(tagname: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(tagname: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(tagname: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(tagname: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(tagname: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(tagname: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(tagname: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(tagname: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(tagname: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(tagname: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(tagname: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(tagname: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(tagname: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(tagname: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(tagname: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(tagname: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(tagname: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(tagname: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(tagname: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(tagname: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(tagname: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(tagname: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(tagname: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(tagname: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(tagname: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(tagname: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(tagname: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(tagname: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(tagname: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(tagname: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(tagname: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(tagname: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(tagname: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(tagname: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(tagname: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(tagname: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(tagname: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(tagname: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(tagname: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(tagname: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(tagname: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(tagname: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(tagname: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(tagname: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(tagname: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(tagname: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(tagname: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(tagname: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(tagname: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(tagname: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(tagname: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(tagname: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(tagname: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(tagname: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(tagname: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(tagname: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(tagname: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(tagname: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(tagname: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(tagname: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(tagname: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(tagname: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(tagname: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(tagname: K): ElementListTagNameMap[K];
getElementsByTagName(tagname: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -9126,103 +9017,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
* @param content The text and HTML tags to write.
*/
writeln(...content: string[]): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9232,7 +9027,6 @@ declare var Document: {
}
interface DocumentFragment extends Node, NodeSelector, ParentNode {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentFragment: {
@@ -9247,7 +9041,6 @@ interface DocumentType extends Node, ChildNode {
readonly notations: NamedNodeMap;
readonly publicId: string | null;
readonly systemId: string | null;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var DocumentType: {
@@ -9300,6 +9093,36 @@ declare var EXT_texture_filter_anisotropic: {
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
}
+interface ElementEventMap extends GlobalEventHandlersEventMap {
+ "ariarequest": AriaRequestEvent;
+ "command": CommandEvent;
+ "gotpointercapture": PointerEvent;
+ "lostpointercapture": PointerEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSGotPointerCapture": MSPointerEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSLostPointerCapture": MSPointerEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "touchcancel": TouchEvent;
+ "touchend": TouchEvent;
+ "touchmove": TouchEvent;
+ "touchstart": TouchEvent;
+ "webkitfullscreenchange": Event;
+ "webkitfullscreenerror": Event;
+}
+
interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {
readonly classList: DOMTokenList;
className: string;
@@ -9310,33 +9133,33 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
id: string;
msContentZoomFactor: number;
readonly msRegionOverflow: string;
- onariarequest: (this: this, ev: AriaRequestEvent) => any;
- oncommand: (this: this, ev: CommandEvent) => any;
- ongotpointercapture: (this: this, ev: PointerEvent) => any;
- onlostpointercapture: (this: this, ev: PointerEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmslostpointercapture: (this: this, ev: MSPointerEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
+ onariarequest: (this: Element, ev: AriaRequestEvent) => any;
+ oncommand: (this: Element, ev: CommandEvent) => any;
+ ongotpointercapture: (this: Element, ev: PointerEvent) => any;
+ onlostpointercapture: (this: Element, ev: PointerEvent) => any;
+ onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;
+ onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;
+ onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;
+ onmspointercancel: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Element, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Element, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Element, ev: MSPointerEvent) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onwebkitfullscreenchange: (this: this, ev: Event) => any;
- onwebkitfullscreenerror: (this: this, ev: Event) => any;
+ onwebkitfullscreenchange: (this: Element, ev: Event) => any;
+ onwebkitfullscreenerror: (this: Element, ev: Event) => any;
readonly prefix: string | null;
readonly scrollHeight: number;
scrollLeft: number;
@@ -9344,188 +9167,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
readonly scrollWidth: number;
readonly tagName: string;
innerHTML: string;
+ readonly assignedSlot: HTMLSlotElement | null;
+ slot: string;
+ readonly shadowRoot: ShadowRoot | null;
getAttribute(name: string): string | null;
getAttributeNS(namespaceURI: string, localName: string): string;
getAttributeNode(name: string): Attr;
getAttributeNodeNS(namespaceURI: string, localName: string): Attr;
getBoundingClientRect(): ClientRect;
getClientRects(): ClientRectList;
- getElementsByTagName(name: "a"): NodeListOf<HTMLAnchorElement>;
- getElementsByTagName(name: "abbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "acronym"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "address"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "applet"): NodeListOf<HTMLAppletElement>;
- getElementsByTagName(name: "area"): NodeListOf<HTMLAreaElement>;
- getElementsByTagName(name: "article"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "aside"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "audio"): NodeListOf<HTMLAudioElement>;
- getElementsByTagName(name: "b"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "base"): NodeListOf<HTMLBaseElement>;
- getElementsByTagName(name: "basefont"): NodeListOf<HTMLBaseFontElement>;
- getElementsByTagName(name: "bdo"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "big"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "blockquote"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "body"): NodeListOf<HTMLBodyElement>;
- getElementsByTagName(name: "br"): NodeListOf<HTMLBRElement>;
- getElementsByTagName(name: "button"): NodeListOf<HTMLButtonElement>;
- getElementsByTagName(name: "canvas"): NodeListOf<HTMLCanvasElement>;
- getElementsByTagName(name: "caption"): NodeListOf<HTMLTableCaptionElement>;
- getElementsByTagName(name: "center"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "circle"): NodeListOf<SVGCircleElement>;
- getElementsByTagName(name: "cite"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "clippath"): NodeListOf<SVGClipPathElement>;
- getElementsByTagName(name: "code"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "col"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "colgroup"): NodeListOf<HTMLTableColElement>;
- getElementsByTagName(name: "datalist"): NodeListOf<HTMLDataListElement>;
- getElementsByTagName(name: "dd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "defs"): NodeListOf<SVGDefsElement>;
- getElementsByTagName(name: "del"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "desc"): NodeListOf<SVGDescElement>;
- getElementsByTagName(name: "dfn"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "dir"): NodeListOf<HTMLDirectoryElement>;
- getElementsByTagName(name: "div"): NodeListOf<HTMLDivElement>;
- getElementsByTagName(name: "dl"): NodeListOf<HTMLDListElement>;
- getElementsByTagName(name: "dt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ellipse"): NodeListOf<SVGEllipseElement>;
- getElementsByTagName(name: "em"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "embed"): NodeListOf<HTMLEmbedElement>;
- getElementsByTagName(name: "feblend"): NodeListOf<SVGFEBlendElement>;
- getElementsByTagName(name: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- getElementsByTagName(name: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- getElementsByTagName(name: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- getElementsByTagName(name: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- getElementsByTagName(name: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- getElementsByTagName(name: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- getElementsByTagName(name: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- getElementsByTagName(name: "feflood"): NodeListOf<SVGFEFloodElement>;
- getElementsByTagName(name: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- getElementsByTagName(name: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- getElementsByTagName(name: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- getElementsByTagName(name: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- getElementsByTagName(name: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- getElementsByTagName(name: "feimage"): NodeListOf<SVGFEImageElement>;
- getElementsByTagName(name: "femerge"): NodeListOf<SVGFEMergeElement>;
- getElementsByTagName(name: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- getElementsByTagName(name: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- getElementsByTagName(name: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- getElementsByTagName(name: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- getElementsByTagName(name: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- getElementsByTagName(name: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- getElementsByTagName(name: "fetile"): NodeListOf<SVGFETileElement>;
- getElementsByTagName(name: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- getElementsByTagName(name: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- getElementsByTagName(name: "figcaption"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "figure"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "filter"): NodeListOf<SVGFilterElement>;
- getElementsByTagName(name: "font"): NodeListOf<HTMLFontElement>;
- getElementsByTagName(name: "footer"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- getElementsByTagName(name: "form"): NodeListOf<HTMLFormElement>;
- getElementsByTagName(name: "frame"): NodeListOf<HTMLFrameElement>;
- getElementsByTagName(name: "frameset"): NodeListOf<HTMLFrameSetElement>;
- getElementsByTagName(name: "g"): NodeListOf<SVGGElement>;
- getElementsByTagName(name: "h1"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h2"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h3"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h4"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h5"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "h6"): NodeListOf<HTMLHeadingElement>;
- getElementsByTagName(name: "head"): NodeListOf<HTMLHeadElement>;
- getElementsByTagName(name: "header"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hgroup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "hr"): NodeListOf<HTMLHRElement>;
- getElementsByTagName(name: "html"): NodeListOf<HTMLHtmlElement>;
- getElementsByTagName(name: "i"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "iframe"): NodeListOf<HTMLIFrameElement>;
- getElementsByTagName(name: "image"): NodeListOf<SVGImageElement>;
- getElementsByTagName(name: "img"): NodeListOf<HTMLImageElement>;
- getElementsByTagName(name: "input"): NodeListOf<HTMLInputElement>;
- getElementsByTagName(name: "ins"): NodeListOf<HTMLModElement>;
- getElementsByTagName(name: "isindex"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "kbd"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "keygen"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "label"): NodeListOf<HTMLLabelElement>;
- getElementsByTagName(name: "legend"): NodeListOf<HTMLLegendElement>;
- getElementsByTagName(name: "li"): NodeListOf<HTMLLIElement>;
- getElementsByTagName(name: "line"): NodeListOf<SVGLineElement>;
- getElementsByTagName(name: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- getElementsByTagName(name: "link"): NodeListOf<HTMLLinkElement>;
- getElementsByTagName(name: "listing"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "map"): NodeListOf<HTMLMapElement>;
- getElementsByTagName(name: "mark"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "marker"): NodeListOf<SVGMarkerElement>;
- getElementsByTagName(name: "marquee"): NodeListOf<HTMLMarqueeElement>;
- getElementsByTagName(name: "mask"): NodeListOf<SVGMaskElement>;
- getElementsByTagName(name: "menu"): NodeListOf<HTMLMenuElement>;
- getElementsByTagName(name: "meta"): NodeListOf<HTMLMetaElement>;
- getElementsByTagName(name: "metadata"): NodeListOf<SVGMetadataElement>;
- getElementsByTagName(name: "meter"): NodeListOf<HTMLMeterElement>;
- getElementsByTagName(name: "nav"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "nextid"): NodeListOf<HTMLUnknownElement>;
- getElementsByTagName(name: "nobr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noframes"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "noscript"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "object"): NodeListOf<HTMLObjectElement>;
- getElementsByTagName(name: "ol"): NodeListOf<HTMLOListElement>;
- getElementsByTagName(name: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- getElementsByTagName(name: "option"): NodeListOf<HTMLOptionElement>;
- getElementsByTagName(name: "p"): NodeListOf<HTMLParagraphElement>;
- getElementsByTagName(name: "param"): NodeListOf<HTMLParamElement>;
- getElementsByTagName(name: "path"): NodeListOf<SVGPathElement>;
- getElementsByTagName(name: "pattern"): NodeListOf<SVGPatternElement>;
- getElementsByTagName(name: "picture"): NodeListOf<HTMLPictureElement>;
- getElementsByTagName(name: "plaintext"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "polygon"): NodeListOf<SVGPolygonElement>;
- getElementsByTagName(name: "polyline"): NodeListOf<SVGPolylineElement>;
- getElementsByTagName(name: "pre"): NodeListOf<HTMLPreElement>;
- getElementsByTagName(name: "progress"): NodeListOf<HTMLProgressElement>;
- getElementsByTagName(name: "q"): NodeListOf<HTMLQuoteElement>;
- getElementsByTagName(name: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- getElementsByTagName(name: "rect"): NodeListOf<SVGRectElement>;
- getElementsByTagName(name: "rt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ruby"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "s"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "samp"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "script"): NodeListOf<HTMLScriptElement>;
- getElementsByTagName(name: "section"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "select"): NodeListOf<HTMLSelectElement>;
- getElementsByTagName(name: "small"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "source"): NodeListOf<HTMLSourceElement>;
- getElementsByTagName(name: "span"): NodeListOf<HTMLSpanElement>;
- getElementsByTagName(name: "stop"): NodeListOf<SVGStopElement>;
- getElementsByTagName(name: "strike"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "strong"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "style"): NodeListOf<HTMLStyleElement>;
- getElementsByTagName(name: "sub"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "sup"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "svg"): NodeListOf<SVGSVGElement>;
- getElementsByTagName(name: "switch"): NodeListOf<SVGSwitchElement>;
- getElementsByTagName(name: "symbol"): NodeListOf<SVGSymbolElement>;
- getElementsByTagName(name: "table"): NodeListOf<HTMLTableElement>;
- getElementsByTagName(name: "tbody"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "td"): NodeListOf<HTMLTableDataCellElement>;
- getElementsByTagName(name: "template"): NodeListOf<HTMLTemplateElement>;
- getElementsByTagName(name: "text"): NodeListOf<SVGTextElement>;
- getElementsByTagName(name: "textpath"): NodeListOf<SVGTextPathElement>;
- getElementsByTagName(name: "textarea"): NodeListOf<HTMLTextAreaElement>;
- getElementsByTagName(name: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- getElementsByTagName(name: "thead"): NodeListOf<HTMLTableSectionElement>;
- getElementsByTagName(name: "title"): NodeListOf<HTMLTitleElement>;
- getElementsByTagName(name: "tr"): NodeListOf<HTMLTableRowElement>;
- getElementsByTagName(name: "track"): NodeListOf<HTMLTrackElement>;
- getElementsByTagName(name: "tspan"): NodeListOf<SVGTSpanElement>;
- getElementsByTagName(name: "tt"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "u"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "ul"): NodeListOf<HTMLUListElement>;
- getElementsByTagName(name: "use"): NodeListOf<SVGUseElement>;
- getElementsByTagName(name: "var"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "video"): NodeListOf<HTMLVideoElement>;
- getElementsByTagName(name: "view"): NodeListOf<SVGViewElement>;
- getElementsByTagName(name: "wbr"): NodeListOf<HTMLElement>;
- getElementsByTagName(name: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- getElementsByTagName(name: "xmp"): NodeListOf<HTMLPreElement>;
+ getElementsByTagName<K extends keyof ElementListTagNameMap>(name: K): ElementListTagNameMap[K];
getElementsByTagName(name: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
@@ -9565,42 +9216,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
insertAdjacentElement(position: string, insertedElement: Element): Element | null;
insertAdjacentHTML(where: string, html: string): void;
insertAdjacentText(where: string, text: string): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;
+ addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9636,10 +9253,12 @@ interface Event {
readonly target: EventTarget;
readonly timeStamp: number;
readonly type: string;
+ readonly scoped: boolean;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
+ deepPath(): EventTarget[];
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
@@ -9700,6 +9319,7 @@ interface FileReader extends EventTarget, MSBaseReader {
readAsBinaryString(blob: Blob): void;
readAsDataURL(blob: Blob): void;
readAsText(blob: Blob, encoding?: string): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -9870,6 +9490,8 @@ interface HTMLAnchorElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAnchorElement: {
@@ -9942,6 +9564,8 @@ interface HTMLAppletElement extends HTMLElement {
useMap: string;
vspace: number;
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAppletElement: {
@@ -10008,6 +9632,8 @@ interface HTMLAreaElement extends HTMLElement {
* Returns a string representation of an object.
*/
toString(): string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAreaElement: {
@@ -10032,6 +9658,8 @@ declare var HTMLAreasCollection: {
}
interface HTMLAudioElement extends HTMLMediaElement {
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLAudioElement: {
@@ -10044,6 +9672,8 @@ interface HTMLBRElement extends HTMLElement {
* Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.
*/
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBRElement: {
@@ -10060,6 +9690,8 @@ interface HTMLBaseElement extends HTMLElement {
* Sets or retrieves the window or frame at which to target content.
*/
target: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLBaseElement: {
@@ -10076,6 +9708,7 @@ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty
* Sets or retrieves the font size of the object.
*/
size: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10084,6 +9717,27 @@ declare var HTMLBaseFontElement: {
new(): HTMLBaseFontElement;
}
+interface HTMLBodyElementEventMap extends HTMLElementEventMap {
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "popstate": PopStateEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLBodyElement extends HTMLElement {
aLink: any;
background: string;
@@ -10091,147 +9745,27 @@ interface HTMLBodyElement extends HTMLElement {
bgProperties: string;
link: any;
noWrap: boolean;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onafterprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;
+ onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLBodyElement, ev: Event) => any;
+ onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLBodyElement, ev: Event) => any;
+ ononline: (this: HTMLBodyElement, ev: Event) => any;
+ onorientationchange: (this: HTMLBodyElement, ev: Event) => any;
+ onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;
+ onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;
+ onresize: (this: HTMLBodyElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLBodyElement, ev: Event) => any;
text: any;
vLink: any;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLBodyElementEventMap>(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10304,6 +9838,8 @@ interface HTMLButtonElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLButtonElement: {
@@ -10337,6 +9873,8 @@ interface HTMLCanvasElement extends HTMLElement {
*/
toDataURL(type?: string, ...args: any[]): string;
toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLCanvasElement: {
@@ -10367,6 +9905,8 @@ declare var HTMLCollection: {
interface HTMLDListElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDListElement: {
@@ -10376,6 +9916,8 @@ declare var HTMLDListElement: {
interface HTMLDataListElement extends HTMLElement {
options: HTMLCollectionOf<HTMLOptionElement>;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDataListElement: {
@@ -10385,6 +9927,8 @@ declare var HTMLDataListElement: {
interface HTMLDirectoryElement extends HTMLElement {
compact: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDirectoryElement: {
@@ -10401,6 +9945,8 @@ interface HTMLDivElement extends HTMLElement {
* Sets or retrieves whether the browser automatically performs wordwrap.
*/
noWrap: boolean;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDivElement: {
@@ -10409,6 +9955,8 @@ declare var HTMLDivElement: {
}
interface HTMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLDocument: {
@@ -10416,6 +9964,76 @@ declare var HTMLDocument: {
new(): HTMLDocument;
}
+interface HTMLElementEventMap extends ElementEventMap {
+ "abort": UIEvent;
+ "activate": UIEvent;
+ "beforeactivate": UIEvent;
+ "beforecopy": ClipboardEvent;
+ "beforecut": ClipboardEvent;
+ "beforedeactivate": UIEvent;
+ "beforepaste": ClipboardEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "contextmenu": PointerEvent;
+ "copy": ClipboardEvent;
+ "cuechange": Event;
+ "cut": ClipboardEvent;
+ "dblclick": MouseEvent;
+ "deactivate": UIEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSContentZoom": UIEvent;
+ "MSManipulationStateChanged": MSManipulationEvent;
+ "paste": ClipboardEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "reset": Event;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "selectstart": Event;
+ "stalled": Event;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface HTMLElement extends Element {
accessKey: string;
readonly children: HTMLCollection;
@@ -10434,73 +10052,73 @@ interface HTMLElement extends Element {
readonly offsetParent: Element;
readonly offsetTop: number;
readonly offsetWidth: number;
- onabort: (this: this, ev: UIEvent) => any;
- onactivate: (this: this, ev: UIEvent) => any;
- onbeforeactivate: (this: this, ev: UIEvent) => any;
- onbeforecopy: (this: this, ev: ClipboardEvent) => any;
- onbeforecut: (this: this, ev: ClipboardEvent) => any;
- onbeforedeactivate: (this: this, ev: UIEvent) => any;
- onbeforepaste: (this: this, ev: ClipboardEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- oncopy: (this: this, ev: ClipboardEvent) => any;
- oncuechange: (this: this, ev: Event) => any;
- oncut: (this: this, ev: ClipboardEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondeactivate: (this: this, ev: UIEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onfocus: (this: this, ev: FocusEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmscontentzoom: (this: this, ev: UIEvent) => any;
- onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;
- onpaste: (this: this, ev: ClipboardEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreset: (this: this, ev: Event) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onselectstart: (this: this, ev: Event) => any;
- onstalled: (this: this, ev: Event) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onabort: (this: HTMLElement, ev: UIEvent) => any;
+ onactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onblur: (this: HTMLElement, ev: FocusEvent) => any;
+ oncanplay: (this: HTMLElement, ev: Event) => any;
+ oncanplaythrough: (this: HTMLElement, ev: Event) => any;
+ onchange: (this: HTMLElement, ev: Event) => any;
+ onclick: (this: HTMLElement, ev: MouseEvent) => any;
+ oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;
+ oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;
+ oncuechange: (this: HTMLElement, ev: Event) => any;
+ oncut: (this: HTMLElement, ev: ClipboardEvent) => any;
+ ondblclick: (this: HTMLElement, ev: MouseEvent) => any;
+ ondeactivate: (this: HTMLElement, ev: UIEvent) => any;
+ ondrag: (this: HTMLElement, ev: DragEvent) => any;
+ ondragend: (this: HTMLElement, ev: DragEvent) => any;
+ ondragenter: (this: HTMLElement, ev: DragEvent) => any;
+ ondragleave: (this: HTMLElement, ev: DragEvent) => any;
+ ondragover: (this: HTMLElement, ev: DragEvent) => any;
+ ondragstart: (this: HTMLElement, ev: DragEvent) => any;
+ ondrop: (this: HTMLElement, ev: DragEvent) => any;
+ ondurationchange: (this: HTMLElement, ev: Event) => any;
+ onemptied: (this: HTMLElement, ev: Event) => any;
+ onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;
+ onerror: (this: HTMLElement, ev: ErrorEvent) => any;
+ onfocus: (this: HTMLElement, ev: FocusEvent) => any;
+ oninput: (this: HTMLElement, ev: Event) => any;
+ oninvalid: (this: HTMLElement, ev: Event) => any;
+ onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;
+ onload: (this: HTMLElement, ev: Event) => any;
+ onloadeddata: (this: HTMLElement, ev: Event) => any;
+ onloadedmetadata: (this: HTMLElement, ev: Event) => any;
+ onloadstart: (this: HTMLElement, ev: Event) => any;
+ onmousedown: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousemove: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseout: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseover: (this: HTMLElement, ev: MouseEvent) => any;
+ onmouseup: (this: HTMLElement, ev: MouseEvent) => any;
+ onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;
+ onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;
+ onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;
+ onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;
+ onpause: (this: HTMLElement, ev: Event) => any;
+ onplay: (this: HTMLElement, ev: Event) => any;
+ onplaying: (this: HTMLElement, ev: Event) => any;
+ onprogress: (this: HTMLElement, ev: ProgressEvent) => any;
+ onratechange: (this: HTMLElement, ev: Event) => any;
+ onreset: (this: HTMLElement, ev: Event) => any;
+ onscroll: (this: HTMLElement, ev: UIEvent) => any;
+ onseeked: (this: HTMLElement, ev: Event) => any;
+ onseeking: (this: HTMLElement, ev: Event) => any;
+ onselect: (this: HTMLElement, ev: UIEvent) => any;
+ onselectstart: (this: HTMLElement, ev: Event) => any;
+ onstalled: (this: HTMLElement, ev: Event) => any;
+ onsubmit: (this: HTMLElement, ev: Event) => any;
+ onsuspend: (this: HTMLElement, ev: Event) => any;
+ ontimeupdate: (this: HTMLElement, ev: Event) => any;
+ onvolumechange: (this: HTMLElement, ev: Event) => any;
+ onwaiting: (this: HTMLElement, ev: Event) => any;
outerHTML: string;
outerText: string;
spellcheck: boolean;
@@ -10513,109 +10131,7 @@ interface HTMLElement extends Element {
focus(): void;
msGetInputContext(): MSInputMethodContext;
setActive(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10671,6 +10187,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10710,6 +10227,8 @@ interface HTMLFieldSetElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLFieldSetElement: {
@@ -10722,6 +10241,7 @@ interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOM
* Sets or retrieves the current typeface family.
*/
face: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10797,6 +10317,8 @@ interface HTMLFormElement extends HTMLElement {
* Fires when a FORM is about to be submitted.
*/
submit(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -10805,6 +10327,10 @@ declare var HTMLFormElement: {
new(): HTMLFormElement;
}
+interface HTMLFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Specifies the properties of a border drawn around an object.
@@ -10857,7 +10383,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLFrameElement, ev: Event) => any;
/**
* Sets or retrieves whether the frame can be scrolled.
*/
@@ -10870,110 +10396,7 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string | number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameElementEventMap>(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -10982,6 +10405,25 @@ declare var HTMLFrameElement: {
new(): HTMLFrameElement;
}
+interface HTMLFrameSetElementEventMap extends HTMLElementEventMap {
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "error": ErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "load": Event;
+ "message": MessageEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "resize": UIEvent;
+ "storage": StorageEvent;
+ "unload": Event;
+}
+
interface HTMLFrameSetElement extends HTMLElement {
border: string;
/**
@@ -11001,152 +10443,34 @@ interface HTMLFrameSetElement extends HTMLElement {
*/
frameSpacing: any;
name: string;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
+ onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;
+ onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;
/**
* Fires when the object loses the input focus.
*/
- onblur: (this: this, ev: FocusEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;
/**
* Fires when the object receives focus.
*/
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onunload: (this: this, ev: Event) => any;
+ onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;
+ onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;
+ onload: (this: HTMLFrameSetElement, ev: Event) => any;
+ onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;
+ onoffline: (this: HTMLFrameSetElement, ev: Event) => any;
+ ononline: (this: HTMLFrameSetElement, ev: Event) => any;
+ onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;
+ onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;
+ onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;
+ onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;
+ onunload: (this: HTMLFrameSetElement, ev: Event) => any;
/**
* Sets or retrieves the frame heights of the object.
*/
rows: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLFrameSetElementEventMap>(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11168,6 +10492,7 @@ interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2
* Sets or retrieves the width of the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11178,6 +10503,8 @@ declare var HTMLHRElement: {
interface HTMLHeadElement extends HTMLElement {
profile: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadElement: {
@@ -11190,6 +10517,8 @@ interface HTMLHeadingElement extends HTMLElement {
* Sets or retrieves a value that indicates the table alignment.
*/
align: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHeadingElement: {
@@ -11202,6 +10531,8 @@ interface HTMLHtmlElement extends HTMLElement {
* Sets or retrieves the DTD version that governs the current document.
*/
version: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLHtmlElement: {
@@ -11209,6 +10540,10 @@ declare var HTMLHtmlElement: {
new(): HTMLHtmlElement;
}
+interface HTMLIFrameElementEventMap extends HTMLElementEventMap {
+ "load": Event;
+}
+
interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -11266,7 +10601,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
/**
* Raised when the object has been completely received from the server.
*/
- onload: (this: this, ev: Event) => any;
+ onload: (this: HTMLIFrameElement, ev: Event) => any;
readonly sandbox: DOMSettableTokenList;
/**
* Sets or retrieves whether the frame can be scrolled.
@@ -11284,110 +10619,7 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument {
* Sets or retrieves the width of the object.
*/
width: string;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLIFrameElementEventMap>(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11478,6 +10710,8 @@ interface HTMLImageElement extends HTMLElement {
readonly x: number;
readonly y: number;
msGetAsCastingSource(): any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLImageElement: {
@@ -11689,6 +10923,8 @@ interface HTMLInputElement extends HTMLElement {
* @param n Value to increment the value by.
*/
stepUp(n?: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLInputElement: {
@@ -11702,6 +10938,8 @@ interface HTMLLIElement extends HTMLElement {
* Sets or retrieves the value of a list item.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLIElement: {
@@ -11718,6 +10956,8 @@ interface HTMLLabelElement extends HTMLElement {
* Sets or retrieves the object to which the given label object is assigned.
*/
htmlFor: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLabelElement: {
@@ -11734,6 +10974,8 @@ interface HTMLLegendElement extends HTMLElement {
* Retrieves a reference to the form that the object is embedded in.
*/
readonly form: HTMLFormElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLLegendElement: {
@@ -11777,6 +11019,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle {
type: string;
import?: Document;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11794,6 +11037,8 @@ interface HTMLMapElement extends HTMLElement {
* Sets or retrieves the name of the object.
*/
name: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMapElement: {
@@ -11801,6 +11046,12 @@ declare var HTMLMapElement: {
new(): HTMLMapElement;
}
+interface HTMLMarqueeElementEventMap extends HTMLElementEventMap {
+ "bounce": Event;
+ "finish": Event;
+ "start": Event;
+}
+
interface HTMLMarqueeElement extends HTMLElement {
behavior: string;
bgColor: any;
@@ -11808,9 +11059,9 @@ interface HTMLMarqueeElement extends HTMLElement {
height: string;
hspace: number;
loop: number;
- onbounce: (this: this, ev: Event) => any;
- onfinish: (this: this, ev: Event) => any;
- onstart: (this: this, ev: Event) => any;
+ onbounce: (this: HTMLMarqueeElement, ev: Event) => any;
+ onfinish: (this: HTMLMarqueeElement, ev: Event) => any;
+ onstart: (this: HTMLMarqueeElement, ev: Event) => any;
scrollAmount: number;
scrollDelay: number;
trueSpeed: boolean;
@@ -11818,112 +11069,7 @@ interface HTMLMarqueeElement extends HTMLElement {
width: string;
start(): void;
stop(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMarqueeElementEventMap>(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -11932,6 +11078,11 @@ declare var HTMLMarqueeElement: {
new(): HTMLMarqueeElement;
}
+interface HTMLMediaElementEventMap extends HTMLElementEventMap {
+ "encrypted": MediaEncryptedEvent;
+ "msneedkey": MSMediaKeyNeededEvent;
+}
+
interface HTMLMediaElement extends HTMLElement {
/**
* Returns an AudioTrackList object with the audio tracks for a given video element.
@@ -12021,8 +11172,8 @@ interface HTMLMediaElement extends HTMLElement {
* Gets the current network activity for the element.
*/
readonly networkState: number;
- onencrypted: (this: this, ev: MediaEncryptedEvent) => any;
- onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any;
+ onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;
+ onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;
/**
* Gets a flag that specifies whether playback is paused.
*/
@@ -12100,111 +11251,7 @@ interface HTMLMediaElement extends HTMLElement {
readonly NETWORK_IDLE: number;
readonly NETWORK_LOADING: number;
readonly NETWORK_NO_SOURCE: number;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12225,6 +11272,8 @@ declare var HTMLMediaElement: {
interface HTMLMenuElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMenuElement: {
@@ -12257,6 +11306,8 @@ interface HTMLMetaElement extends HTMLElement {
* Sets or retrieves the URL property that will be loaded after the specified time has elapsed.
*/
url: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMetaElement: {
@@ -12271,6 +11322,8 @@ interface HTMLMeterElement extends HTMLElement {
min: number;
optimum: number;
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLMeterElement: {
@@ -12287,6 +11340,8 @@ interface HTMLModElement extends HTMLElement {
* Sets or retrieves the date and time of a modification to the object.
*/
dateTime: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLModElement: {
@@ -12301,6 +11356,8 @@ interface HTMLOListElement extends HTMLElement {
*/
start: number;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOListElement: {
@@ -12420,6 +11477,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12458,6 +11516,8 @@ interface HTMLOptGroupElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptGroupElement: {
@@ -12495,6 +11555,8 @@ interface HTMLOptionElement extends HTMLElement {
* Sets or retrieves the value which is returned to the server when the form control is submitted.
*/
value: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLOptionElement: {
@@ -12521,6 +11583,8 @@ interface HTMLParagraphElement extends HTMLElement {
*/
align: string;
clear: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParagraphElement: {
@@ -12545,6 +11609,8 @@ interface HTMLParamElement extends HTMLElement {
* Sets or retrieves the data type of the value attribute.
*/
valueType: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLParamElement: {
@@ -12553,6 +11619,8 @@ declare var HTMLParamElement: {
}
interface HTMLPictureElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPictureElement: {
@@ -12565,6 +11633,8 @@ interface HTMLPreElement extends HTMLElement {
* Sets or gets a value that you can use to implement your own width functionality for the object.
*/
width: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLPreElement: {
@@ -12589,6 +11659,8 @@ interface HTMLProgressElement extends HTMLElement {
* Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.
*/
value: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLProgressElement: {
@@ -12601,6 +11673,8 @@ interface HTMLQuoteElement extends HTMLElement {
* Sets or retrieves reference information about the object.
*/
cite: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLQuoteElement: {
@@ -12639,6 +11713,8 @@ interface HTMLScriptElement extends HTMLElement {
*/
type: string;
integrity: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLScriptElement: {
@@ -12733,6 +11809,8 @@ interface HTMLSelectElement extends HTMLElement {
* @param error Sets a custom error message that is displayed when a form is submitted.
*/
setCustomValidity(error: string): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[name: string]: any;
}
@@ -12757,6 +11835,8 @@ interface HTMLSourceElement extends HTMLElement {
* Gets or sets the MIME type of a media resource.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSourceElement: {
@@ -12765,6 +11845,8 @@ declare var HTMLSourceElement: {
}
interface HTMLSpanElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLSpanElement: {
@@ -12782,6 +11864,7 @@ interface HTMLStyleElement extends HTMLElement, LinkStyle {
* Retrieves the CSS language in which the style sheet is written.
*/
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12799,6 +11882,8 @@ interface HTMLTableCaptionElement extends HTMLElement {
* Sets or retrieves whether the caption appears at the top or bottom of the table.
*/
vAlign: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableCaptionElement: {
@@ -12852,6 +11937,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12873,6 +11959,7 @@ interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {
* Sets or retrieves the width of the object.
*/
width: any;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -12993,6 +12080,8 @@ interface HTMLTableElement extends HTMLElement {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTableElement: {
@@ -13044,6 +12133,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.
*/
insertCell(index?: number): HTMLTableDataCellElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13071,6 +12161,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
*/
insertRow(index?: number): HTMLTableRowElement;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13081,6 +12172,8 @@ declare var HTMLTableSectionElement: {
interface HTMLTemplateElement extends HTMLElement {
readonly content: DocumentFragment;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTemplateElement: {
@@ -13186,6 +12279,8 @@ interface HTMLTextAreaElement extends HTMLElement {
* @param end The offset into the text field for the end of the selection.
*/
setSelectionRange(start: number, end: number): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTextAreaElement: {
@@ -13198,6 +12293,8 @@ interface HTMLTitleElement extends HTMLElement {
* Retrieves or sets the text of the object as a string.
*/
text: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTitleElement: {
@@ -13217,6 +12314,8 @@ interface HTMLTrackElement extends HTMLElement {
readonly LOADED: number;
readonly LOADING: number;
readonly NONE: number;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLTrackElement: {
@@ -13231,6 +12330,8 @@ declare var HTMLTrackElement: {
interface HTMLUListElement extends HTMLElement {
compact: boolean;
type: string;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUListElement: {
@@ -13239,6 +12340,8 @@ declare var HTMLUListElement: {
}
interface HTMLUnknownElement extends HTMLElement {
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var HTMLUnknownElement: {
@@ -13246,6 +12349,12 @@ declare var HTMLUnknownElement: {
new(): HTMLUnknownElement;
}
+interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {
+ "MSVideoFormatChanged": Event;
+ "MSVideoFrameStepCompleted": Event;
+ "MSVideoOptimalLayoutChanged": Event;
+}
+
interface HTMLVideoElement extends HTMLMediaElement {
/**
* Gets or sets the height of the video element.
@@ -13257,9 +12366,9 @@ interface HTMLVideoElement extends HTMLMediaElement {
msStereo3DPackingMode: string;
msStereo3DRenderMode: string;
msZoom: boolean;
- onMSVideoFormatChanged: (this: this, ev: Event) => any;
- onMSVideoFrameStepCompleted: (this: this, ev: Event) => any;
- onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any;
+ onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;
+ onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;
/**
* Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available.
*/
@@ -13286,114 +12395,7 @@ interface HTMLVideoElement extends HTMLMediaElement {
webkitEnterFullscreen(): void;
webkitExitFullScreen(): void;
webkitExitFullscreen(): void;
- addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13461,11 +12463,16 @@ declare var IDBCursorWithValue: {
new(): IDBCursorWithValue;
}
+interface IDBDatabaseEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+}
+
interface IDBDatabase extends EventTarget {
readonly name: string;
readonly objectStoreNames: DOMStringList;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBDatabase, ev: Event) => any;
+ onerror: (this: IDBDatabase, ev: ErrorEvent) => any;
version: number;
onversionchange: (ev: IDBVersionChangeEvent) => any;
close(): void;
@@ -13473,8 +12480,7 @@ interface IDBDatabase extends EventTarget {
deleteObjectStore(name: string): void;
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13551,13 +12557,15 @@ declare var IDBObjectStore: {
new(): IDBObjectStore;
}
+interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
+ "blocked": Event;
+ "upgradeneeded": IDBVersionChangeEvent;
+}
+
interface IDBOpenDBRequest extends IDBRequest {
- onblocked: (this: this, ev: Event) => any;
- onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;
- addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
+ onblocked: (this: IDBOpenDBRequest, ev: Event) => any;
+ onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;
+ addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13566,16 +12574,20 @@ declare var IDBOpenDBRequest: {
new(): IDBOpenDBRequest;
}
+interface IDBRequestEventMap {
+ "error": ErrorEvent;
+ "success": Event;
+}
+
interface IDBRequest extends EventTarget {
readonly error: DOMError;
- onerror: (this: this, ev: ErrorEvent) => any;
- onsuccess: (this: this, ev: Event) => any;
+ onerror: (this: IDBRequest, ev: ErrorEvent) => any;
+ onsuccess: (this: IDBRequest, ev: Event) => any;
readonly readyState: string;
readonly result: any;
source: IDBObjectStore | IDBIndex | IDBCursor;
readonly transaction: IDBTransaction;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13584,21 +12596,25 @@ declare var IDBRequest: {
new(): IDBRequest;
}
+interface IDBTransactionEventMap {
+ "abort": Event;
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface IDBTransaction extends EventTarget {
readonly db: IDBDatabase;
readonly error: DOMError;
readonly mode: string;
- onabort: (this: this, ev: Event) => any;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBTransaction, ev: Event) => any;
+ oncomplete: (this: IDBTransaction, ev: Event) => any;
+ onerror: (this: IDBTransaction, ev: ErrorEvent) => any;
abort(): void;
objectStore(name: string): IDBObjectStore;
readonly READ_ONLY: string;
readonly READ_WRITE: string;
readonly VERSION_CHANGE: string;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13731,18 +12747,22 @@ interface MSApp {
}
declare var MSApp: MSApp;
+interface MSAppAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSAppAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;
+ onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
start(): void;
readonly COMPLETED: number;
readonly ERROR: number;
readonly STARTED: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -13897,6 +12917,8 @@ interface MSHTMLWebViewElement extends HTMLElement {
navigateWithHttpRequestMessage(requestMessage: any): void;
refresh(): void;
stop(): void;
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSHTMLWebViewElement: {
@@ -13904,20 +12926,24 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
+interface MSInputMethodContextEventMap {
+ "MSCandidateWindowHide": Event;
+ "MSCandidateWindowShow": Event;
+ "MSCandidateWindowUpdate": Event;
+}
+
interface MSInputMethodContext extends EventTarget {
readonly compositionEndOffset: number;
readonly compositionStartOffset: number;
- oncandidatewindowhide: (this: this, ev: Event) => any;
- oncandidatewindowshow: (this: this, ev: Event) => any;
- oncandidatewindowupdate: (this: this, ev: Event) => any;
+ oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;
+ oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;
readonly target: HTMLElement;
getCandidateWindowClientRect(): ClientRect;
getCompositionAlternatives(): string[];
hasComposition(): boolean;
isCandidateWindowVisible(): boolean;
- addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSInputMethodContextEventMap>(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14083,6 +13109,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader {
readAsBlob(stream: MSStream, size?: number): void;
readAsDataURL(stream: MSStream, size?: number): void;
readAsText(stream: MSStream, encoding?: string, size?: number): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14091,10 +13118,15 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
+interface MSWebViewAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSWebViewAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;
+ onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
readonly target: MSHTMLWebViewElement;
@@ -14106,8 +13138,7 @@ interface MSWebViewAsyncOperation extends EventTarget {
readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;
readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;
readonly TYPE_INVOKE_SCRIPT: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSWebViewAsyncOperationEventMap>(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14144,12 +13175,16 @@ declare var MediaDeviceInfo: {
new(): MediaDeviceInfo;
}
+interface MediaDevicesEventMap {
+ "devicechange": Event;
+}
+
interface MediaDevices extends EventTarget {
- ondevicechange: (this: this, ev: Event) => any;
+ ondevicechange: (this: MediaDevices, ev: Event) => any;
enumerateDevices(): any;
getSupportedConstraints(): MediaTrackSupportedConstraints;
getUserMedia(constraints: MediaStreamConstraints): PromiseLike<MediaStream>;
- addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14299,13 +13334,20 @@ declare var MediaSource: {
isTypeSupported(type: string): boolean;
}
+interface MediaStreamEventMap {
+ "active": Event;
+ "addtrack": TrackEvent;
+ "inactive": Event;
+ "removetrack": TrackEvent;
+}
+
interface MediaStream extends EventTarget {
readonly active: boolean;
readonly id: string;
- onactive: (this: this, ev: Event) => any;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- oninactive: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onactive: (this: MediaStream, ev: Event) => any;
+ onaddtrack: (this: MediaStream, ev: TrackEvent) => any;
+ oninactive: (this: MediaStream, ev: Event) => any;
+ onremovetrack: (this: MediaStream, ev: TrackEvent) => any;
addTrack(track: MediaStreamTrack): void;
clone(): MediaStream;
getAudioTracks(): MediaStreamTrack[];
@@ -14314,10 +13356,7 @@ interface MediaStream extends EventTarget {
getVideoTracks(): MediaStreamTrack[];
removeTrack(track: MediaStreamTrack): void;
stop(): void;
- addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14354,16 +13393,23 @@ declare var MediaStreamErrorEvent: {
new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;
}
+interface MediaStreamTrackEventMap {
+ "ended": MediaStreamErrorEvent;
+ "mute": Event;
+ "overconstrained": MediaStreamErrorEvent;
+ "unmute": Event;
+}
+
interface MediaStreamTrack extends EventTarget {
enabled: boolean;
readonly id: string;
readonly kind: string;
readonly label: string;
readonly muted: boolean;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
- onmute: (this: this, ev: Event) => any;
- onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any;
- onunmute: (this: this, ev: Event) => any;
+ onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onmute: (this: MediaStreamTrack, ev: Event) => any;
+ onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;
+ onunmute: (this: MediaStreamTrack, ev: Event) => any;
readonly readonly: boolean;
readonly readyState: string;
readonly remote: boolean;
@@ -14373,10 +13419,7 @@ interface MediaStreamTrack extends EventTarget {
getConstraints(): MediaTrackConstraints;
getSettings(): MediaTrackSettings;
stop(): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14417,12 +13460,16 @@ declare var MessageEvent: {
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
}
+interface MessagePortEventMap {
+ "message": MessageEvent;
+}
+
interface MessagePort extends EventTarget {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: MessagePort, ev: MessageEvent) => any;
close(): void;
postMessage(message?: any, ports?: any): void;
start(): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14600,7 +13647,6 @@ interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorConte
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike<MediaKeySystemAccess>;
vibrate(pattern: number | number[]): boolean;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var Navigator: {
@@ -14775,10 +13821,14 @@ declare var OfflineAudioCompletionEvent: {
new(): OfflineAudioCompletionEvent;
}
+interface OfflineAudioContextEventMap {
+ "complete": Event;
+}
+
interface OfflineAudioContext extends AudioContext {
- oncomplete: (this: this, ev: Event) => any;
+ oncomplete: (this: OfflineAudioContext, ev: Event) => any;
startRendering(): PromiseLike<AudioBuffer>;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -14787,15 +13837,19 @@ declare var OfflineAudioContext: {
new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
+interface OscillatorNodeEventMap {
+ "ended": MediaStreamErrorEvent;
+}
+
interface OscillatorNode extends AudioNode {
readonly detune: AudioParam;
readonly frequency: AudioParam;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;
type: string;
setPeriodicWave(periodicWave: PeriodicWave): void;
start(when?: number): void;
stop(when?: number): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof OscillatorNodeEventMap>(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15174,9 +14228,14 @@ declare var RTCDTMFToneChangeEvent: {
new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;
}
+interface RTCDtlsTransportEventMap {
+ "dtlsstatechange": RTCDtlsTransportStateChangedEvent;
+ "error": ErrorEvent;
+}
+
interface RTCDtlsTransport extends RTCStatsProvider {
- ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;
+ onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;
readonly state: string;
readonly transport: RTCIceTransport;
getLocalParameters(): RTCDtlsParameters;
@@ -15184,8 +14243,7 @@ interface RTCDtlsTransport extends RTCStatsProvider {
getRemoteParameters(): RTCDtlsParameters | null;
start(remoteParameters: RTCDtlsParameters): void;
stop(): void;
- addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtlsTransportEventMap>(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15203,15 +14261,19 @@ declare var RTCDtlsTransportStateChangedEvent: {
new(): RTCDtlsTransportStateChangedEvent;
}
+interface RTCDtmfSenderEventMap {
+ "tonechange": RTCDTMFToneChangeEvent;
+}
+
interface RTCDtmfSender extends EventTarget {
readonly canInsertDTMF: boolean;
readonly duration: number;
readonly interToneGap: number;
- ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any;
+ ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;
readonly sender: RTCRtpSender;
readonly toneBuffer: string;
insertDTMF(tones: string, duration?: number, interToneGap?: number): void;
- addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCDtmfSenderEventMap>(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15229,15 +14291,19 @@ declare var RTCIceCandidatePairChangedEvent: {
new(): RTCIceCandidatePairChangedEvent;
}
+interface RTCIceGathererEventMap {
+ "error": ErrorEvent;
+ "localcandidate": RTCIceGathererEvent;
+}
+
interface RTCIceGatherer extends RTCStatsProvider {
readonly component: string;
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null;
+ onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;
+ onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;
createAssociatedGatherer(): RTCIceGatherer;
getLocalCandidates(): RTCIceCandidate[];
getLocalParameters(): RTCIceParameters;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceGathererEventMap>(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15255,11 +14321,16 @@ declare var RTCIceGathererEvent: {
new(): RTCIceGathererEvent;
}
+interface RTCIceTransportEventMap {
+ "candidatepairchange": RTCIceCandidatePairChangedEvent;
+ "icestatechange": RTCIceTransportStateChangedEvent;
+}
+
interface RTCIceTransport extends RTCStatsProvider {
readonly component: string;
readonly iceGatherer: RTCIceGatherer | null;
- oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null;
- onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null;
+ oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;
+ onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;
readonly role: string;
readonly state: string;
addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;
@@ -15270,8 +14341,7 @@ interface RTCIceTransport extends RTCStatsProvider {
setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;
start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;
stop(): void;
- addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCIceTransportEventMap>(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15289,8 +14359,12 @@ declare var RTCIceTransportStateChangedEvent: {
new(): RTCIceTransportStateChangedEvent;
}
+interface RTCRtpReceiverEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCRtpReceiver extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack | null;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -15299,7 +14373,7 @@ interface RTCRtpReceiver extends RTCStatsProvider {
requestSendCSRC(csrc: number): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpReceiverEventMap>(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15309,9 +14383,14 @@ declare var RTCRtpReceiver: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCRtpSenderEventMap {
+ "error": ErrorEvent;
+ "ssrcconflict": RTCSsrcConflictEvent;
+}
+
interface RTCRtpSender extends RTCStatsProvider {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
- onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null;
+ onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;
+ onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;
readonly rtcpTransport: RTCDtlsTransport;
readonly track: MediaStreamTrack;
readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;
@@ -15319,8 +14398,7 @@ interface RTCRtpSender extends RTCStatsProvider {
setTrack(track: MediaStreamTrack): void;
setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;
stop(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCRtpSenderEventMap>(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15330,10 +14408,14 @@ declare var RTCRtpSender: {
getCapabilities(kind?: string): RTCRtpCapabilities;
}
+interface RTCSrtpSdesTransportEventMap {
+ "error": ErrorEvent;
+}
+
interface RTCSrtpSdesTransport extends EventTarget {
- onerror: ((this: this, ev: ErrorEvent) => any) | null;
+ onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;
readonly transport: RTCIceTransport;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof RTCSrtpSdesTransportEventMap>(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15408,6 +14490,7 @@ declare var Range: {
interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {
readonly target: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15564,6 +14647,7 @@ interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SV
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
readonly r: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15574,6 +14658,7 @@ declare var SVGCircleElement: {
interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {
readonly clipPathUnits: SVGAnimatedEnumeration;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15596,6 +14681,8 @@ interface SVGComponentTransferFunctionElement extends SVGElement {
readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;
readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGComponentTransferFunctionElement: {
@@ -15610,6 +14697,7 @@ declare var SVGComponentTransferFunctionElement: {
}
interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15619,6 +14707,7 @@ declare var SVGDefsElement: {
}
interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15627,67 +14716,35 @@ declare var SVGDescElement: {
new(): SVGDescElement;
}
+interface SVGElementEventMap extends ElementEventMap {
+ "click": MouseEvent;
+ "dblclick": MouseEvent;
+ "focusin": FocusEvent;
+ "focusout": FocusEvent;
+ "load": Event;
+ "mousedown": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+}
+
interface SVGElement extends Element {
- onclick: (this: this, ev: MouseEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- onfocusin: (this: this, ev: FocusEvent) => any;
- onfocusout: (this: this, ev: FocusEvent) => any;
- onload: (this: this, ev: Event) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
+ onclick: (this: SVGElement, ev: MouseEvent) => any;
+ ondblclick: (this: SVGElement, ev: MouseEvent) => any;
+ onfocusin: (this: SVGElement, ev: FocusEvent) => any;
+ onfocusout: (this: SVGElement, ev: FocusEvent) => any;
+ onload: (this: SVGElement, ev: Event) => any;
+ onmousedown: (this: SVGElement, ev: MouseEvent) => any;
+ onmousemove: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseout: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseover: (this: SVGElement, ev: MouseEvent) => any;
+ onmouseup: (this: SVGElement, ev: MouseEvent) => any;
readonly ownerSVGElement: SVGSVGElement;
readonly viewportElement: SVGElement;
xmlbase: string;
className: any;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15727,6 +14784,7 @@ interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, S
readonly cy: SVGAnimatedLength;
readonly rx: SVGAnimatedLength;
readonly ry: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15756,6 +14814,7 @@ interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttrib
readonly SVG_FEBLEND_MODE_SCREEN: number;
readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;
readonly SVG_FEBLEND_MODE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15790,6 +14849,7 @@ interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandard
readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;
readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;
readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15805,6 +14865,7 @@ declare var SVGFEColorMatrixElement: {
interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15828,6 +14889,7 @@ interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAt
readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;
readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;
readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15860,6 +14922,7 @@ interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStand
readonly SVG_EDGEMODE_NONE: number;
readonly SVG_EDGEMODE_UNKNOWN: number;
readonly SVG_EDGEMODE_WRAP: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15878,6 +14941,7 @@ interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStan
readonly kernelUnitLengthX: SVGAnimatedNumber;
readonly kernelUnitLengthY: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15897,6 +14961,7 @@ interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStan
readonly SVG_CHANNEL_G: number;
readonly SVG_CHANNEL_R: number;
readonly SVG_CHANNEL_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15913,6 +14978,8 @@ declare var SVGFEDisplacementMapElement: {
interface SVGFEDistantLightElement extends SVGElement {
readonly azimuth: SVGAnimatedNumber;
readonly elevation: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEDistantLightElement: {
@@ -15921,6 +14988,7 @@ declare var SVGFEDistantLightElement: {
}
interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15966,6 +15034,7 @@ interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandar
readonly stdDeviationX: SVGAnimatedNumber;
readonly stdDeviationY: SVGAnimatedNumber;
setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15976,6 +15045,7 @@ declare var SVGFEGaussianBlurElement: {
interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {
readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15985,6 +15055,7 @@ declare var SVGFEImageElement: {
}
interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -15995,6 +15066,8 @@ declare var SVGFEMergeElement: {
interface SVGFEMergeNodeElement extends SVGElement {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEMergeNodeElement: {
@@ -16010,6 +15083,7 @@ interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;
readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;
readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16025,6 +15099,7 @@ interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttri
readonly dx: SVGAnimatedNumber;
readonly dy: SVGAnimatedNumber;
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16037,6 +15112,8 @@ interface SVGFEPointLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFEPointLightElement: {
@@ -16051,6 +15128,7 @@ interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveSta
readonly specularConstant: SVGAnimatedNumber;
readonly specularExponent: SVGAnimatedNumber;
readonly surfaceScale: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16068,6 +15146,8 @@ interface SVGFESpotLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
readonly z: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGFESpotLightElement: {
@@ -16077,6 +15157,7 @@ declare var SVGFESpotLightElement: {
interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16098,6 +15179,7 @@ interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardA
readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;
readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;
readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16122,6 +15204,7 @@ interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLan
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
setFilterRes(filterResX: number, filterResY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16135,6 +15218,7 @@ interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransforma
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16144,6 +15228,7 @@ declare var SVGForeignObjectElement: {
}
interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16160,6 +15245,7 @@ interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourc
readonly SVG_SPREADMETHOD_REFLECT: number;
readonly SVG_SPREADMETHOD_REPEAT: number;
readonly SVG_SPREADMETHOD_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16178,6 +15264,7 @@ interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVG
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16243,6 +15330,7 @@ interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly x2: SVGAnimatedLength;
readonly y1: SVGAnimatedLength;
readonly y2: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16279,6 +15367,7 @@ interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExt
readonly SVG_MARKER_ORIENT_ANGLE: number;
readonly SVG_MARKER_ORIENT_AUTO: number;
readonly SVG_MARKER_ORIENT_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16300,6 +15389,7 @@ interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16334,6 +15424,8 @@ declare var SVGMatrix: {
}
interface SVGMetadataElement extends SVGElement {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGMetadataElement: {
@@ -16389,6 +15481,7 @@ interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
getPathSegAtLength(distance: number): number;
getPointAtLength(distance: number): SVGPoint;
getTotalLength(): number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16681,6 +15774,7 @@ interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSp
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16717,6 +15811,7 @@ declare var SVGPointList: {
}
interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16726,6 +15821,7 @@ declare var SVGPolygonElement: {
}
interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16804,6 +15900,7 @@ interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGT
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16812,18 +15909,27 @@ declare var SVGRectElement: {
new(): SVGRectElement;
}
+interface SVGSVGElementEventMap extends SVGElementEventMap {
+ "SVGAbort": Event;
+ "SVGError": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "SVGUnload": Event;
+ "SVGZoom": SVGZoomEvent;
+}
+
interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
contentScriptType: string;
contentStyleType: string;
currentScale: number;
readonly currentTranslate: SVGPoint;
readonly height: SVGAnimatedLength;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onzoom: (this: this, ev: SVGZoomEvent) => any;
+ onabort: (this: SVGSVGElement, ev: Event) => any;
+ onerror: (this: SVGSVGElement, ev: Event) => any;
+ onresize: (this: SVGSVGElement, ev: UIEvent) => any;
+ onscroll: (this: SVGSVGElement, ev: UIEvent) => any;
+ onunload: (this: SVGSVGElement, ev: Event) => any;
+ onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;
readonly pixelUnitToMillimeterX: number;
readonly pixelUnitToMillimeterY: number;
readonly screenPixelToMillimeterX: number;
@@ -16855,58 +15961,7 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest
unpauseAnimations(): void;
unsuspendRedraw(suspendHandleID: number): void;
unsuspendRedrawAll(): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof SVGSVGElementEventMap>(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16917,6 +15972,7 @@ declare var SVGSVGElement: {
interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16927,6 +15983,7 @@ declare var SVGScriptElement: {
interface SVGStopElement extends SVGElement, SVGStylable {
readonly offset: SVGAnimatedNumber;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16956,6 +16013,7 @@ interface SVGStyleElement extends SVGElement, SVGLangSpace {
media: string;
title: string;
type: string;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16965,6 +16023,7 @@ declare var SVGStyleElement: {
}
interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -16974,6 +16033,7 @@ declare var SVGSwitchElement: {
}
interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17005,6 +16065,7 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa
readonly LENGTHADJUST_SPACING: number;
readonly LENGTHADJUST_SPACINGANDGLYPHS: number;
readonly LENGTHADJUST_UNKNOWN: number;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17017,7 +16078,6 @@ declare var SVGTextContentElement: {
}
interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextElement: {
@@ -17035,7 +16095,6 @@ interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {
readonly TEXTPATH_SPACINGTYPE_AUTO: number;
readonly TEXTPATH_SPACINGTYPE_EXACT: number;
readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var SVGTextPathElement: {
@@ -17063,6 +16122,7 @@ declare var SVGTextPositioningElement: {
}
interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17134,6 +16194,7 @@ interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTe
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17144,6 +16205,7 @@ declare var SVGUseElement: {
interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {
readonly viewTarget: SVGStringList;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17175,6 +16237,10 @@ declare var SVGZoomEvent: {
new(): SVGZoomEvent;
}
+interface ScreenEventMap {
+ "MSOrientationChange": Event;
+}
+
interface Screen extends EventTarget {
readonly availHeight: number;
readonly availWidth: number;
@@ -17187,14 +16253,14 @@ interface Screen extends EventTarget {
readonly logicalXDPI: number;
readonly logicalYDPI: number;
readonly msOrientation: string;
- onmsorientationchange: (this: this, ev: Event) => any;
+ onmsorientationchange: (this: Screen, ev: Event) => any;
readonly pixelDepth: number;
readonly systemXDPI: number;
readonly systemYDPI: number;
readonly width: number;
msLockOrientation(orientations: string | string[]): boolean;
msUnlockOrientation(): void;
- addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof ScreenEventMap>(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17213,10 +16279,14 @@ declare var ScriptNotifyEvent: {
new(): ScriptNotifyEvent;
}
+interface ScriptProcessorNodeEventMap {
+ "audioprocess": AudioProcessingEvent;
+}
+
interface ScriptProcessorNode extends AudioNode {
readonly bufferSize: number;
- onaudioprocess: (this: this, ev: AudioProcessingEvent) => any;
- addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void;
+ onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;
+ addEventListener<K extends keyof ScriptProcessorNodeEventMap>(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17398,6 +16468,7 @@ declare var SubtleCrypto: {
interface Text extends CharacterData {
readonly wholeText: string;
+ readonly assignedSlot: HTMLSlotElement | null;
splitText(offset: number): Text;
}
@@ -17447,6 +16518,12 @@ declare var TextMetrics: {
new(): TextMetrics;
}
+interface TextTrackEventMap {
+ "cuechange": Event;
+ "error": ErrorEvent;
+ "load": Event;
+}
+
interface TextTrack extends EventTarget {
readonly activeCues: TextTrackCueList;
readonly cues: TextTrackCueList;
@@ -17455,9 +16532,9 @@ interface TextTrack extends EventTarget {
readonly label: string;
readonly language: string;
mode: any;
- oncuechange: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
+ oncuechange: (this: TextTrack, ev: Event) => any;
+ onerror: (this: TextTrack, ev: ErrorEvent) => any;
+ onload: (this: TextTrack, ev: Event) => any;
readonly readyState: number;
addCue(cue: TextTrackCue): void;
removeCue(cue: TextTrackCue): void;
@@ -17468,9 +16545,7 @@ interface TextTrack extends EventTarget {
readonly LOADING: number;
readonly NONE: number;
readonly SHOWING: number;
- addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackEventMap>(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17486,18 +16561,22 @@ declare var TextTrack: {
readonly SHOWING: number;
}
+interface TextTrackCueEventMap {
+ "enter": Event;
+ "exit": Event;
+}
+
interface TextTrackCue extends EventTarget {
endTime: number;
id: string;
- onenter: (this: this, ev: Event) => any;
- onexit: (this: this, ev: Event) => any;
+ onenter: (this: TextTrackCue, ev: Event) => any;
+ onexit: (this: TextTrackCue, ev: Event) => any;
pauseOnExit: boolean;
startTime: number;
text: string;
readonly track: TextTrack;
getCueAsHTML(): DocumentFragment;
- addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackCueEventMap>(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -17518,11 +16597,15 @@ declare var TextTrackCueList: {
new(): TextTrackCueList;
}
+interface TextTrackListEventMap {
+ "addtrack": TrackEvent;
+}
+
interface TextTrackList extends EventTarget {
readonly length: number;
- onaddtrack: ((this: this, ev: TrackEvent) => any) | null;
+ onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;
item(index: number): TextTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof TextTrackListEventMap>(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: TextTrack;
}
@@ -17712,17 +16795,21 @@ declare var VideoTrack: {
new(): VideoTrack;
}
+interface VideoTrackListEventMap {
+ "addtrack": TrackEvent;
+ "change": Event;
+ "removetrack": TrackEvent;
+}
+
interface VideoTrackList extends EventTarget {
readonly length: number;
- onaddtrack: (this: this, ev: TrackEvent) => any;
- onchange: (this: this, ev: Event) => any;
- onremovetrack: (this: this, ev: TrackEvent) => any;
+ onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;
+ onchange: (this: VideoTrackList, ev: Event) => any;
+ onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;
readonly selectedIndex: number;
getTrackById(id: string): VideoTrack | null;
item(index: number): VideoTrack;
- addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof VideoTrackListEventMap>(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
[index: number]: VideoTrack;
}
@@ -18668,14 +17755,21 @@ declare var WebKitPoint: {
new(x?: number, y?: number): WebKitPoint;
}
+interface WebSocketEventMap {
+ "close": CloseEvent;
+ "error": ErrorEvent;
+ "message": MessageEvent;
+ "open": Event;
+}
+
interface WebSocket extends EventTarget {
binaryType: string;
readonly bufferedAmount: number;
readonly extensions: string;
- onclose: (this: this, ev: CloseEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onopen: (this: this, ev: Event) => any;
+ onclose: (this: WebSocket, ev: CloseEvent) => any;
+ onerror: (this: WebSocket, ev: ErrorEvent) => any;
+ onmessage: (this: WebSocket, ev: MessageEvent) => any;
+ onopen: (this: WebSocket, ev: Event) => any;
readonly protocol: string;
readonly readyState: number;
readonly url: string;
@@ -18685,10 +17779,7 @@ interface WebSocket extends EventTarget {
readonly CLOSING: number;
readonly CONNECTING: number;
readonly OPEN: number;
- addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -18724,6 +17815,95 @@ declare var WheelEvent: {
readonly DOM_DELTA_PIXEL: number;
}
+interface WindowEventMap extends GlobalEventHandlersEventMap {
+ "abort": UIEvent;
+ "afterprint": Event;
+ "beforeprint": Event;
+ "beforeunload": BeforeUnloadEvent;
+ "blur": FocusEvent;
+ "canplay": Event;
+ "canplaythrough": Event;
+ "change": Event;
+ "click": MouseEvent;
+ "compassneedscalibration": Event;
+ "contextmenu": PointerEvent;
+ "dblclick": MouseEvent;
+ "devicelight": DeviceLightEvent;
+ "devicemotion": DeviceMotionEvent;
+ "deviceorientation": DeviceOrientationEvent;
+ "drag": DragEvent;
+ "dragend": DragEvent;
+ "dragenter": DragEvent;
+ "dragleave": DragEvent;
+ "dragover": DragEvent;
+ "dragstart": DragEvent;
+ "drop": DragEvent;
+ "durationchange": Event;
+ "emptied": Event;
+ "ended": MediaStreamErrorEvent;
+ "focus": FocusEvent;
+ "hashchange": HashChangeEvent;
+ "input": Event;
+ "invalid": Event;
+ "keydown": KeyboardEvent;
+ "keypress": KeyboardEvent;
+ "keyup": KeyboardEvent;
+ "load": Event;
+ "loadeddata": Event;
+ "loadedmetadata": Event;
+ "loadstart": Event;
+ "message": MessageEvent;
+ "mousedown": MouseEvent;
+ "mouseenter": MouseEvent;
+ "mouseleave": MouseEvent;
+ "mousemove": MouseEvent;
+ "mouseout": MouseEvent;
+ "mouseover": MouseEvent;
+ "mouseup": MouseEvent;
+ "mousewheel": WheelEvent;
+ "MSGestureChange": MSGestureEvent;
+ "MSGestureDoubleTap": MSGestureEvent;
+ "MSGestureEnd": MSGestureEvent;
+ "MSGestureHold": MSGestureEvent;
+ "MSGestureStart": MSGestureEvent;
+ "MSGestureTap": MSGestureEvent;
+ "MSInertiaStart": MSGestureEvent;
+ "MSPointerCancel": MSPointerEvent;
+ "MSPointerDown": MSPointerEvent;
+ "MSPointerEnter": MSPointerEvent;
+ "MSPointerLeave": MSPointerEvent;
+ "MSPointerMove": MSPointerEvent;
+ "MSPointerOut": MSPointerEvent;
+ "MSPointerOver": MSPointerEvent;
+ "MSPointerUp": MSPointerEvent;
+ "offline": Event;
+ "online": Event;
+ "orientationchange": Event;
+ "pagehide": PageTransitionEvent;
+ "pageshow": PageTransitionEvent;
+ "pause": Event;
+ "play": Event;
+ "playing": Event;
+ "popstate": PopStateEvent;
+ "progress": ProgressEvent;
+ "ratechange": Event;
+ "readystatechange": ProgressEvent;
+ "reset": Event;
+ "resize": UIEvent;
+ "scroll": UIEvent;
+ "seeked": Event;
+ "seeking": Event;
+ "select": UIEvent;
+ "stalled": Event;
+ "storage": StorageEvent;
+ "submit": Event;
+ "suspend": Event;
+ "timeupdate": Event;
+ "unload": Event;
+ "volumechange": Event;
+ "waiting": Event;
+}
+
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {
readonly applicationCache: ApplicationCache;
readonly clientInformation: Navigator;
@@ -18748,97 +17928,97 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
name: string;
readonly navigator: Navigator;
offscreenBuffering: string | boolean;
- onabort: (this: this, ev: UIEvent) => any;
- onafterprint: (this: this, ev: Event) => any;
- onbeforeprint: (this: this, ev: Event) => any;
- onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;
- onblur: (this: this, ev: FocusEvent) => any;
- oncanplay: (this: this, ev: Event) => any;
- oncanplaythrough: (this: this, ev: Event) => any;
- onchange: (this: this, ev: Event) => any;
- onclick: (this: this, ev: MouseEvent) => any;
- oncompassneedscalibration: (this: this, ev: Event) => any;
- oncontextmenu: (this: this, ev: PointerEvent) => any;
- ondblclick: (this: this, ev: MouseEvent) => any;
- ondevicelight: (this: this, ev: DeviceLightEvent) => any;
- ondevicemotion: (this: this, ev: DeviceMotionEvent) => any;
- ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any;
- ondrag: (this: this, ev: DragEvent) => any;
- ondragend: (this: this, ev: DragEvent) => any;
- ondragenter: (this: this, ev: DragEvent) => any;
- ondragleave: (this: this, ev: DragEvent) => any;
- ondragover: (this: this, ev: DragEvent) => any;
- ondragstart: (this: this, ev: DragEvent) => any;
- ondrop: (this: this, ev: DragEvent) => any;
- ondurationchange: (this: this, ev: Event) => any;
- onemptied: (this: this, ev: Event) => any;
- onended: (this: this, ev: MediaStreamErrorEvent) => any;
+ onabort: (this: Window, ev: UIEvent) => any;
+ onafterprint: (this: Window, ev: Event) => any;
+ onbeforeprint: (this: Window, ev: Event) => any;
+ onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;
+ onblur: (this: Window, ev: FocusEvent) => any;
+ oncanplay: (this: Window, ev: Event) => any;
+ oncanplaythrough: (this: Window, ev: Event) => any;
+ onchange: (this: Window, ev: Event) => any;
+ onclick: (this: Window, ev: MouseEvent) => any;
+ oncompassneedscalibration: (this: Window, ev: Event) => any;
+ oncontextmenu: (this: Window, ev: PointerEvent) => any;
+ ondblclick: (this: Window, ev: MouseEvent) => any;
+ ondevicelight: (this: Window, ev: DeviceLightEvent) => any;
+ ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;
+ ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;
+ ondrag: (this: Window, ev: DragEvent) => any;
+ ondragend: (this: Window, ev: DragEvent) => any;
+ ondragenter: (this: Window, ev: DragEvent) => any;
+ ondragleave: (this: Window, ev: DragEvent) => any;
+ ondragover: (this: Window, ev: DragEvent) => any;
+ ondragstart: (this: Window, ev: DragEvent) => any;
+ ondrop: (this: Window, ev: DragEvent) => any;
+ ondurationchange: (this: Window, ev: Event) => any;
+ onemptied: (this: Window, ev: Event) => any;
+ onended: (this: Window, ev: MediaStreamErrorEvent) => any;
onerror: ErrorEventHandler;
- onfocus: (this: this, ev: FocusEvent) => any;
- onhashchange: (this: this, ev: HashChangeEvent) => any;
- oninput: (this: this, ev: Event) => any;
- oninvalid: (this: this, ev: Event) => any;
- onkeydown: (this: this, ev: KeyboardEvent) => any;
- onkeypress: (this: this, ev: KeyboardEvent) => any;
- onkeyup: (this: this, ev: KeyboardEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadeddata: (this: this, ev: Event) => any;
- onloadedmetadata: (this: this, ev: Event) => any;
- onloadstart: (this: this, ev: Event) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onmousedown: (this: this, ev: MouseEvent) => any;
- onmouseenter: (this: this, ev: MouseEvent) => any;
- onmouseleave: (this: this, ev: MouseEvent) => any;
- onmousemove: (this: this, ev: MouseEvent) => any;
- onmouseout: (this: this, ev: MouseEvent) => any;
- onmouseover: (this: this, ev: MouseEvent) => any;
- onmouseup: (this: this, ev: MouseEvent) => any;
- onmousewheel: (this: this, ev: WheelEvent) => any;
- onmsgesturechange: (this: this, ev: MSGestureEvent) => any;
- onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;
- onmsgestureend: (this: this, ev: MSGestureEvent) => any;
- onmsgesturehold: (this: this, ev: MSGestureEvent) => any;
- onmsgesturestart: (this: this, ev: MSGestureEvent) => any;
- onmsgesturetap: (this: this, ev: MSGestureEvent) => any;
- onmsinertiastart: (this: this, ev: MSGestureEvent) => any;
- onmspointercancel: (this: this, ev: MSPointerEvent) => any;
- onmspointerdown: (this: this, ev: MSPointerEvent) => any;
- onmspointerenter: (this: this, ev: MSPointerEvent) => any;
- onmspointerleave: (this: this, ev: MSPointerEvent) => any;
- onmspointermove: (this: this, ev: MSPointerEvent) => any;
- onmspointerout: (this: this, ev: MSPointerEvent) => any;
- onmspointerover: (this: this, ev: MSPointerEvent) => any;
- onmspointerup: (this: this, ev: MSPointerEvent) => any;
- onoffline: (this: this, ev: Event) => any;
- ononline: (this: this, ev: Event) => any;
- onorientationchange: (this: this, ev: Event) => any;
- onpagehide: (this: this, ev: PageTransitionEvent) => any;
- onpageshow: (this: this, ev: PageTransitionEvent) => any;
- onpause: (this: this, ev: Event) => any;
- onplay: (this: this, ev: Event) => any;
- onplaying: (this: this, ev: Event) => any;
- onpopstate: (this: this, ev: PopStateEvent) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- onratechange: (this: this, ev: Event) => any;
- onreadystatechange: (this: this, ev: ProgressEvent) => any;
- onreset: (this: this, ev: Event) => any;
- onresize: (this: this, ev: UIEvent) => any;
- onscroll: (this: this, ev: UIEvent) => any;
- onseeked: (this: this, ev: Event) => any;
- onseeking: (this: this, ev: Event) => any;
- onselect: (this: this, ev: UIEvent) => any;
- onstalled: (this: this, ev: Event) => any;
- onstorage: (this: this, ev: StorageEvent) => any;
- onsubmit: (this: this, ev: Event) => any;
- onsuspend: (this: this, ev: Event) => any;
- ontimeupdate: (this: this, ev: Event) => any;
+ onfocus: (this: Window, ev: FocusEvent) => any;
+ onhashchange: (this: Window, ev: HashChangeEvent) => any;
+ oninput: (this: Window, ev: Event) => any;
+ oninvalid: (this: Window, ev: Event) => any;
+ onkeydown: (this: Window, ev: KeyboardEvent) => any;
+ onkeypress: (this: Window, ev: KeyboardEvent) => any;
+ onkeyup: (this: Window, ev: KeyboardEvent) => any;
+ onload: (this: Window, ev: Event) => any;
+ onloadeddata: (this: Window, ev: Event) => any;
+ onloadedmetadata: (this: Window, ev: Event) => any;
+ onloadstart: (this: Window, ev: Event) => any;
+ onmessage: (this: Window, ev: MessageEvent) => any;
+ onmousedown: (this: Window, ev: MouseEvent) => any;
+ onmouseenter: (this: Window, ev: MouseEvent) => any;
+ onmouseleave: (this: Window, ev: MouseEvent) => any;
+ onmousemove: (this: Window, ev: MouseEvent) => any;
+ onmouseout: (this: Window, ev: MouseEvent) => any;
+ onmouseover: (this: Window, ev: MouseEvent) => any;
+ onmouseup: (this: Window, ev: MouseEvent) => any;
+ onmousewheel: (this: Window, ev: WheelEvent) => any;
+ onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;
+ onmsgestureend: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;
+ onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;
+ onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;
+ onmspointercancel: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerdown: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerenter: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerleave: (this: Window, ev: MSPointerEvent) => any;
+ onmspointermove: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerout: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerover: (this: Window, ev: MSPointerEvent) => any;
+ onmspointerup: (this: Window, ev: MSPointerEvent) => any;
+ onoffline: (this: Window, ev: Event) => any;
+ ononline: (this: Window, ev: Event) => any;
+ onorientationchange: (this: Window, ev: Event) => any;
+ onpagehide: (this: Window, ev: PageTransitionEvent) => any;
+ onpageshow: (this: Window, ev: PageTransitionEvent) => any;
+ onpause: (this: Window, ev: Event) => any;
+ onplay: (this: Window, ev: Event) => any;
+ onplaying: (this: Window, ev: Event) => any;
+ onpopstate: (this: Window, ev: PopStateEvent) => any;
+ onprogress: (this: Window, ev: ProgressEvent) => any;
+ onratechange: (this: Window, ev: Event) => any;
+ onreadystatechange: (this: Window, ev: ProgressEvent) => any;
+ onreset: (this: Window, ev: Event) => any;
+ onresize: (this: Window, ev: UIEvent) => any;
+ onscroll: (this: Window, ev: UIEvent) => any;
+ onseeked: (this: Window, ev: Event) => any;
+ onseeking: (this: Window, ev: Event) => any;
+ onselect: (this: Window, ev: UIEvent) => any;
+ onstalled: (this: Window, ev: Event) => any;
+ onstorage: (this: Window, ev: StorageEvent) => any;
+ onsubmit: (this: Window, ev: Event) => any;
+ onsuspend: (this: Window, ev: Event) => any;
+ ontimeupdate: (this: Window, ev: Event) => any;
ontouchcancel: (ev: TouchEvent) => any;
ontouchend: (ev: TouchEvent) => any;
ontouchmove: (ev: TouchEvent) => any;
ontouchstart: (ev: TouchEvent) => any;
- onunload: (this: this, ev: Event) => any;
- onvolumechange: (this: this, ev: Event) => any;
- onwaiting: (this: this, ev: Event) => any;
+ onunload: (this: Window, ev: Event) => any;
+ onvolumechange: (this: Window, ev: Event) => any;
+ onwaiting: (this: Window, ev: Event) => any;
opener: any;
orientation: string | number;
readonly outerHeight: number;
@@ -18897,101 +18077,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
scroll(options?: ScrollToOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollBy(options?: ScrollToOptions): void;
- addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19000,12 +18086,15 @@ declare var Window: {
new(): Window;
}
+interface WorkerEventMap extends AbstractWorkerEventMap {
+ "message": MessageEvent;
+}
+
interface Worker extends EventTarget, AbstractWorker {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: Worker, ev: MessageEvent) => any;
postMessage(message: any, ports?: any): void;
terminate(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19015,6 +18104,8 @@ declare var Worker: {
}
interface XMLDocument extends Document {
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLDocument: {
@@ -19022,8 +18113,12 @@ declare var XMLDocument: {
new(): XMLDocument;
}
+interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
+ "readystatechange": Event;
+}
+
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
- onreadystatechange: (this: this, ev: Event) => any;
+ onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
@@ -19051,14 +18146,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
- addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19074,6 +18162,7 @@ declare var XMLHttpRequest: {
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19094,7 +18183,7 @@ declare var XMLSerializer: {
interface XPathEvaluator {
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
createNSResolver(nodeResolver?: Node): XPathNSResolver;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
+ evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathEvaluator: {
@@ -19103,7 +18192,7 @@ declare var XPathEvaluator: {
}
interface XPathExpression {
- evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression;
+ evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;
}
declare var XPathExpression: {
@@ -19173,9 +18262,13 @@ declare var XSLTProcessor: {
new(): XSLTProcessor;
}
+interface AbstractWorkerEventMap {
+ "error": ErrorEvent;
+}
+
interface AbstractWorker {
- onerror: (this: this, ev: ErrorEvent) => any;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ onerror: (this: AbstractWorker, ev: ErrorEvent) => any;
+ addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19286,25 +18379,29 @@ interface GetSVGDocument {
getSVGDocument(): Document;
}
+interface GlobalEventHandlersEventMap {
+ "pointercancel": PointerEvent;
+ "pointerdown": PointerEvent;
+ "pointerenter": PointerEvent;
+ "pointerleave": PointerEvent;
+ "pointermove": PointerEvent;
+ "pointerout": PointerEvent;
+ "pointerover": PointerEvent;
+ "pointerup": PointerEvent;
+ "wheel": WheelEvent;
+}
+
interface GlobalEventHandlers {
- onpointercancel: (this: this, ev: PointerEvent) => any;
- onpointerdown: (this: this, ev: PointerEvent) => any;
- onpointerenter: (this: this, ev: PointerEvent) => any;
- onpointerleave: (this: this, ev: PointerEvent) => any;
- onpointermove: (this: this, ev: PointerEvent) => any;
- onpointerout: (this: this, ev: PointerEvent) => any;
- onpointerover: (this: this, ev: PointerEvent) => any;
- onpointerup: (this: this, ev: PointerEvent) => any;
- onwheel: (this: this, ev: WheelEvent) => any;
- addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;
+ onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;
+ onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
+ addEventListener<K extends keyof GlobalEventHandlersEventMap>(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19331,25 +18428,29 @@ interface LinkStyle {
readonly sheet: StyleSheet;
}
+interface MSBaseReaderEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+}
+
interface MSBaseReader {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onabort: (this: MSBaseReader, ev: Event) => any;
+ onerror: (this: MSBaseReader, ev: ErrorEvent) => any;
+ onload: (this: MSBaseReader, ev: Event) => any;
+ onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;
+ onloadstart: (this: MSBaseReader, ev: Event) => any;
+ onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;
readonly readyState: number;
readonly result: any;
abort(): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -19398,359 +18499,9 @@ interface NavigatorUserMedia {
}
interface NodeSelector {
- querySelector(selectors: "a"): HTMLAnchorElement | null;
- querySelector(selectors: "abbr"): HTMLElement | null;
- querySelector(selectors: "acronym"): HTMLElement | null;
- querySelector(selectors: "address"): HTMLElement | null;
- querySelector(selectors: "applet"): HTMLAppletElement | null;
- querySelector(selectors: "area"): HTMLAreaElement | null;
- querySelector(selectors: "article"): HTMLElement | null;
- querySelector(selectors: "aside"): HTMLElement | null;
- querySelector(selectors: "audio"): HTMLAudioElement | null;
- querySelector(selectors: "b"): HTMLElement | null;
- querySelector(selectors: "base"): HTMLBaseElement | null;
- querySelector(selectors: "basefont"): HTMLBaseFontElement | null;
- querySelector(selectors: "bdo"): HTMLElement | null;
- querySelector(selectors: "big"): HTMLElement | null;
- querySelector(selectors: "blockquote"): HTMLQuoteElement | null;
- querySelector(selectors: "body"): HTMLBodyElement | null;
- querySelector(selectors: "br"): HTMLBRElement | null;
- querySelector(selectors: "button"): HTMLButtonElement | null;
- querySelector(selectors: "canvas"): HTMLCanvasElement | null;
- querySelector(selectors: "caption"): HTMLTableCaptionElement | null;
- querySelector(selectors: "center"): HTMLElement | null;
- querySelector(selectors: "circle"): SVGCircleElement | null;
- querySelector(selectors: "cite"): HTMLElement | null;
- querySelector(selectors: "clippath"): SVGClipPathElement | null;
- querySelector(selectors: "code"): HTMLElement | null;
- querySelector(selectors: "col"): HTMLTableColElement | null;
- querySelector(selectors: "colgroup"): HTMLTableColElement | null;
- querySelector(selectors: "datalist"): HTMLDataListElement | null;
- querySelector(selectors: "dd"): HTMLElement | null;
- querySelector(selectors: "defs"): SVGDefsElement | null;
- querySelector(selectors: "del"): HTMLModElement | null;
- querySelector(selectors: "desc"): SVGDescElement | null;
- querySelector(selectors: "dfn"): HTMLElement | null;
- querySelector(selectors: "dir"): HTMLDirectoryElement | null;
- querySelector(selectors: "div"): HTMLDivElement | null;
- querySelector(selectors: "dl"): HTMLDListElement | null;
- querySelector(selectors: "dt"): HTMLElement | null;
- querySelector(selectors: "ellipse"): SVGEllipseElement | null;
- querySelector(selectors: "em"): HTMLElement | null;
- querySelector(selectors: "embed"): HTMLEmbedElement | null;
- querySelector(selectors: "feblend"): SVGFEBlendElement | null;
- querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement | null;
- querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement | null;
- querySelector(selectors: "fecomposite"): SVGFECompositeElement | null;
- querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement | null;
- querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement | null;
- querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement | null;
- querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement | null;
- querySelector(selectors: "feflood"): SVGFEFloodElement | null;
- querySelector(selectors: "fefunca"): SVGFEFuncAElement | null;
- querySelector(selectors: "fefuncb"): SVGFEFuncBElement | null;
- querySelector(selectors: "fefuncg"): SVGFEFuncGElement | null;
- querySelector(selectors: "fefuncr"): SVGFEFuncRElement | null;
- querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement | null;
- querySelector(selectors: "feimage"): SVGFEImageElement | null;
- querySelector(selectors: "femerge"): SVGFEMergeElement | null;
- querySelector(selectors: "femergenode"): SVGFEMergeNodeElement | null;
- querySelector(selectors: "femorphology"): SVGFEMorphologyElement | null;
- querySelector(selectors: "feoffset"): SVGFEOffsetElement | null;
- querySelector(selectors: "fepointlight"): SVGFEPointLightElement | null;
- querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement | null;
- querySelector(selectors: "fespotlight"): SVGFESpotLightElement | null;
- querySelector(selectors: "fetile"): SVGFETileElement | null;
- querySelector(selectors: "feturbulence"): SVGFETurbulenceElement | null;
- querySelector(selectors: "fieldset"): HTMLFieldSetElement | null;
- querySelector(selectors: "figcaption"): HTMLElement | null;
- querySelector(selectors: "figure"): HTMLElement | null;
- querySelector(selectors: "filter"): SVGFilterElement | null;
- querySelector(selectors: "font"): HTMLFontElement | null;
- querySelector(selectors: "footer"): HTMLElement | null;
- querySelector(selectors: "foreignobject"): SVGForeignObjectElement | null;
- querySelector(selectors: "form"): HTMLFormElement | null;
- querySelector(selectors: "frame"): HTMLFrameElement | null;
- querySelector(selectors: "frameset"): HTMLFrameSetElement | null;
- querySelector(selectors: "g"): SVGGElement | null;
- querySelector(selectors: "h1"): HTMLHeadingElement | null;
- querySelector(selectors: "h2"): HTMLHeadingElement | null;
- querySelector(selectors: "h3"): HTMLHeadingElement | null;
- querySelector(selectors: "h4"): HTMLHeadingElement | null;
- querySelector(selectors: "h5"): HTMLHeadingElement | null;
- querySelector(selectors: "h6"): HTMLHeadingElement | null;
- querySelector(selectors: "head"): HTMLHeadElement | null;
- querySelector(selectors: "header"): HTMLElement | null;
- querySelector(selectors: "hgroup"): HTMLElement | null;
- querySelector(selectors: "hr"): HTMLHRElement | null;
- querySelector(selectors: "html"): HTMLHtmlElement | null;
- querySelector(selectors: "i"): HTMLElement | null;
- querySelector(selectors: "iframe"): HTMLIFrameElement | null;
- querySelector(selectors: "image"): SVGImageElement | null;
- querySelector(selectors: "img"): HTMLImageElement | null;
- querySelector(selectors: "input"): HTMLInputElement | null;
- querySelector(selectors: "ins"): HTMLModElement | null;
- querySelector(selectors: "isindex"): HTMLUnknownElement | null;
- querySelector(selectors: "kbd"): HTMLElement | null;
- querySelector(selectors: "keygen"): HTMLElement | null;
- querySelector(selectors: "label"): HTMLLabelElement | null;
- querySelector(selectors: "legend"): HTMLLegendElement | null;
- querySelector(selectors: "li"): HTMLLIElement | null;
- querySelector(selectors: "line"): SVGLineElement | null;
- querySelector(selectors: "lineargradient"): SVGLinearGradientElement | null;
- querySelector(selectors: "link"): HTMLLinkElement | null;
- querySelector(selectors: "listing"): HTMLPreElement | null;
- querySelector(selectors: "map"): HTMLMapElement | null;
- querySelector(selectors: "mark"): HTMLElement | null;
- querySelector(selectors: "marker"): SVGMarkerElement | null;
- querySelector(selectors: "marquee"): HTMLMarqueeElement | null;
- querySelector(selectors: "mask"): SVGMaskElement | null;
- querySelector(selectors: "menu"): HTMLMenuElement | null;
- querySelector(selectors: "meta"): HTMLMetaElement | null;
- querySelector(selectors: "metadata"): SVGMetadataElement | null;
- querySelector(selectors: "meter"): HTMLMeterElement | null;
- querySelector(selectors: "nav"): HTMLElement | null;
- querySelector(selectors: "nextid"): HTMLUnknownElement | null;
- querySelector(selectors: "nobr"): HTMLElement | null;
- querySelector(selectors: "noframes"): HTMLElement | null;
- querySelector(selectors: "noscript"): HTMLElement | null;
- querySelector(selectors: "object"): HTMLObjectElement | null;
- querySelector(selectors: "ol"): HTMLOListElement | null;
- querySelector(selectors: "optgroup"): HTMLOptGroupElement | null;
- querySelector(selectors: "option"): HTMLOptionElement | null;
- querySelector(selectors: "p"): HTMLParagraphElement | null;
- querySelector(selectors: "param"): HTMLParamElement | null;
- querySelector(selectors: "path"): SVGPathElement | null;
- querySelector(selectors: "pattern"): SVGPatternElement | null;
- querySelector(selectors: "picture"): HTMLPictureElement | null;
- querySelector(selectors: "plaintext"): HTMLElement | null;
- querySelector(selectors: "polygon"): SVGPolygonElement | null;
- querySelector(selectors: "polyline"): SVGPolylineElement | null;
- querySelector(selectors: "pre"): HTMLPreElement | null;
- querySelector(selectors: "progress"): HTMLProgressElement | null;
- querySelector(selectors: "q"): HTMLQuoteElement | null;
- querySelector(selectors: "radialgradient"): SVGRadialGradientElement | null;
- querySelector(selectors: "rect"): SVGRectElement | null;
- querySelector(selectors: "rt"): HTMLElement | null;
- querySelector(selectors: "ruby"): HTMLElement | null;
- querySelector(selectors: "s"): HTMLElement | null;
- querySelector(selectors: "samp"): HTMLElement | null;
- querySelector(selectors: "script"): HTMLScriptElement | null;
- querySelector(selectors: "section"): HTMLElement | null;
- querySelector(selectors: "select"): HTMLSelectElement | null;
- querySelector(selectors: "small"): HTMLElement | null;
- querySelector(selectors: "source"): HTMLSourceElement | null;
- querySelector(selectors: "span"): HTMLSpanElement | null;
- querySelector(selectors: "stop"): SVGStopElement | null;
- querySelector(selectors: "strike"): HTMLElement | null;
- querySelector(selectors: "strong"): HTMLElement | null;
- querySelector(selectors: "style"): HTMLStyleElement | null;
- querySelector(selectors: "sub"): HTMLElement | null;
- querySelector(selectors: "sup"): HTMLElement | null;
- querySelector(selectors: "svg"): SVGSVGElement | null;
- querySelector(selectors: "switch"): SVGSwitchElement | null;
- querySelector(selectors: "symbol"): SVGSymbolElement | null;
- querySelector(selectors: "table"): HTMLTableElement | null;
- querySelector(selectors: "tbody"): HTMLTableSectionElement | null;
- querySelector(selectors: "td"): HTMLTableDataCellElement | null;
- querySelector(selectors: "template"): HTMLTemplateElement | null;
- querySelector(selectors: "text"): SVGTextElement | null;
- querySelector(selectors: "textpath"): SVGTextPathElement | null;
- querySelector(selectors: "textarea"): HTMLTextAreaElement | null;
- querySelector(selectors: "tfoot"): HTMLTableSectionElement | null;
- querySelector(selectors: "th"): HTMLTableHeaderCellElement | null;
- querySelector(selectors: "thead"): HTMLTableSectionElement | null;
- querySelector(selectors: "title"): HTMLTitleElement | null;
- querySelector(selectors: "tr"): HTMLTableRowElement | null;
- querySelector(selectors: "track"): HTMLTrackElement | null;
- querySelector(selectors: "tspan"): SVGTSpanElement | null;
- querySelector(selectors: "tt"): HTMLElement | null;
- querySelector(selectors: "u"): HTMLElement | null;
- querySelector(selectors: "ul"): HTMLUListElement | null;
- querySelector(selectors: "use"): SVGUseElement | null;
- querySelector(selectors: "var"): HTMLElement | null;
- querySelector(selectors: "video"): HTMLVideoElement | null;
- querySelector(selectors: "view"): SVGViewElement | null;
- querySelector(selectors: "wbr"): HTMLElement | null;
- querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement | null;
- querySelector(selectors: "xmp"): HTMLPreElement | null;
+ querySelector<K extends keyof ElementTagNameMap>(selectors: K): ElementTagNameMap[K] | null;
querySelector(selectors: string): Element | null;
- querySelectorAll(selectors: "a"): NodeListOf<HTMLAnchorElement>;
- querySelectorAll(selectors: "abbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "acronym"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "address"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "applet"): NodeListOf<HTMLAppletElement>;
- querySelectorAll(selectors: "area"): NodeListOf<HTMLAreaElement>;
- querySelectorAll(selectors: "article"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "aside"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "audio"): NodeListOf<HTMLAudioElement>;
- querySelectorAll(selectors: "b"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "base"): NodeListOf<HTMLBaseElement>;
- querySelectorAll(selectors: "basefont"): NodeListOf<HTMLBaseFontElement>;
- querySelectorAll(selectors: "bdo"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "big"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "blockquote"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "body"): NodeListOf<HTMLBodyElement>;
- querySelectorAll(selectors: "br"): NodeListOf<HTMLBRElement>;
- querySelectorAll(selectors: "button"): NodeListOf<HTMLButtonElement>;
- querySelectorAll(selectors: "canvas"): NodeListOf<HTMLCanvasElement>;
- querySelectorAll(selectors: "caption"): NodeListOf<HTMLTableCaptionElement>;
- querySelectorAll(selectors: "center"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "circle"): NodeListOf<SVGCircleElement>;
- querySelectorAll(selectors: "cite"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "clippath"): NodeListOf<SVGClipPathElement>;
- querySelectorAll(selectors: "code"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "col"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "colgroup"): NodeListOf<HTMLTableColElement>;
- querySelectorAll(selectors: "datalist"): NodeListOf<HTMLDataListElement>;
- querySelectorAll(selectors: "dd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "defs"): NodeListOf<SVGDefsElement>;
- querySelectorAll(selectors: "del"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "desc"): NodeListOf<SVGDescElement>;
- querySelectorAll(selectors: "dfn"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "dir"): NodeListOf<HTMLDirectoryElement>;
- querySelectorAll(selectors: "div"): NodeListOf<HTMLDivElement>;
- querySelectorAll(selectors: "dl"): NodeListOf<HTMLDListElement>;
- querySelectorAll(selectors: "dt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ellipse"): NodeListOf<SVGEllipseElement>;
- querySelectorAll(selectors: "em"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "embed"): NodeListOf<HTMLEmbedElement>;
- querySelectorAll(selectors: "feblend"): NodeListOf<SVGFEBlendElement>;
- querySelectorAll(selectors: "fecolormatrix"): NodeListOf<SVGFEColorMatrixElement>;
- querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf<SVGFEComponentTransferElement>;
- querySelectorAll(selectors: "fecomposite"): NodeListOf<SVGFECompositeElement>;
- querySelectorAll(selectors: "feconvolvematrix"): NodeListOf<SVGFEConvolveMatrixElement>;
- querySelectorAll(selectors: "fediffuselighting"): NodeListOf<SVGFEDiffuseLightingElement>;
- querySelectorAll(selectors: "fedisplacementmap"): NodeListOf<SVGFEDisplacementMapElement>;
- querySelectorAll(selectors: "fedistantlight"): NodeListOf<SVGFEDistantLightElement>;
- querySelectorAll(selectors: "feflood"): NodeListOf<SVGFEFloodElement>;
- querySelectorAll(selectors: "fefunca"): NodeListOf<SVGFEFuncAElement>;
- querySelectorAll(selectors: "fefuncb"): NodeListOf<SVGFEFuncBElement>;
- querySelectorAll(selectors: "fefuncg"): NodeListOf<SVGFEFuncGElement>;
- querySelectorAll(selectors: "fefuncr"): NodeListOf<SVGFEFuncRElement>;
- querySelectorAll(selectors: "fegaussianblur"): NodeListOf<SVGFEGaussianBlurElement>;
- querySelectorAll(selectors: "feimage"): NodeListOf<SVGFEImageElement>;
- querySelectorAll(selectors: "femerge"): NodeListOf<SVGFEMergeElement>;
- querySelectorAll(selectors: "femergenode"): NodeListOf<SVGFEMergeNodeElement>;
- querySelectorAll(selectors: "femorphology"): NodeListOf<SVGFEMorphologyElement>;
- querySelectorAll(selectors: "feoffset"): NodeListOf<SVGFEOffsetElement>;
- querySelectorAll(selectors: "fepointlight"): NodeListOf<SVGFEPointLightElement>;
- querySelectorAll(selectors: "fespecularlighting"): NodeListOf<SVGFESpecularLightingElement>;
- querySelectorAll(selectors: "fespotlight"): NodeListOf<SVGFESpotLightElement>;
- querySelectorAll(selectors: "fetile"): NodeListOf<SVGFETileElement>;
- querySelectorAll(selectors: "feturbulence"): NodeListOf<SVGFETurbulenceElement>;
- querySelectorAll(selectors: "fieldset"): NodeListOf<HTMLFieldSetElement>;
- querySelectorAll(selectors: "figcaption"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "figure"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "filter"): NodeListOf<SVGFilterElement>;
- querySelectorAll(selectors: "font"): NodeListOf<HTMLFontElement>;
- querySelectorAll(selectors: "footer"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "foreignobject"): NodeListOf<SVGForeignObjectElement>;
- querySelectorAll(selectors: "form"): NodeListOf<HTMLFormElement>;
- querySelectorAll(selectors: "frame"): NodeListOf<HTMLFrameElement>;
- querySelectorAll(selectors: "frameset"): NodeListOf<HTMLFrameSetElement>;
- querySelectorAll(selectors: "g"): NodeListOf<SVGGElement>;
- querySelectorAll(selectors: "h1"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h2"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h3"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h4"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h5"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "h6"): NodeListOf<HTMLHeadingElement>;
- querySelectorAll(selectors: "head"): NodeListOf<HTMLHeadElement>;
- querySelectorAll(selectors: "header"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hgroup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "hr"): NodeListOf<HTMLHRElement>;
- querySelectorAll(selectors: "html"): NodeListOf<HTMLHtmlElement>;
- querySelectorAll(selectors: "i"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "iframe"): NodeListOf<HTMLIFrameElement>;
- querySelectorAll(selectors: "image"): NodeListOf<SVGImageElement>;
- querySelectorAll(selectors: "img"): NodeListOf<HTMLImageElement>;
- querySelectorAll(selectors: "input"): NodeListOf<HTMLInputElement>;
- querySelectorAll(selectors: "ins"): NodeListOf<HTMLModElement>;
- querySelectorAll(selectors: "isindex"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "kbd"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "keygen"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "label"): NodeListOf<HTMLLabelElement>;
- querySelectorAll(selectors: "legend"): NodeListOf<HTMLLegendElement>;
- querySelectorAll(selectors: "li"): NodeListOf<HTMLLIElement>;
- querySelectorAll(selectors: "line"): NodeListOf<SVGLineElement>;
- querySelectorAll(selectors: "lineargradient"): NodeListOf<SVGLinearGradientElement>;
- querySelectorAll(selectors: "link"): NodeListOf<HTMLLinkElement>;
- querySelectorAll(selectors: "listing"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "map"): NodeListOf<HTMLMapElement>;
- querySelectorAll(selectors: "mark"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "marker"): NodeListOf<SVGMarkerElement>;
- querySelectorAll(selectors: "marquee"): NodeListOf<HTMLMarqueeElement>;
- querySelectorAll(selectors: "mask"): NodeListOf<SVGMaskElement>;
- querySelectorAll(selectors: "menu"): NodeListOf<HTMLMenuElement>;
- querySelectorAll(selectors: "meta"): NodeListOf<HTMLMetaElement>;
- querySelectorAll(selectors: "metadata"): NodeListOf<SVGMetadataElement>;
- querySelectorAll(selectors: "meter"): NodeListOf<HTMLMeterElement>;
- querySelectorAll(selectors: "nav"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "nextid"): NodeListOf<HTMLUnknownElement>;
- querySelectorAll(selectors: "nobr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noframes"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "noscript"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "object"): NodeListOf<HTMLObjectElement>;
- querySelectorAll(selectors: "ol"): NodeListOf<HTMLOListElement>;
- querySelectorAll(selectors: "optgroup"): NodeListOf<HTMLOptGroupElement>;
- querySelectorAll(selectors: "option"): NodeListOf<HTMLOptionElement>;
- querySelectorAll(selectors: "p"): NodeListOf<HTMLParagraphElement>;
- querySelectorAll(selectors: "param"): NodeListOf<HTMLParamElement>;
- querySelectorAll(selectors: "path"): NodeListOf<SVGPathElement>;
- querySelectorAll(selectors: "pattern"): NodeListOf<SVGPatternElement>;
- querySelectorAll(selectors: "picture"): NodeListOf<HTMLPictureElement>;
- querySelectorAll(selectors: "plaintext"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "polygon"): NodeListOf<SVGPolygonElement>;
- querySelectorAll(selectors: "polyline"): NodeListOf<SVGPolylineElement>;
- querySelectorAll(selectors: "pre"): NodeListOf<HTMLPreElement>;
- querySelectorAll(selectors: "progress"): NodeListOf<HTMLProgressElement>;
- querySelectorAll(selectors: "q"): NodeListOf<HTMLQuoteElement>;
- querySelectorAll(selectors: "radialgradient"): NodeListOf<SVGRadialGradientElement>;
- querySelectorAll(selectors: "rect"): NodeListOf<SVGRectElement>;
- querySelectorAll(selectors: "rt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ruby"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "s"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "samp"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "script"): NodeListOf<HTMLScriptElement>;
- querySelectorAll(selectors: "section"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "select"): NodeListOf<HTMLSelectElement>;
- querySelectorAll(selectors: "small"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "source"): NodeListOf<HTMLSourceElement>;
- querySelectorAll(selectors: "span"): NodeListOf<HTMLSpanElement>;
- querySelectorAll(selectors: "stop"): NodeListOf<SVGStopElement>;
- querySelectorAll(selectors: "strike"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "strong"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "style"): NodeListOf<HTMLStyleElement>;
- querySelectorAll(selectors: "sub"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "sup"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "svg"): NodeListOf<SVGSVGElement>;
- querySelectorAll(selectors: "switch"): NodeListOf<SVGSwitchElement>;
- querySelectorAll(selectors: "symbol"): NodeListOf<SVGSymbolElement>;
- querySelectorAll(selectors: "table"): NodeListOf<HTMLTableElement>;
- querySelectorAll(selectors: "tbody"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "td"): NodeListOf<HTMLTableDataCellElement>;
- querySelectorAll(selectors: "template"): NodeListOf<HTMLTemplateElement>;
- querySelectorAll(selectors: "text"): NodeListOf<SVGTextElement>;
- querySelectorAll(selectors: "textpath"): NodeListOf<SVGTextPathElement>;
- querySelectorAll(selectors: "textarea"): NodeListOf<HTMLTextAreaElement>;
- querySelectorAll(selectors: "tfoot"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "th"): NodeListOf<HTMLTableHeaderCellElement>;
- querySelectorAll(selectors: "thead"): NodeListOf<HTMLTableSectionElement>;
- querySelectorAll(selectors: "title"): NodeListOf<HTMLTitleElement>;
- querySelectorAll(selectors: "tr"): NodeListOf<HTMLTableRowElement>;
- querySelectorAll(selectors: "track"): NodeListOf<HTMLTrackElement>;
- querySelectorAll(selectors: "tspan"): NodeListOf<SVGTSpanElement>;
- querySelectorAll(selectors: "tt"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "u"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "ul"): NodeListOf<HTMLUListElement>;
- querySelectorAll(selectors: "use"): NodeListOf<SVGUseElement>;
- querySelectorAll(selectors: "var"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "video"): NodeListOf<HTMLVideoElement>;
- querySelectorAll(selectors: "view"): NodeListOf<SVGViewElement>;
- querySelectorAll(selectors: "wbr"): NodeListOf<HTMLElement>;
- querySelectorAll(selectors: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
- querySelectorAll(selectors: "xmp"): NodeListOf<HTMLPreElement>;
+ querySelectorAll<K extends keyof ElementListTagNameMap>(selectors: K): ElementListTagNameMap[K];
querySelectorAll(selectors: string): NodeListOf<Element>;
}
@@ -19850,21 +18601,25 @@ interface WindowTimersExtension {
setImmediate(handler: any, ...args: any[]): number;
}
+interface XMLHttpRequestEventTargetEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+ "timeout": ProgressEvent;
+}
+
interface XMLHttpRequestEventTarget {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- ontimeout: (this: this, ev: ProgressEvent) => any;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;
+ onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -20124,6 +18879,33 @@ interface ParentNode {
readonly childElementCount: number;
}
+interface DocumentOrShadowRoot {
+ readonly activeElement: Element | null;
+ readonly stylesheets: StyleSheetList;
+ getSelection(): Selection | null;
+ elementFromPoint(x: number, y: number): Element | null;
+ elementsFromPoint(x: number, y: number): Element[];
+}
+
+interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {
+ readonly host: Element;
+ innerHTML: string;
+}
+
+interface ShadowRootInit {
+ mode: 'open'|'closed';
+ delegatesFocus?: boolean;
+}
+
+interface HTMLSlotElement extends HTMLElement {
+ name: string;
+ assignedNodes(options?: AssignedNodesOptions): Node[];
+}
+
+interface AssignedNodesOptions {
+ flatten?: boolean;
+}
+
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
@@ -20171,6 +18953,447 @@ interface NavigatorUserMediaErrorCallback {
interface ForEachCallback {
(keyId: any, status: string): void;
}
+interface HTMLElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "audio": HTMLAudioElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "del": HTMLModElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "embed": HTMLEmbedElement;
+ "fieldset": HTMLFieldSetElement;
+ "font": HTMLFontElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "iframe": HTMLIFrameElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "marquee": HTMLMarqueeElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "meter": HTMLMeterElement;
+ "nextid": HTMLUnknownElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "picture": HTMLPictureElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "script": HTMLScriptElement;
+ "select": HTMLSelectElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "style": HTMLStyleElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "ul": HTMLUListElement;
+ "video": HTMLVideoElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementTagNameMap {
+ "a": HTMLAnchorElement;
+ "abbr": HTMLElement;
+ "acronym": HTMLElement;
+ "address": HTMLElement;
+ "applet": HTMLAppletElement;
+ "area": HTMLAreaElement;
+ "article": HTMLElement;
+ "aside": HTMLElement;
+ "audio": HTMLAudioElement;
+ "b": HTMLElement;
+ "base": HTMLBaseElement;
+ "basefont": HTMLBaseFontElement;
+ "bdo": HTMLElement;
+ "big": HTMLElement;
+ "blockquote": HTMLQuoteElement;
+ "body": HTMLBodyElement;
+ "br": HTMLBRElement;
+ "button": HTMLButtonElement;
+ "canvas": HTMLCanvasElement;
+ "caption": HTMLTableCaptionElement;
+ "center": HTMLElement;
+ "circle": SVGCircleElement;
+ "cite": HTMLElement;
+ "clippath": SVGClipPathElement;
+ "code": HTMLElement;
+ "col": HTMLTableColElement;
+ "colgroup": HTMLTableColElement;
+ "datalist": HTMLDataListElement;
+ "dd": HTMLElement;
+ "defs": SVGDefsElement;
+ "del": HTMLModElement;
+ "desc": SVGDescElement;
+ "dfn": HTMLElement;
+ "dir": HTMLDirectoryElement;
+ "div": HTMLDivElement;
+ "dl": HTMLDListElement;
+ "dt": HTMLElement;
+ "ellipse": SVGEllipseElement;
+ "em": HTMLElement;
+ "embed": HTMLEmbedElement;
+ "feblend": SVGFEBlendElement;
+ "fecolormatrix": SVGFEColorMatrixElement;
+ "fecomponenttransfer": SVGFEComponentTransferElement;
+ "fecomposite": SVGFECompositeElement;
+ "feconvolvematrix": SVGFEConvolveMatrixElement;
+ "fediffuselighting": SVGFEDiffuseLightingElement;
+ "fedisplacementmap": SVGFEDisplacementMapElement;
+ "fedistantlight": SVGFEDistantLightElement;
+ "feflood": SVGFEFloodElement;
+ "fefunca": SVGFEFuncAElement;
+ "fefuncb": SVGFEFuncBElement;
+ "fefuncg": SVGFEFuncGElement;
+ "fefuncr": SVGFEFuncRElement;
+ "fegaussianblur": SVGFEGaussianBlurElement;
+ "feimage": SVGFEImageElement;
+ "femerge": SVGFEMergeElement;
+ "femergenode": SVGFEMergeNodeElement;
+ "femorphology": SVGFEMorphologyElement;
+ "feoffset": SVGFEOffsetElement;
+ "fepointlight": SVGFEPointLightElement;
+ "fespecularlighting": SVGFESpecularLightingElement;
+ "fespotlight": SVGFESpotLightElement;
+ "fetile": SVGFETileElement;
+ "feturbulence": SVGFETurbulenceElement;
+ "fieldset": HTMLFieldSetElement;
+ "figcaption": HTMLElement;
+ "figure": HTMLElement;
+ "filter": SVGFilterElement;
+ "font": HTMLFontElement;
+ "footer": HTMLElement;
+ "foreignobject": SVGForeignObjectElement;
+ "form": HTMLFormElement;
+ "frame": HTMLFrameElement;
+ "frameset": HTMLFrameSetElement;
+ "g": SVGGElement;
+ "h1": HTMLHeadingElement;
+ "h2": HTMLHeadingElement;
+ "h3": HTMLHeadingElement;
+ "h4": HTMLHeadingElement;
+ "h5": HTMLHeadingElement;
+ "h6": HTMLHeadingElement;
+ "head": HTMLHeadElement;
+ "header": HTMLElement;
+ "hgroup": HTMLElement;
+ "hr": HTMLHRElement;
+ "html": HTMLHtmlElement;
+ "i": HTMLElement;
+ "iframe": HTMLIFrameElement;
+ "image": SVGImageElement;
+ "img": HTMLImageElement;
+ "input": HTMLInputElement;
+ "ins": HTMLModElement;
+ "isindex": HTMLUnknownElement;
+ "kbd": HTMLElement;
+ "keygen": HTMLElement;
+ "label": HTMLLabelElement;
+ "legend": HTMLLegendElement;
+ "li": HTMLLIElement;
+ "line": SVGLineElement;
+ "lineargradient": SVGLinearGradientElement;
+ "link": HTMLLinkElement;
+ "listing": HTMLPreElement;
+ "map": HTMLMapElement;
+ "mark": HTMLElement;
+ "marker": SVGMarkerElement;
+ "marquee": HTMLMarqueeElement;
+ "mask": SVGMaskElement;
+ "menu": HTMLMenuElement;
+ "meta": HTMLMetaElement;
+ "metadata": SVGMetadataElement;
+ "meter": HTMLMeterElement;
+ "nav": HTMLElement;
+ "nextid": HTMLUnknownElement;
+ "nobr": HTMLElement;
+ "noframes": HTMLElement;
+ "noscript": HTMLElement;
+ "object": HTMLObjectElement;
+ "ol": HTMLOListElement;
+ "optgroup": HTMLOptGroupElement;
+ "option": HTMLOptionElement;
+ "p": HTMLParagraphElement;
+ "param": HTMLParamElement;
+ "path": SVGPathElement;
+ "pattern": SVGPatternElement;
+ "picture": HTMLPictureElement;
+ "plaintext": HTMLElement;
+ "polygon": SVGPolygonElement;
+ "polyline": SVGPolylineElement;
+ "pre": HTMLPreElement;
+ "progress": HTMLProgressElement;
+ "q": HTMLQuoteElement;
+ "radialgradient": SVGRadialGradientElement;
+ "rect": SVGRectElement;
+ "rt": HTMLElement;
+ "ruby": HTMLElement;
+ "s": HTMLElement;
+ "samp": HTMLElement;
+ "script": HTMLScriptElement;
+ "section": HTMLElement;
+ "select": HTMLSelectElement;
+ "small": HTMLElement;
+ "source": HTMLSourceElement;
+ "span": HTMLSpanElement;
+ "stop": SVGStopElement;
+ "strike": HTMLElement;
+ "strong": HTMLElement;
+ "style": HTMLStyleElement;
+ "sub": HTMLElement;
+ "sup": HTMLElement;
+ "svg": SVGSVGElement;
+ "switch": SVGSwitchElement;
+ "symbol": SVGSymbolElement;
+ "table": HTMLTableElement;
+ "tbody": HTMLTableSectionElement;
+ "td": HTMLTableDataCellElement;
+ "template": HTMLTemplateElement;
+ "text": SVGTextElement;
+ "textpath": SVGTextPathElement;
+ "textarea": HTMLTextAreaElement;
+ "tfoot": HTMLTableSectionElement;
+ "th": HTMLTableHeaderCellElement;
+ "thead": HTMLTableSectionElement;
+ "title": HTMLTitleElement;
+ "tr": HTMLTableRowElement;
+ "track": HTMLTrackElement;
+ "tspan": SVGTSpanElement;
+ "tt": HTMLElement;
+ "u": HTMLElement;
+ "ul": HTMLUListElement;
+ "use": SVGUseElement;
+ "var": HTMLElement;
+ "video": HTMLVideoElement;
+ "view": SVGViewElement;
+ "wbr": HTMLElement;
+ "x-ms-webview": MSHTMLWebViewElement;
+ "xmp": HTMLPreElement;
+}
+
+interface ElementListTagNameMap {
+ "a": NodeListOf<HTMLAnchorElement>;
+ "abbr": NodeListOf<HTMLElement>;
+ "acronym": NodeListOf<HTMLElement>;
+ "address": NodeListOf<HTMLElement>;
+ "applet": NodeListOf<HTMLAppletElement>;
+ "area": NodeListOf<HTMLAreaElement>;
+ "article": NodeListOf<HTMLElement>;
+ "aside": NodeListOf<HTMLElement>;
+ "audio": NodeListOf<HTMLAudioElement>;
+ "b": NodeListOf<HTMLElement>;
+ "base": NodeListOf<HTMLBaseElement>;
+ "basefont": NodeListOf<HTMLBaseFontElement>;
+ "bdo": NodeListOf<HTMLElement>;
+ "big": NodeListOf<HTMLElement>;
+ "blockquote": NodeListOf<HTMLQuoteElement>;
+ "body": NodeListOf<HTMLBodyElement>;
+ "br": NodeListOf<HTMLBRElement>;
+ "button": NodeListOf<HTMLButtonElement>;
+ "canvas": NodeListOf<HTMLCanvasElement>;
+ "caption": NodeListOf<HTMLTableCaptionElement>;
+ "center": NodeListOf<HTMLElement>;
+ "circle": NodeListOf<SVGCircleElement>;
+ "cite": NodeListOf<HTMLElement>;
+ "clippath": NodeListOf<SVGClipPathElement>;
+ "code": NodeListOf<HTMLElement>;
+ "col": NodeListOf<HTMLTableColElement>;
+ "colgroup": NodeListOf<HTMLTableColElement>;
+ "datalist": NodeListOf<HTMLDataListElement>;
+ "dd": NodeListOf<HTMLElement>;
+ "defs": NodeListOf<SVGDefsElement>;
+ "del": NodeListOf<HTMLModElement>;
+ "desc": NodeListOf<SVGDescElement>;
+ "dfn": NodeListOf<HTMLElement>;
+ "dir": NodeListOf<HTMLDirectoryElement>;
+ "div": NodeListOf<HTMLDivElement>;
+ "dl": NodeListOf<HTMLDListElement>;
+ "dt": NodeListOf<HTMLElement>;
+ "ellipse": NodeListOf<SVGEllipseElement>;
+ "em": NodeListOf<HTMLElement>;
+ "embed": NodeListOf<HTMLEmbedElement>;
+ "feblend": NodeListOf<SVGFEBlendElement>;
+ "fecolormatrix": NodeListOf<SVGFEColorMatrixElement>;
+ "fecomponenttransfer": NodeListOf<SVGFEComponentTransferElement>;
+ "fecomposite": NodeListOf<SVGFECompositeElement>;
+ "feconvolvematrix": NodeListOf<SVGFEConvolveMatrixElement>;
+ "fediffuselighting": NodeListOf<SVGFEDiffuseLightingElement>;
+ "fedisplacementmap": NodeListOf<SVGFEDisplacementMapElement>;
+ "fedistantlight": NodeListOf<SVGFEDistantLightElement>;
+ "feflood": NodeListOf<SVGFEFloodElement>;
+ "fefunca": NodeListOf<SVGFEFuncAElement>;
+ "fefuncb": NodeListOf<SVGFEFuncBElement>;
+ "fefuncg": NodeListOf<SVGFEFuncGElement>;
+ "fefuncr": NodeListOf<SVGFEFuncRElement>;
+ "fegaussianblur": NodeListOf<SVGFEGaussianBlurElement>;
+ "feimage": NodeListOf<SVGFEImageElement>;
+ "femerge": NodeListOf<SVGFEMergeElement>;
+ "femergenode": NodeListOf<SVGFEMergeNodeElement>;
+ "femorphology": NodeListOf<SVGFEMorphologyElement>;
+ "feoffset": NodeListOf<SVGFEOffsetElement>;
+ "fepointlight": NodeListOf<SVGFEPointLightElement>;
+ "fespecularlighting": NodeListOf<SVGFESpecularLightingElement>;
+ "fespotlight": NodeListOf<SVGFESpotLightElement>;
+ "fetile": NodeListOf<SVGFETileElement>;
+ "feturbulence": NodeListOf<SVGFETurbulenceElement>;
+ "fieldset": NodeListOf<HTMLFieldSetElement>;
+ "figcaption": NodeListOf<HTMLElement>;
+ "figure": NodeListOf<HTMLElement>;
+ "filter": NodeListOf<SVGFilterElement>;
+ "font": NodeListOf<HTMLFontElement>;
+ "footer": NodeListOf<HTMLElement>;
+ "foreignobject": NodeListOf<SVGForeignObjectElement>;
+ "form": NodeListOf<HTMLFormElement>;
+ "frame": NodeListOf<HTMLFrameElement>;
+ "frameset": NodeListOf<HTMLFrameSetElement>;
+ "g": NodeListOf<SVGGElement>;
+ "h1": NodeListOf<HTMLHeadingElement>;
+ "h2": NodeListOf<HTMLHeadingElement>;
+ "h3": NodeListOf<HTMLHeadingElement>;
+ "h4": NodeListOf<HTMLHeadingElement>;
+ "h5": NodeListOf<HTMLHeadingElement>;
+ "h6": NodeListOf<HTMLHeadingElement>;
+ "head": NodeListOf<HTMLHeadElement>;
+ "header": NodeListOf<HTMLElement>;
+ "hgroup": NodeListOf<HTMLElement>;
+ "hr": NodeListOf<HTMLHRElement>;
+ "html": NodeListOf<HTMLHtmlElement>;
+ "i": NodeListOf<HTMLElement>;
+ "iframe": NodeListOf<HTMLIFrameElement>;
+ "image": NodeListOf<SVGImageElement>;
+ "img": NodeListOf<HTMLImageElement>;
+ "input": NodeListOf<HTMLInputElement>;
+ "ins": NodeListOf<HTMLModElement>;
+ "isindex": NodeListOf<HTMLUnknownElement>;
+ "kbd": NodeListOf<HTMLElement>;
+ "keygen": NodeListOf<HTMLElement>;
+ "label": NodeListOf<HTMLLabelElement>;
+ "legend": NodeListOf<HTMLLegendElement>;
+ "li": NodeListOf<HTMLLIElement>;
+ "line": NodeListOf<SVGLineElement>;
+ "lineargradient": NodeListOf<SVGLinearGradientElement>;
+ "link": NodeListOf<HTMLLinkElement>;
+ "listing": NodeListOf<HTMLPreElement>;
+ "map": NodeListOf<HTMLMapElement>;
+ "mark": NodeListOf<HTMLElement>;
+ "marker": NodeListOf<SVGMarkerElement>;
+ "marquee": NodeListOf<HTMLMarqueeElement>;
+ "mask": NodeListOf<SVGMaskElement>;
+ "menu": NodeListOf<HTMLMenuElement>;
+ "meta": NodeListOf<HTMLMetaElement>;
+ "metadata": NodeListOf<SVGMetadataElement>;
+ "meter": NodeListOf<HTMLMeterElement>;
+ "nav": NodeListOf<HTMLElement>;
+ "nextid": NodeListOf<HTMLUnknownElement>;
+ "nobr": NodeListOf<HTMLElement>;
+ "noframes": NodeListOf<HTMLElement>;
+ "noscript": NodeListOf<HTMLElement>;
+ "object": NodeListOf<HTMLObjectElement>;
+ "ol": NodeListOf<HTMLOListElement>;
+ "optgroup": NodeListOf<HTMLOptGroupElement>;
+ "option": NodeListOf<HTMLOptionElement>;
+ "p": NodeListOf<HTMLParagraphElement>;
+ "param": NodeListOf<HTMLParamElement>;
+ "path": NodeListOf<SVGPathElement>;
+ "pattern": NodeListOf<SVGPatternElement>;
+ "picture": NodeListOf<HTMLPictureElement>;
+ "plaintext": NodeListOf<HTMLElement>;
+ "polygon": NodeListOf<SVGPolygonElement>;
+ "polyline": NodeListOf<SVGPolylineElement>;
+ "pre": NodeListOf<HTMLPreElement>;
+ "progress": NodeListOf<HTMLProgressElement>;
+ "q": NodeListOf<HTMLQuoteElement>;
+ "radialgradient": NodeListOf<SVGRadialGradientElement>;
+ "rect": NodeListOf<SVGRectElement>;
+ "rt": NodeListOf<HTMLElement>;
+ "ruby": NodeListOf<HTMLElement>;
+ "s": NodeListOf<HTMLElement>;
+ "samp": NodeListOf<HTMLElement>;
+ "script": NodeListOf<HTMLScriptElement>;
+ "section": NodeListOf<HTMLElement>;
+ "select": NodeListOf<HTMLSelectElement>;
+ "small": NodeListOf<HTMLElement>;
+ "source": NodeListOf<HTMLSourceElement>;
+ "span": NodeListOf<HTMLSpanElement>;
+ "stop": NodeListOf<SVGStopElement>;
+ "strike": NodeListOf<HTMLElement>;
+ "strong": NodeListOf<HTMLElement>;
+ "style": NodeListOf<HTMLStyleElement>;
+ "sub": NodeListOf<HTMLElement>;
+ "sup": NodeListOf<HTMLElement>;
+ "svg": NodeListOf<SVGSVGElement>;
+ "switch": NodeListOf<SVGSwitchElement>;
+ "symbol": NodeListOf<SVGSymbolElement>;
+ "table": NodeListOf<HTMLTableElement>;
+ "tbody": NodeListOf<HTMLTableSectionElement>;
+ "td": NodeListOf<HTMLTableDataCellElement>;
+ "template": NodeListOf<HTMLTemplateElement>;
+ "text": NodeListOf<SVGTextElement>;
+ "textpath": NodeListOf<SVGTextPathElement>;
+ "textarea": NodeListOf<HTMLTextAreaElement>;
+ "tfoot": NodeListOf<HTMLTableSectionElement>;
+ "th": NodeListOf<HTMLTableHeaderCellElement>;
+ "thead": NodeListOf<HTMLTableSectionElement>;
+ "title": NodeListOf<HTMLTitleElement>;
+ "tr": NodeListOf<HTMLTableRowElement>;
+ "track": NodeListOf<HTMLTrackElement>;
+ "tspan": NodeListOf<SVGTSpanElement>;
+ "tt": NodeListOf<HTMLElement>;
+ "u": NodeListOf<HTMLElement>;
+ "ul": NodeListOf<HTMLUListElement>;
+ "use": NodeListOf<SVGUseElement>;
+ "var": NodeListOf<HTMLElement>;
+ "video": NodeListOf<HTMLVideoElement>;
+ "view": NodeListOf<SVGViewElement>;
+ "wbr": NodeListOf<HTMLElement>;
+ "x-ms-webview": NodeListOf<MSHTMLWebViewElement>;
+ "xmp": NodeListOf<HTMLPreElement>;
+}
+
declare var Audio: {new(src?: string): HTMLAudioElement; };
declare var Image: {new(width?: number, height?: number): HTMLImageElement; };
declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };
@@ -20345,7 +19568,6 @@ declare function scroll(options?: ScrollToOptions): void;
declare function scrollTo(options?: ScrollToOptions): void;
declare function scrollBy(options?: ScrollToOptions): void;
declare function toString(): string;
-declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function clearInterval(handle: number): void;
@@ -20372,101 +19594,7 @@ declare var onwheel: (this: Window, ev: WheelEvent) => any;
declare var indexedDB: IDBFactory;
declare function atob(encodedString: string): string;
declare function btoa(rawString: string): string;
-declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;
+declare function addEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
type AAGUID = string;
type AlgorithmIdentifier = string | Algorithm;
diff --git a/node_modules/typescript/lib/lib.webworker.d.ts b/node_modules/typescript/lib/lib.webworker.d.ts
index cef348959..97eb9814e 100644
--- a/node_modules/typescript/lib/lib.webworker.d.ts
+++ b/node_modules/typescript/lib/lib.webworker.d.ts
@@ -28,6 +28,7 @@ interface Algorithm {
}
interface EventInit {
+ scoped?: boolean;
bubbles?: boolean;
cancelable?: boolean;
}
@@ -262,10 +263,12 @@ interface Event {
readonly target: EventTarget;
readonly timeStamp: number;
readonly type: string;
+ readonly scoped: boolean;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
+ deepPath(): EventTarget[];
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
@@ -318,6 +321,7 @@ interface FileReader extends EventTarget, MSBaseReader {
readAsBinaryString(blob: Blob): void;
readAsDataURL(blob: Blob): void;
readAsText(blob: Blob, encoding?: string): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -359,11 +363,16 @@ declare var IDBCursorWithValue: {
new(): IDBCursorWithValue;
}
+interface IDBDatabaseEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+}
+
interface IDBDatabase extends EventTarget {
readonly name: string;
readonly objectStoreNames: DOMStringList;
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBDatabase, ev: Event) => any;
+ onerror: (this: IDBDatabase, ev: ErrorEvent) => any;
version: number;
onversionchange: (ev: IDBVersionChangeEvent) => any;
close(): void;
@@ -371,8 +380,7 @@ interface IDBDatabase extends EventTarget {
deleteObjectStore(name: string): void;
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -449,13 +457,15 @@ declare var IDBObjectStore: {
new(): IDBObjectStore;
}
+interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
+ "blocked": Event;
+ "upgradeneeded": IDBVersionChangeEvent;
+}
+
interface IDBOpenDBRequest extends IDBRequest {
- onblocked: (this: this, ev: Event) => any;
- onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;
- addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
+ onblocked: (this: IDBOpenDBRequest, ev: Event) => any;
+ onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;
+ addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -464,16 +474,20 @@ declare var IDBOpenDBRequest: {
new(): IDBOpenDBRequest;
}
+interface IDBRequestEventMap {
+ "error": ErrorEvent;
+ "success": Event;
+}
+
interface IDBRequest extends EventTarget {
readonly error: DOMError;
- onerror: (this: this, ev: ErrorEvent) => any;
- onsuccess: (this: this, ev: Event) => any;
+ onerror: (this: IDBRequest, ev: ErrorEvent) => any;
+ onsuccess: (this: IDBRequest, ev: Event) => any;
readonly readyState: string;
readonly result: any;
source: IDBObjectStore | IDBIndex | IDBCursor;
readonly transaction: IDBTransaction;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -482,21 +496,25 @@ declare var IDBRequest: {
new(): IDBRequest;
}
+interface IDBTransactionEventMap {
+ "abort": Event;
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface IDBTransaction extends EventTarget {
readonly db: IDBDatabase;
readonly error: DOMError;
readonly mode: string;
- onabort: (this: this, ev: Event) => any;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onabort: (this: IDBTransaction, ev: Event) => any;
+ oncomplete: (this: IDBTransaction, ev: Event) => any;
+ onerror: (this: IDBTransaction, ev: ErrorEvent) => any;
abort(): void;
objectStore(name: string): IDBObjectStore;
readonly READ_ONLY: string;
readonly READ_WRITE: string;
readonly VERSION_CHANGE: string;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -553,18 +571,22 @@ interface MSApp {
}
declare var MSApp: MSApp;
+interface MSAppAsyncOperationEventMap {
+ "complete": Event;
+ "error": ErrorEvent;
+}
+
interface MSAppAsyncOperation extends EventTarget {
readonly error: DOMError;
- oncomplete: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
+ oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;
+ onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;
readonly readyState: number;
readonly result: any;
start(): void;
readonly COMPLETED: number;
readonly ERROR: number;
readonly STARTED: number;
- addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSAppAsyncOperationEventMap>(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -604,6 +626,7 @@ interface MSStreamReader extends EventTarget, MSBaseReader {
readAsBlob(stream: MSStream, size?: number): void;
readAsDataURL(stream: MSStream, size?: number): void;
readAsText(stream: MSStream, encoding?: string, size?: number): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -647,12 +670,16 @@ declare var MessageEvent: {
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
}
+interface MessagePortEventMap {
+ "message": MessageEvent;
+}
+
interface MessagePort extends EventTarget {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: MessagePort, ev: MessageEvent) => any;
close(): void;
postMessage(message?: any, ports?: any): void;
start(): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -700,14 +727,21 @@ declare var ProgressEvent: {
new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
}
+interface WebSocketEventMap {
+ "close": CloseEvent;
+ "error": ErrorEvent;
+ "message": MessageEvent;
+ "open": Event;
+}
+
interface WebSocket extends EventTarget {
binaryType: string;
readonly bufferedAmount: number;
readonly extensions: string;
- onclose: (this: this, ev: CloseEvent) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onmessage: (this: this, ev: MessageEvent) => any;
- onopen: (this: this, ev: Event) => any;
+ onclose: (this: WebSocket, ev: CloseEvent) => any;
+ onerror: (this: WebSocket, ev: ErrorEvent) => any;
+ onmessage: (this: WebSocket, ev: MessageEvent) => any;
+ onopen: (this: WebSocket, ev: Event) => any;
readonly protocol: string;
readonly readyState: number;
readonly url: string;
@@ -717,10 +751,7 @@ interface WebSocket extends EventTarget {
readonly CLOSING: number;
readonly CONNECTING: number;
readonly OPEN: number;
- addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -733,12 +764,15 @@ declare var WebSocket: {
readonly OPEN: number;
}
+interface WorkerEventMap extends AbstractWorkerEventMap {
+ "message": MessageEvent;
+}
+
interface Worker extends EventTarget, AbstractWorker {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: Worker, ev: MessageEvent) => any;
postMessage(message: any, ports?: any): void;
terminate(): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -747,8 +781,12 @@ declare var Worker: {
new(stringUrl: string): Worker;
}
+interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
+ "readystatechange": Event;
+}
+
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
- onreadystatechange: (this: this, ev: Event) => any;
+ onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
@@ -775,14 +813,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
- addEventListener(type: "abort", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "readystatechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -798,6 +829,7 @@ declare var XMLHttpRequest: {
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -806,31 +838,39 @@ declare var XMLHttpRequestUpload: {
new(): XMLHttpRequestUpload;
}
+interface AbstractWorkerEventMap {
+ "error": ErrorEvent;
+}
+
interface AbstractWorker {
- onerror: (this: this, ev: ErrorEvent) => any;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
+ onerror: (this: AbstractWorker, ev: ErrorEvent) => any;
+ addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
+interface MSBaseReaderEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+}
+
interface MSBaseReader {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
+ onabort: (this: MSBaseReader, ev: Event) => any;
+ onerror: (this: MSBaseReader, ev: ErrorEvent) => any;
+ onload: (this: MSBaseReader, ev: Event) => any;
+ onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;
+ onloadstart: (this: MSBaseReader, ev: Event) => any;
+ onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;
readonly readyState: number;
readonly result: any;
abort(): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof MSBaseReaderEventMap>(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -858,21 +898,25 @@ interface WindowConsole {
readonly console: Console;
}
+interface XMLHttpRequestEventTargetEventMap {
+ "abort": Event;
+ "error": ErrorEvent;
+ "load": Event;
+ "loadend": ProgressEvent;
+ "loadstart": Event;
+ "progress": ProgressEvent;
+ "timeout": ProgressEvent;
+}
+
interface XMLHttpRequestEventTarget {
- onabort: (this: this, ev: Event) => any;
- onerror: (this: this, ev: ErrorEvent) => any;
- onload: (this: this, ev: Event) => any;
- onloadend: (this: this, ev: ProgressEvent) => any;
- onloadstart: (this: this, ev: Event) => any;
- onprogress: (this: this, ev: ProgressEvent) => any;
- ontimeout: (this: this, ev: ProgressEvent) => any;
- addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
- addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;
+ onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;
+ onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;
+ onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;
+ addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -888,15 +932,18 @@ declare var FileReaderSync: {
new(): FileReaderSync;
}
+interface WorkerGlobalScopeEventMap extends DedicatedWorkerGlobalScopeEventMap {
+ "error": ErrorEvent;
+}
+
interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole {
readonly location: WorkerLocation;
- onerror: (this: this, ev: ErrorEvent) => any;
+ onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any;
readonly self: WorkerGlobalScope;
close(): void;
msWriteProfilerMark(profilerMarkName: string): void;
toString(): string;
- addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -924,7 +971,6 @@ declare var WorkerLocation: {
interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine {
readonly hardwareConcurrency: number;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var WorkerNavigator: {
@@ -932,10 +978,14 @@ declare var WorkerNavigator: {
new(): WorkerNavigator;
}
+interface DedicatedWorkerGlobalScopeEventMap {
+ "message": MessageEvent;
+}
+
interface DedicatedWorkerGlobalScope {
- onmessage: (this: this, ev: MessageEvent) => any;
+ onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any;
postMessage(data: any): void;
- addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;
+ addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
@@ -1196,7 +1246,6 @@ declare var self: WorkerGlobalScope;
declare function close(): void;
declare function msWriteProfilerMark(profilerMarkName: string): void;
declare function toString(): string;
-declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare function dispatchEvent(evt: Event): boolean;
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
declare var indexedDB: IDBFactory;
@@ -1217,8 +1266,7 @@ declare function btoa(rawString: string): string;
declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any;
declare function postMessage(data: any): void;
declare var console: Console;
-declare function addEventListener(type: "error", listener: (this: WorkerGlobalScope, ev: ErrorEvent) => any, useCapture?: boolean): void;
-declare function addEventListener(type: "message", listener: (this: WorkerGlobalScope, ev: MessageEvent) => any, useCapture?: boolean): void;
+declare function addEventListener<K extends keyof WorkerGlobalScopeEventMap>(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void;
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
type AlgorithmIdentifier = string | Algorithm;
type IDBKeyPath = string;
diff --git a/node_modules/typescript/lib/protocol.d.ts b/node_modules/typescript/lib/protocol.d.ts
index f11eb83cc..c2577c247 100644
--- a/node_modules/typescript/lib/protocol.d.ts
+++ b/node_modules/typescript/lib/protocol.d.ts
@@ -680,9 +680,13 @@ declare namespace ts.server.protocol {
*/
options: ExternalProjectCompilerOptions;
/**
- * Explicitly specified typing options for the project
+ * @deprecated typingOptions. Use typeAcquisition instead
*/
- typingOptions?: TypingOptions;
+ typingOptions?: TypeAcquisition;
+ /**
+ * Explicitly specified type acquisition for the project
+ */
+ typeAcquisition?: TypeAcquisition;
}
interface CompileOnSaveMixin {
/**
@@ -1653,6 +1657,10 @@ declare namespace ts.server.protocol {
* true if install request succeeded, otherwise - false
*/
installSuccess: boolean;
+ /**
+ * version of typings installer
+ */
+ typingsInstallerVersion: string;
}
interface NavBarResponse extends Response {
body?: NavigationBarItem[];
@@ -1802,8 +1810,9 @@ declare namespace ts.server.protocol {
position: number;
}
- interface TypingOptions {
+ interface TypeAcquisition {
enableAutoDiscovery?: boolean;
+ enable?: boolean;
include?: string[];
exclude?: string[];
[option: string]: string[] | boolean | undefined;
diff --git a/node_modules/typescript/lib/tsc.js b/node_modules/typescript/lib/tsc.js
index 9fb150670..e08661bd1 100644
--- a/node_modules/typescript/lib/tsc.js
+++ b/node_modules/typescript/lib/tsc.js
@@ -132,6 +132,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+(function (ts) {
var createObject = Object.create;
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
@@ -601,7 +604,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -616,6 +619,14 @@ var ts;
return to;
}
ts.addRange = addRange;
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; })
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
+ .map(function (i) { return array[i]; });
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -770,6 +781,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -1222,6 +1242,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
@@ -1772,6 +1800,16 @@ var ts;
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
function orderedRemoveItemAt(array, index) {
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
@@ -2806,7 +2844,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -2871,7 +2909,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2942,6 +2981,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -3156,9 +3196,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -3170,6 +3210,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
var ts;
@@ -4906,28 +4949,28 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
if (nodeIsMissing(node)) {
return node.pos;
}
if (isJSDocNode(node)) {
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
}
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
+ if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
+ return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 291 && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ if (node.kind === 292 && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 262 && node.kind <= 287;
+ return node.kind >= 262 && node.kind <= 288;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 278 && node.kind <= 290;
+ return node.kind >= 278 && node.kind <= 291;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -5104,7 +5147,7 @@ var ts;
case 8:
return name.text;
case 142:
- if (isStringOrNumericLiteral(name.expression.kind)) {
+ if (isStringOrNumericLiteral(name.expression)) {
return name.expression.text;
}
}
@@ -5226,7 +5269,8 @@ var ts;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 207 && node.expression.kind === 9;
+ return node.kind === 207
+ && node.expression.kind === 9;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -5237,25 +5281,20 @@ var ts;
return ts.getLeadingCommentRanges(text, node.pos);
}
ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
- }
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
+ function getJSDocCommentRanges(node, text) {
var commentRanges = (node.kind === 144 ||
node.kind === 143 ||
node.kind === 184 ||
node.kind === 185) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
+ return ts.filter(commentRanges, function (comment) {
return text.charCodeAt(comment.pos + 1) === 42 &&
text.charCodeAt(comment.pos + 2) === 42 &&
text.charCodeAt(comment.pos + 3) !== 47;
- }
+ });
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.getJSDocCommentRanges = getJSDocCommentRanges;
ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
@@ -5781,6 +5820,7 @@ var ts;
case 145:
case 252:
case 251:
+ case 259:
return true;
case 199:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
@@ -5935,152 +5975,118 @@ var ts;
node.parameters[0].type.kind === 276;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ function getCommentsFromJSDoc(node) {
+ return ts.map(getJSDocs(node), function (doc) { return doc.comment; });
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
- }
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
- }
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ ts.getCommentsFromJSDoc = getCommentsFromJSDoc;
+ function getJSDocTags(node, kind) {
+ var docs = getJSDocs(node);
+ if (docs) {
var result = [];
for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
+ if (doc.kind === 281) {
+ if (doc.kind === kind) {
+ result.push(doc);
+ }
+ }
+ else {
+ result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));
}
}
return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- var result = undefined;
- if (checkParentVariableStatement) {
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 205;
+ }
+ }
+ function getFirstJSDocTag(node, kind) {
+ return node && ts.firstOrUndefined(getJSDocTags(node, kind));
+ }
+ function getJSDocs(node) {
+ var cache = node.jsDocCache;
+ if (!cache) {
+ getJSDocsWorker(node);
+ node.jsDocCache = cache;
+ }
+ return cache;
+ function getJSDocsWorker(node) {
+ var parent = node.parent;
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&
+ parent.initializer === node &&
+ parent.parent.parent.kind === 205;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 205;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ parent.parent.kind === 205;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? parent.parent :
undefined;
if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 230 &&
- node.parent && node.parent.kind === 230) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(variableStatementNode);
}
- var parent_4 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 192 &&
- parent_4.operatorToken.kind === 57 &&
- parent_4.parent.kind === 207;
+ var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&
+ parent.kind === 192 &&
+ parent.operatorToken.kind === 57 &&
+ parent.parent.kind === 207;
if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(parent.parent);
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
+ var isModuleDeclaration = node.kind === 230 &&
+ parent && parent.kind === 230;
+ var isPropertyAssignmentExpression = parent && parent.kind === 257;
+ if (isModuleDeclaration || isPropertyAssignmentExpression) {
+ getJSDocsWorker(parent);
}
if (node.kind === 144) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
+ cache = ts.concatenate(cache, getJSDocParameterTags(node));
}
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
- }
- else {
- return getDocs(node.jsDocComments);
+ if (isVariableLike(node) && node.initializer) {
+ cache = ts.concatenate(cache, node.initializer.jsDoc);
}
+ cache = ts.concatenate(cache, node.jsDoc);
}
- return result;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
+ function getJSDocParameterTags(param) {
+ if (!isParameter(param)) {
+ return undefined;
+ }
var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
+ var tags = getJSDocTags(func, 281);
if (!param.name) {
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70) {
var name_6 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_6; });
- if (paramTags) {
- return paramTags;
- }
+ return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_6; });
}
else {
return undefined;
}
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 282, false);
+ ts.getJSDocParameterTags = getJSDocParameterTags;
+ function getJSDocType(node) {
+ var tag = getFirstJSDocTag(node, 283);
+ if (!tag && node.kind === 144) {
+ var paramTags = getJSDocParameterTags(node);
+ if (paramTags) {
+ tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });
+ }
+ }
+ return tag && tag.typeExpression && tag.typeExpression.type;
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
+ ts.getJSDocType = getJSDocType;
+ function getJSDocAugmentsTag(node) {
+ return getFirstJSDocTag(node, 280);
+ }
+ ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 281, true);
+ return getFirstJSDocTag(node, 282);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 283, false);
+ return getFirstJSDocTag(node, 284);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 70) {
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 280) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
- }
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
function hasRestParameter(s) {
return isRestParameter(ts.lastOrUndefined(s.parameters));
}
@@ -6091,13 +6097,10 @@ var ts;
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
if (node && (node.flags & 2097152)) {
- if (node.type && node.type.kind === 275) {
+ if (node.type && node.type.kind === 275 ||
+ ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) {
return true;
}
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 275;
- }
}
return isDeclaredRestParam(node);
}
@@ -6320,8 +6323,10 @@ var ts;
return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);
}
ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 || kind === 8;
+ function isStringOrNumericLiteral(node) {
+ var kind = node.kind;
+ return kind === 9
+ || kind === 8;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
function hasDynamicName(declaration) {
@@ -6330,7 +6335,7 @@ var ts;
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
return name.kind === 142 &&
- !isStringOrNumericLiteral(name.expression.kind) &&
+ !isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
@@ -6536,6 +6541,7 @@ var ts;
case 194:
case 183:
case 198:
+ case 297:
return 19;
case 181:
case 177:
@@ -7297,19 +7303,19 @@ var ts;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isAssignmentExpression(node) {
+ function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node)
- && isAssignmentOperator(node.operatorToken.kind)
+ && (excludeCompoundAssignment
+ ? node.operatorToken.kind === 57
+ : isAssignmentOperator(node.operatorToken.kind))
&& isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 57) {
- var kind = node.left.kind;
- return kind === 176
- || kind === 175;
- }
+ if (isAssignmentExpression(node, true)) {
+ var kind = node.left.kind;
+ return kind === 176
+ || kind === 175;
}
return false;
}
@@ -7620,122 +7626,6 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportedBindings = ts.createMap();
- var uniqueExports = ts.createMap();
- var hasExportDefault = false;
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 235:
- externalImports.push(node);
- break;
- case 234:
- if (node.moduleReference.kind === 245) {
- externalImports.push(node);
- }
- break;
- case 241:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- else {
- externalImports.push(node);
- }
- }
- else {
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- if (!uniqueExports[specifier.name.text]) {
- var name_8 = specifier.propertyName || specifier.name;
- ts.multiMapAdd(exportSpecifiers, name_8.text, specifier);
- var decl = resolver.getReferencedImportDeclaration(name_8)
- || resolver.getReferencedValueDeclaration(name_8);
- if (decl) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
- }
- uniqueExports[specifier.name.text] = specifier.name;
- }
- }
- }
- break;
- case 240:
- if (node.isExportEquals && !exportEquals) {
- exportEquals = node;
- }
- break;
- case 205:
- if (hasModifier(node, 1)) {
- for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
- var decl = _e[_d];
- collectExportedVariableInfo(decl, uniqueExports);
- }
- }
- break;
- case 225:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_9 = node.name;
- if (!uniqueExports[name_9.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9);
- uniqueExports[name_9.text] = name_9;
- }
- }
- }
- break;
- case 226:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_10 = node.name;
- if (!uniqueExports[name_10.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10);
- uniqueExports[name_10.text] = name_10;
- }
- }
- }
- break;
- }
- }
- var exportedNames;
- for (var key in uniqueExports) {
- exportedNames = ts.append(exportedNames, uniqueExports[key]);
- }
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
- }
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function collectExportedVariableInfo(decl, uniqueExports) {
- if (isBindingPattern(decl.name)) {
- for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!isOmittedExpression(element)) {
- collectExportedVariableInfo(element, uniqueExports);
- }
- }
- }
- else if (!isGeneratedIdentifier(decl.name)) {
- if (!uniqueExports[decl.name.text]) {
- uniqueExports[decl.name.text] = decl.name;
- }
- }
- }
function isDeclarationNameOfEnumOrNamespace(node) {
var parseNode = getParseTreeNode(node);
if (parseNode) {
@@ -7906,6 +7796,14 @@ var ts;
return isTypeNodeKind(node.kind);
}
ts.isTypeNode = isTypeNode;
+ function isArrayBindingPattern(node) {
+ return node.kind === 173;
+ }
+ ts.isArrayBindingPattern = isArrayBindingPattern;
+ function isObjectBindingPattern(node) {
+ return node.kind === 172;
+ }
+ ts.isObjectBindingPattern = isObjectBindingPattern;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
@@ -7915,6 +7813,12 @@ var ts;
return false;
}
ts.isBindingPattern = isBindingPattern;
+ function isAssignmentPattern(node) {
+ var kind = node.kind;
+ return kind === 175
+ || kind === 176;
+ }
+ ts.isAssignmentPattern = isAssignmentPattern;
function isBindingElement(node) {
return node.kind === 174;
}
@@ -7925,6 +7829,39 @@ var ts;
|| kind === 198;
}
ts.isArrayBindingElement = isArrayBindingElement;
+ function isDeclarationBindingElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 223:
+ case 144:
+ case 174:
+ return true;
+ }
+ return false;
+ }
+ ts.isDeclarationBindingElement = isDeclarationBindingElement;
+ function isBindingOrAssignmentPattern(node) {
+ return isObjectBindingOrAssignmentPattern(node)
+ || isArrayBindingOrAssignmentPattern(node);
+ }
+ ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
+ function isObjectBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 172:
+ case 176:
+ return true;
+ }
+ return false;
+ }
+ ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
+ function isArrayBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return true;
+ }
+ return false;
+ }
+ ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
function isArrayLiteralExpression(node) {
return node.kind === 175;
}
@@ -7991,7 +7928,8 @@ var ts;
|| kind === 98
|| kind === 100
|| kind === 96
- || kind === 201;
+ || kind === 201
+ || kind === 297;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
@@ -8019,6 +7957,7 @@ var ts;
|| kind === 196
|| kind === 200
|| kind === 198
+ || kind === 297
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -8032,11 +7971,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 293;
+ return node.kind === 294;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 292;
+ return node.kind === 293;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -8148,7 +8087,7 @@ var ts;
|| kind === 228
|| kind === 143
|| kind === 223
- || kind === 284;
+ || kind === 285;
}
function isDeclarationStatementKind(kind) {
return kind === 225
@@ -8183,9 +8122,9 @@ var ts;
|| kind === 205
|| kind === 210
|| kind === 217
- || kind === 292
- || kind === 295
- || kind === 294;
+ || kind === 293
+ || kind === 296
+ || kind === 295;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -8473,6 +8412,53 @@ var ts;
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
+ function validateLocaleAndSetLanguage(locale, sys, errors) {
+ var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
+ if (!matchResult) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
+ }
+ return;
+ }
+ var language = matchResult[1];
+ var territory = matchResult[3];
+ if (!trySetLanguageAndTerritory(language, territory, errors)) {
+ trySetLanguageAndTerritory(language, undefined, errors);
+ }
+ function trySetLanguageAndTerritory(language, territory, errors) {
+ var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
+ var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
+ var filePath = ts.combinePaths(containingDirectoryPath, language);
+ if (territory) {
+ filePath = filePath + "-" + territory;
+ }
+ filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
+ if (!sys.fileExists(filePath)) {
+ return false;
+ }
+ var fileContents = "";
+ try {
+ fileContents = sys.readFile(filePath);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
+ }
+ return false;
+ }
+ try {
+ ts.localizedDiagnosticMessages = JSON.parse(fileContents);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -8673,9 +8659,9 @@ var ts;
return node;
}
ts.createParameter = createParameter;
- function updateParameter(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
+ function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
}
return node;
}
@@ -8808,9 +8794,9 @@ var ts;
return node;
}
ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);
}
return node;
}
@@ -8850,7 +8836,7 @@ var ts;
function createPropertyAccess(expression, name, location, flags) {
var node = createNode(177, location, flags);
node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576;
+ (node.emitNode || (node.emitNode = {})).flags |= 65536;
node.name = typeof name === "string" ? createIdentifier(name) : name;
return node;
}
@@ -9071,13 +9057,21 @@ var ts;
return node;
}
ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(193, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
+ function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {
+ var node = createNode(193, whenFalse ? location : colonTokenOrLocation);
+ node.condition = parenthesizeForConditionalHead(condition);
+ if (whenFalse) {
+ node.questionToken = questionTokenOrWhenTrue;
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ node.colonToken = colonTokenOrLocation;
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);
+ }
+ else {
+ node.questionToken = createToken(54);
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);
+ node.colonToken = createToken(55);
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ }
return node;
}
ts.createConditional = createConditional;
@@ -9887,35 +9881,33 @@ var ts;
updated.imports = node.imports;
if (node.moduleAugmentations !== undefined)
updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
return updateNode(updated, node);
}
return node;
}
ts.updateSourceFileNode = updateSourceFileNode;
function createNotEmittedStatement(original) {
- var node = createNode(292, original);
+ var node = createNode(293, original);
node.original = original;
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createNode(295);
+ var node = createNode(296);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createNode(294);
+ var node = createNode(295);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(293, location || original);
+ var node = createNode(294, location || original);
node.expression = expression;
node.original = original;
return node;
@@ -9928,6 +9920,12 @@ var ts;
return node;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ function createRawExpression(text) {
+ var node = createNode(297);
+ node.text = text;
+ return node;
+ }
+ ts.createRawExpression = createRawExpression;
function createComma(left, right) {
return createBinary(left, 25, right);
}
@@ -9976,13 +9974,19 @@ var ts;
return createVoid(createLiteral(0));
}
ts.createVoidZero = createVoidZero;
+ function createTypeCheck(value, tag) {
+ return tag === "undefined"
+ ? createStrictEquality(value, createVoidZero())
+ : createStrictEquality(createTypeOf(value), createLiteral(tag));
+ }
+ ts.createTypeCheck = createTypeCheck;
function createMemberAccessForPropertyName(target, memberName, location) {
if (ts.isComputedPropertyName(memberName)) {
return createElementAccess(target, memberName.expression, location);
}
else {
var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048;
+ (expression.emitNode || (expression.emitNode = {})).flags |= 64;
return expression;
}
}
@@ -10024,7 +10028,10 @@ var ts;
}
function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
if (ts.isQualifiedName(jsxFactory)) {
- return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536));
+ var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);
+ var right = createSynthesizedNode(70);
+ right.text = jsxFactory.right.text;
+ return createPropertyAccess(left, right);
}
else {
return createReactNamespace(jsxFactory.text, parent);
@@ -10078,114 +10085,10 @@ var ts;
return createVariableDeclarationList(declarations, location, 2);
}
ts.createConstDeclarationList = createConstDeclarationList;
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [
- name,
- createIdentifier("_super")
- ]);
+ function getHelperName(name) {
+ return setEmitFlags(createIdentifier(name), 4096 | 2);
}
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
- }
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location);
- }
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body);
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
- }
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]);
- }
- function createGeti(target) {
- return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- return createArrowFunction(undefined, undefined, [
- createParameter(undefined, undefined, undefined, "name"),
- createParameter(undefined, undefined, undefined, "value")
- ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- var createCache = createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("cache", undefined, createObjectCreate(createNull()))
- ]));
- var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")]))
- ]));
- var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([
- createStatement(createCall(createIdentifier("seti"), undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [
- createParameter(undefined, undefined, undefined, "geti"),
- createParameter(undefined, undefined, undefined, "seti")
- ], undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))), undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ ts.getHelperName = getHelperName;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
@@ -10331,19 +10234,19 @@ var ts;
return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
}
function getLocalName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 262144);
+ return getName(node, allowComments, allowSourceMaps, 16384);
}
ts.getLocalName = getLocalName;
function isLocalName(node) {
- return (getEmitFlags(node) & 262144) !== 0;
+ return (getEmitFlags(node) & 16384) !== 0;
}
ts.isLocalName = isLocalName;
function getExportName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 131072);
+ return getName(node, allowComments, allowSourceMaps, 8192);
}
ts.getExportName = getExportName;
function isExportName(node) {
- return (getEmitFlags(node) & 131072) !== 0;
+ return (getEmitFlags(node) & 8192) !== 0;
}
ts.isExportName = isExportName;
function getDeclarationName(node, allowComments, allowSourceMaps) {
@@ -10352,15 +10255,15 @@ var ts;
ts.getDeclarationName = getDeclarationName;
function getName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
- var name_11 = getMutableClone(node.name);
+ var name_8 = getMutableClone(node.name);
emitFlags |= getEmitFlags(node.name);
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
- setEmitFlags(name_11, emitFlags);
- return name_11;
+ setEmitFlags(name_8, emitFlags);
+ return name_8;
}
return getGeneratedNameForNode(node);
}
@@ -10375,14 +10278,18 @@ var ts;
var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name);
var emitFlags;
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
setEmitFlags(qualifiedName, emitFlags);
return qualifiedName;
}
ts.getNamespaceMemberName = getNamespaceMemberName;
+ function convertToFunctionBody(node, multiLine) {
+ return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine);
+ }
+ ts.convertToFunctionBody = convertToFunctionBody;
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
@@ -10409,7 +10316,7 @@ var ts;
}
while (statementOffset < numStatements) {
var statement = source[statementOffset];
- if (getEmitFlags(statement) & 8388608) {
+ if (getEmitFlags(statement) & 524288) {
target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
}
else {
@@ -10420,10 +10327,17 @@ var ts;
return statementOffset;
}
ts.addPrologueDirectives = addPrologueDirectives;
- function ensureUseStrict(node) {
+ function startsWithUseStrict(statements) {
+ var firstStatement = ts.firstOrUndefined(statements);
+ return firstStatement !== undefined
+ && ts.isPrologueDirective(firstStatement)
+ && isUseStrictPrologue(firstStatement);
+ }
+ ts.startsWithUseStrict = startsWithUseStrict;
+ function ensureUseStrict(statements) {
var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
if (ts.isPrologueDirective(statement)) {
if (isUseStrictPrologue(statement)) {
foundUseStrict = true;
@@ -10435,11 +10349,11 @@ var ts;
}
}
if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- return updateSourceFileNode(node, statements.concat(node.statements));
+ return createNodeArray([
+ startOnNewLine(createStatement(createLiteral("use strict")))
+ ].concat(statements), statements);
}
- return node;
+ return statements;
}
ts.ensureUseStrict = ensureUseStrict;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
@@ -10514,6 +10428,21 @@ var ts;
}
return 0;
}
+ function parenthesizeForConditionalHead(condition) {
+ var conditionalPrecedence = ts.getOperatorPrecedence(193, 54);
+ var emittedCondition = skipPartiallyEmittedExpressions(condition);
+ var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
+ if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {
+ return createParen(condition);
+ }
+ return condition;
+ }
+ ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;
+ function parenthesizeSubexpressionOfConditionalExpression(e) {
+ return e.kind === 192 && e.operatorToken.kind === 25
+ ? createParen(e)
+ : e;
+ }
function parenthesizeForNew(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
switch (emittedExpression.kind) {
@@ -10619,7 +10548,7 @@ var ts;
case 177:
node = node.expression;
continue;
- case 293:
+ case 294:
node = node.expression;
continue;
}
@@ -10667,7 +10596,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 293) {
+ while (node.kind === 294) {
node = node.expression;
}
return node;
@@ -10689,8 +10618,8 @@ var ts;
}
ts.setOriginalNode = setOriginalNode;
function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;
+ if (!destEmitNode)
destEmitNode = {};
if (flags)
destEmitNode.flags = flags;
@@ -10700,6 +10629,10 @@ var ts;
destEmitNode.sourceMapRange = sourceMapRange;
if (tokenSourceMapRanges)
destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ if (constantValue !== undefined)
+ destEmitNode.constantValue = constantValue;
+ if (helpers)
+ destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);
return destEmitNode;
}
function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
@@ -10733,6 +10666,7 @@ var ts;
}
return node.emitNode;
}
+ ts.getOrCreateEmitNode = getOrCreateEmitNode;
function getEmitFlags(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.flags;
@@ -10743,11 +10677,22 @@ var ts;
return node;
}
ts.setEmitFlags = setEmitFlags;
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
+ }
+ ts.getSourceMapRange = getSourceMapRange;
function setSourceMapRange(node, range) {
getOrCreateEmitNode(node).sourceMapRange = range;
return node;
}
ts.setSourceMapRange = setSourceMapRange;
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ }
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
function setTokenSourceMapRange(node, token, range) {
var emitNode = getOrCreateEmitNode(node);
var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());
@@ -10755,27 +10700,16 @@ var ts;
return node;
}
ts.setTokenSourceMapRange = setTokenSourceMapRange;
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
function getCommentRange(node) {
var emitNode = node.emitNode;
return (emitNode && emitNode.commentRange) || node;
}
ts.getCommentRange = getCommentRange;
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
+ return node;
}
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ ts.setCommentRange = setCommentRange;
function getConstantValue(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.constantValue;
@@ -10787,6 +10721,103 @@ var ts;
return node;
}
ts.setConstantValue = setConstantValue;
+ function getExternalHelpersModuleName(node) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return emitNode && emitNode.externalHelpersModuleName;
+ }
+ ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {
+ if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
+ var externalHelpersModuleName = getExternalHelpersModuleName(node);
+ if (externalHelpersModuleName) {
+ return externalHelpersModuleName;
+ }
+ var helpers = getEmitHelpers(node);
+ if (helpers) {
+ for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
+ var helper = helpers_1[_i];
+ if (!helper.scoped) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = getOrCreateEmitNode(parseNode);
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));
+ }
+ }
+ }
+ }
+ }
+ ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
+ function addEmitHelper(node, helper) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ return node;
+ }
+ ts.addEmitHelper = addEmitHelper;
+ function addEmitHelpers(node, helpers) {
+ if (ts.some(helpers)) {
+ var emitNode = getOrCreateEmitNode(node);
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!ts.contains(emitNode.helpers, helper)) {
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ }
+ }
+ }
+ return node;
+ }
+ ts.addEmitHelpers = addEmitHelpers;
+ function removeEmitHelper(node, helper) {
+ var emitNode = node.emitNode;
+ if (emitNode) {
+ var helpers = emitNode.helpers;
+ if (helpers) {
+ return ts.orderedRemoveItem(helpers, helper);
+ }
+ }
+ return false;
+ }
+ ts.removeEmitHelper = removeEmitHelper;
+ function getEmitHelpers(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.helpers;
+ }
+ ts.getEmitHelpers = getEmitHelpers;
+ function moveEmitHelpers(source, target, predicate) {
+ var sourceEmitNode = source.emitNode;
+ var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
+ if (!ts.some(sourceEmitHelpers))
+ return;
+ var targetEmitNode = getOrCreateEmitNode(target);
+ var helpersRemoved = 0;
+ for (var i = 0; i < sourceEmitHelpers.length; i++) {
+ var helper = sourceEmitHelpers[i];
+ if (predicate(helper)) {
+ helpersRemoved++;
+ if (!ts.contains(targetEmitNode.helpers, helper)) {
+ targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);
+ }
+ }
+ else if (helpersRemoved > 0) {
+ sourceEmitHelpers[i - helpersRemoved] = helper;
+ }
+ }
+ if (helpersRemoved > 0) {
+ sourceEmitHelpers.length -= helpersRemoved;
+ }
+ }
+ ts.moveEmitHelpers = moveEmitHelpers;
+ function compareEmitHelpers(x, y) {
+ if (x === y)
+ return 0;
+ if (x.priority === y.priority)
+ return 0;
+ if (x.priority === undefined)
+ return 1;
+ if (y.priority === undefined)
+ return -1;
+ return ts.compareValues(x.priority, y.priority);
+ }
+ ts.compareEmitHelpers = compareEmitHelpers;
function setTextRange(node, location) {
if (location) {
node.pos = location.pos;
@@ -10813,8 +10844,8 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_12 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_9 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
if (node.kind === 235 && node.importClause) {
return getGeneratedNameForNode(node);
@@ -10857,221 +10888,291 @@ var ts;
function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
- function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
- var multiLine = false;
- var singleLine = false;
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- context.startLexicalEnvironment();
- if (ts.isBlock(body)) {
- statementOffset = addPrologueDirectives(statements, body.statements, false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
- addRestParameterIfNeeded(statements, node, false);
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
+ function getInitializerOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.initializer;
}
- else {
- ts.Debug.assert(node.kind === 185);
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = createReturn(expression, body);
- setEmitFlags(returnStatement, 12288 | 1024 | 32768);
- statements.push(returnStatement);
- closeBraceLocation = body;
+ if (ts.isPropertyAssignment(bindingElement)) {
+ return ts.isAssignmentExpression(bindingElement.initializer, true)
+ ? bindingElement.initializer.right
+ : undefined;
}
- var lexicalEnvironment = context.endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
+ if (ts.isShorthandPropertyAssignment(bindingElement)) {
+ return bindingElement.objectAssignmentInitializer;
}
- var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- setEmitFlags(block, 32);
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return bindingElement.right;
}
- if (closeBraceLocation) {
- setTokenSourceMapRange(block, 17, closeBraceLocation);
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
}
- setOriginalNode(block, node.body);
- return block;
}
- ts.transformFunctionBody = transformFunctionBody;
- function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
- if (node.transformFlags & 524288 && node.kind !== 185) {
- captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
+ ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
+ function getTargetOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.name;
}
+ if (ts.isObjectLiteralElementLike(bindingElement)) {
+ switch (bindingElement.kind) {
+ case 257:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
+ case 258:
+ return bindingElement.name;
+ case 259:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return undefined;
+ }
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.left);
+ }
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return bindingElement;
}
- ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
- function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration("_this", undefined, initializer)
- ]), originalStatement);
- setEmitFlags(captureThisStatement, 49152 | 8388608);
- setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
+ ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 144:
+ case 174:
+ return bindingElement.dotDotDotToken;
+ case 196:
+ case 259:
+ return bindingElement;
+ }
+ return undefined;
}
- ts.captureThisForNode = captureThisForNode;
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 2097152) !== 0;
+ ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 174:
+ if (bindingElement.propertyName) {
+ var propertyName = bindingElement.propertyName;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 257:
+ if (bindingElement.name) {
+ var propertyName = bindingElement.name;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 259:
+ return bindingElement.name;
+ }
+ var target = getTargetOfBindingOrAssignmentElement(bindingElement);
+ if (target && ts.isPropertyName(target)) {
+ return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)
+ ? target.expression
+ : target;
+ }
+ ts.Debug.fail("Invalid property name for binding element.");
}
- function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
+ function getElementsOfBindingOrAssignmentPattern(name) {
+ switch (name.kind) {
+ case 172:
+ case 173:
+ case 175:
+ return name.elements;
+ case 176:
+ return name.properties;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- if (dotDotDotToken) {
- continue;
+ }
+ ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
+ function convertToArrayAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpread(element.name, element), element);
}
- if (ts.isBindingPattern(name_13)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest);
+ var expression = convertToAssignmentElementTarget(element.name);
+ return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;
+ }
+ ts.Debug.assertNode(element, ts.isExpression);
+ return element;
+ }
+ ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;
+ function convertToObjectAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpreadAssignment(element.name, element), element);
}
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor);
+ if (element.propertyName) {
+ var expression = convertToAssignmentElementTarget(element.name);
+ return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);
}
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);
}
+ ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);
+ return element;
}
- ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
- var temp = getGeneratedNameForNode(parameter);
- if (name.elements.length > 0) {
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608));
+ ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
+ function convertToAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return convertToArrayAssignmentPattern(node);
+ case 172:
+ case 176:
+ return convertToObjectAssignmentPattern(node);
}
- else if (initializer) {
- statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
+ }
+ ts.convertToAssignmentPattern = convertToAssignmentPattern;
+ function convertToObjectAssignmentPattern(node) {
+ if (ts.isObjectBindingPattern(node)) {
+ return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);
}
+ ts.Debug.assertNode(node, ts.isObjectLiteralExpression);
+ return node;
}
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
- createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter))
- ], parameter), 32 | 1024 | 12288), undefined, parameter);
- statement.startsOnNewLine = true;
- setEmitFlags(statement, 12288 | 1024 | 8388608);
- statements.push(statement);
+ ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;
+ function convertToArrayAssignmentPattern(node) {
+ if (ts.isArrayBindingPattern(node)) {
+ return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);
+ }
+ ts.Debug.assertNode(node, ts.isArrayLiteralExpression);
+ return node;
}
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;
+ function convertToAssignmentElementTarget(node) {
+ if (ts.isBindingPattern(node)) {
+ return convertToAssignmentPattern(node);
+ }
+ ts.Debug.assertNode(node, ts.isExpression);
+ return node;
}
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;
+ function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var exportedNames;
+ var hasExportDefault = false;
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);
+ var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));
+ if (externalHelpersImportDeclaration) {
+ externalImports.push(externalHelpersImportDeclaration);
}
- var declarationName = getMutableClone(parameter.name);
- setEmitFlags(declarationName, 1536);
- var expressionName = getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = createLoopVariable();
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration(declarationName, undefined, createArrayLiteral([]))
- ]), parameter), 8388608));
- var forStatement = createFor(createVariableDeclarationList([
- createVariableDeclaration(temp, undefined, createLiteral(restIndex))
- ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([
- startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter))
- ]));
- setEmitFlags(forStatement, 8388608);
- startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
- function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- var counter = convertObjectRest ? undefined : createLoopVariable();
- var rhsReference = expression.kind === 70
- ? createUniqueName(expression.text)
- : createTempVariable(undefined);
- var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest);
- var declarationList = createVariableDeclarationList(declarations, initializer);
- setOriginalNode(declarationList, initializer);
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(createVariableStatement(undefined, declarationList));
- }
- else {
- statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([
- createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter))
- ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 235:
+ externalImports.push(node);
+ break;
+ case 234:
+ if (node.moduleReference.kind === 245) {
+ externalImports.push(node);
+ }
+ break;
+ case 241:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ externalImports.push(node);
+ }
+ }
+ else {
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ if (!uniqueExports[specifier.name.text]) {
+ var name_10 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_10)
+ || resolver.getReferencedValueDeclaration(name_10);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = true;
+ exportedNames = ts.append(exportedNames, specifier.name);
+ }
+ }
+ }
+ break;
+ case 240:
+ if (node.isExportEquals && !exportEquals) {
+ exportEquals = node;
+ }
+ break;
+ case 205:
+ if (ts.hasModifier(node, 1)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
+ }
+ }
+ break;
+ case 225:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_11 = node.name;
+ if (!uniqueExports[name_11.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11);
+ uniqueExports[name_11.text] = true;
+ exportedNames = ts.append(exportedNames, name_11);
+ }
+ }
+ }
+ break;
+ case 226:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_12 = node.name;
+ if (!uniqueExports[name_12.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12);
+ uniqueExports[name_12.text] = true;
+ exportedNames = ts.append(exportedNames, name_12);
+ }
+ }
+ }
+ break;
}
}
- else {
- var assignment = createAssignment(initializer, elementAccess);
- if (ts.isDestructuringAssignment(assignment)) {
- statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
- }
- else {
- assignment.end = initializer.end;
- statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
+ }
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
+ }
}
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
- }
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = true;
+ exportedNames = ts.append(exportedNames, decl.name);
}
}
- setEmitFlags(expression, 1536 | getEmitFlags(expression));
- var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation);
- setEmitFlags(body, 1536 | 12288);
- var forStatement;
- if (convertObjectRest) {
- forStatement = createForOf(createVariableDeclarationList([
- createVariableDeclaration(rhsReference, undefined, undefined, node.expression)
- ], node.expression), node.expression, body, node);
- }
- else {
- forStatement = createFor(setEmitFlags(createVariableDeclarationList([
- createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)),
- createVariableDeclaration(rhsReference, undefined, expression, node.expression)
- ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node);
- }
- setEmitFlags(forStatement, 8192);
- return forStatement;
+ return exportedNames;
}
- ts.convertForOf = convertForOf;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -11469,29 +11570,31 @@ var ts;
visitNode(cbNode, node.type);
case 278:
return visitNodes(cbNodes, node.tags);
- case 280:
+ case 281:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 281:
- return visitNode(cbNode, node.typeExpression);
case 282:
return visitNode(cbNode, node.typeExpression);
case 283:
- return visitNodes(cbNodes, node.typeParameters);
+ return visitNode(cbNode, node.typeExpression);
+ case 280:
+ return visitNode(cbNode, node.typeExpression);
case 284:
+ return visitNodes(cbNodes, node.typeParameters);
+ case 285:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 286:
+ case 287:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 285:
+ case 286:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 293:
+ case 294:
return visitNode(cbNode, node.expression);
- case 287:
+ case 288:
return visitNode(cbNode, node.literal);
}
}
@@ -11615,7 +11718,7 @@ var ts;
return sourceFile;
}
function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ var comments = ts.getJSDocCommentRanges(node, sourceFile.text);
if (comments) {
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var comment = comments_2[_i];
@@ -11623,10 +11726,10 @@ var ts;
if (!jsDoc) {
continue;
}
- if (!node.jsDocComments) {
- node.jsDocComments = [];
+ if (!node.jsDoc) {
+ node.jsDoc = [];
}
- node.jsDocComments.push(jsDoc);
+ node.jsDoc.push(jsDoc);
}
}
return node;
@@ -11641,12 +11744,12 @@ var ts;
var saveParent = parent;
parent = n;
forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
+ if (n.jsDoc) {
+ for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ jsDoc.parent = n;
+ parent = jsDoc;
+ forEachChild(jsDoc, visitNode);
}
}
parent = saveParent;
@@ -14823,8 +14926,8 @@ var ts;
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators || modifiers) {
- var name_14 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, undefined);
+ var name_13 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined);
}
ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
@@ -15471,7 +15574,7 @@ var ts;
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(287);
+ var result = createNode(288);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -15651,6 +15754,9 @@ var ts;
var tag;
if (tagName) {
switch (tagName.text) {
+ case "augments":
+ tag = parseAugmentsTag(atToken, tagName);
+ break;
case "param":
tag = parseParamTag(atToken, tagName);
break;
@@ -15790,7 +15896,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(280, atToken.pos);
+ var result = createNode(281, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -15801,20 +15907,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 281; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(281, atToken.pos);
+ var result = createNode(282, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(282, atToken.pos);
+ var result = createNode(283, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -15829,17 +15935,25 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(285, atToken.pos);
+ var result = createNode(286, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
return finishNode(result);
}
+ function parseAugmentsTag(atToken, tagName) {
+ var typeExpression = tryParseTypeExpression();
+ var result = createNode(280, atToken.pos);
+ result.atToken = atToken;
+ result.tagName = tagName;
+ result.typeExpression = typeExpression;
+ return finishNode(result);
+ }
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(284, atToken.pos);
+ var typedefTag = createNode(285, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(0);
@@ -15856,8 +15970,8 @@ var ts;
if (typeExpression.type.kind === 272) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70) {
- var name_15 = jsDocTypeReference.name;
- if (name_15.text === "Object") {
+ var name_14 = jsDocTypeReference.name;
+ if (name_14.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -15871,7 +15985,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(286, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(287, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -15956,19 +16070,19 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 284; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
var typeParameters = createNodeArray();
while (true) {
- var name_16 = parseJSDocIdentifierName();
+ var name_15 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_16) {
+ if (!name_15) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(143, name_16.pos);
- typeParameter.name = name_16;
+ var typeParameter = createNode(143, name_15.pos);
+ typeParameter.name = name_15;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25) {
@@ -15979,7 +16093,7 @@ var ts;
break;
}
}
- var result = createNode(283, atToken.pos);
+ var result = createNode(284, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -16059,8 +16173,8 @@ var ts;
ts.Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
forEachChild(jsDocComment, visitNode, visitArray);
}
@@ -16444,7 +16558,7 @@ var ts;
}
if (node.name.kind === 142) {
var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
@@ -16489,7 +16603,7 @@ var ts;
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 284:
+ case 285:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
if (parentNode && parentNode.kind === 205) {
@@ -16564,7 +16678,7 @@ var ts;
}
}
else {
- var isJSDocTypedefInJSDocNamespace = node.kind === 284 &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 285 &&
node.name &&
node.name.kind === 70 &&
node.name.isInJSDocNamespace;
@@ -16669,12 +16783,35 @@ var ts;
subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);
}
}
+ function bindEach(nodes) {
+ if (nodes === undefined) {
+ return;
+ }
+ if (skipTransformFlagAggregation) {
+ ts.forEach(nodes, bind);
+ }
+ else {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
+ var node = nodes_2[_i];
+ bind(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
+ }
+ }
+ function bindEachChild(node) {
+ ts.forEachChild(node, bind, bindEach);
+ }
function bindChildrenWorker(node) {
- if (ts.isInJavaScriptFile(node) && node.jsDocComments) {
- ts.forEach(node.jsDocComments, bind);
+ if (ts.isInJavaScriptFile(node) && node.jsDoc) {
+ ts.forEach(node.jsDoc, bind);
}
if (checkUnreachable(node)) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
return;
}
switch (node.kind) {
@@ -16739,7 +16876,7 @@ var ts;
bindCallExpressionFlow(node);
break;
default:
- ts.forEachChild(node, bind);
+ bindEachChild(node);
break;
}
}
@@ -17042,7 +17179,7 @@ var ts;
}
return undefined;
}
- function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
+ function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
var flowLabel = node.kind === 215 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
@@ -17055,11 +17192,11 @@ var ts;
var activeLabel = findActiveLabel(node.label.text);
if (activeLabel) {
activeLabel.referenced = true;
- bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
+ bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
}
}
else {
- bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
+ bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
}
}
function bindTryStatement(node) {
@@ -17110,6 +17247,8 @@ var ts;
currentFlow = finishFlowLabel(postSwitchLabel);
}
function bindCaseBlock(node) {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
var clauses = node.clauses;
var fallthroughFlow = unreachableFlow;
for (var i = 0; i < clauses.length; i++) {
@@ -17129,13 +17268,15 @@ var ts;
errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);
}
}
+ clauses.transformFlags = subtreeTransformFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
}
function bindCaseClause(node) {
var saveCurrentFlow = currentFlow;
currentFlow = preSwitchCaseFlow;
bind(node.expression);
currentFlow = saveCurrentFlow;
- ts.forEach(node.statements, bind);
+ bindEach(node.statements);
}
function pushActiveLabel(name, breakTarget, continueTarget) {
var activeLabel = {
@@ -17221,19 +17362,19 @@ var ts;
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
- ts.forEachChild(node, bind);
+ bindEachChild(node);
currentFalseTarget = currentTrueTarget;
currentTrueTarget = saveTrueTarget;
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
@@ -17251,7 +17392,7 @@ var ts;
}
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
if (operator === 57 && node.left.kind === 178) {
@@ -17264,7 +17405,7 @@ var ts;
}
}
function bindDeleteExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.expression.kind === 177) {
bindAssignmentTargetFlow(node.expression);
}
@@ -17297,7 +17438,7 @@ var ts;
}
}
function bindVariableDeclarationFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) {
bindInitializedVariableFlow(node);
}
@@ -17308,12 +17449,12 @@ var ts;
expr = expr.expression;
}
if (expr.kind === 184 || expr.kind === 185) {
- ts.forEach(node.typeArguments, bind);
- ts.forEach(node.arguments, bind);
+ bindEach(node.typeArguments);
+ bindEach(node.arguments);
bind(node.expression);
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
}
if (node.expression.kind === 177) {
var propertyAccess = node.expression;
@@ -17329,7 +17470,7 @@ var ts;
case 229:
case 176:
case 161:
- case 286:
+ case 287:
case 270:
return 1;
case 227:
@@ -17398,7 +17539,7 @@ var ts;
case 176:
case 227:
case 270:
- case 286:
+ case 287:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
case 158:
case 159:
@@ -17692,8 +17833,8 @@ var ts;
}
function updateStrictModeStatementList(statements) {
if (!inStrictMode) {
- for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
- var statement = statements_1[_i];
+ for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
+ var statement = statements_2[_i];
if (!ts.isPrologueDirective(statement)) {
return;
}
@@ -17713,7 +17854,7 @@ var ts;
case 70:
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 284) {
+ while (parentNode && parentNode.kind !== 285) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288, 793064);
@@ -17783,7 +17924,7 @@ var ts;
case 146:
case 271:
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);
- case 285:
+ case 286:
return bindJSDocProperty(node);
case 257:
case 258:
@@ -17827,7 +17968,7 @@ var ts;
return bindFunctionOrConstructorType(node);
case 161:
case 170:
- case 286:
+ case 287:
case 270:
return bindAnonymousDeclaration(node, 2048, "__type");
case 176:
@@ -17846,7 +17987,7 @@ var ts;
return bindClassLikeDeclaration(node);
case 227:
return bindBlockScopedDeclaration(node, 64, 792968);
- case 284:
+ case 285:
if (!node.fullName || node.fullName.kind === 70) {
return bindBlockScopedDeclaration(node, 524288, 793064);
}
@@ -17920,12 +18061,12 @@ var ts;
return;
}
else {
- var parent_5 = node.parent;
- if (!ts.isExternalModule(parent_5)) {
+ var parent_4 = node.parent;
+ if (!ts.isExternalModule(parent_4)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_5.isDeclarationFile) {
+ if (!parent_4.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -18211,12 +18352,12 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608
+ if (subtreeFlags & 524288
|| isSuperOrSuperProperty(expression, expressionKind)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
@@ -18235,28 +18376,28 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
if (operatorTokenKind === 57 && leftKind === 176) {
- transformFlags |= 48 | 3072 | 49152;
+ transformFlags |= 8 | 192 | 3072;
}
else if (operatorTokenKind === 57 && leftKind === 175) {
- transformFlags |= 3072 | 49152;
+ transformFlags |= 192 | 3072;
}
else if (operatorTokenKind === 39
|| operatorTokenKind === 61) {
- transformFlags |= 768;
+ transformFlags |= 32;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18266,21 +18407,21 @@ var ts;
var dotDotDotToken = node.dotDotDotToken;
if (node.questionToken
|| node.type
- || subtreeFlags & 65536
+ || subtreeFlags & 4096
|| ts.isThisIdentifier(name)) {
transformFlags |= 3;
}
if (modifierFlags & 92) {
- transformFlags |= 3 | 4194304;
+ transformFlags |= 3 | 262144;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 67108864 || initializer || dotDotDotToken) {
- transformFlags |= 3072 | 2097152;
+ if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {
+ transformFlags |= 192 | 131072;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~536872257;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18291,11 +18432,11 @@ var ts;
|| expressionKind === 182) {
transformFlags |= 3;
}
- if (expressionTransformFlags & 16384) {
- transformFlags |= 16384;
+ if (expressionTransformFlags & 1024) {
+ transformFlags |= 1024;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -18304,35 +18445,35 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 3072;
- if ((subtreeFlags & 4390912)
+ transformFlags = subtreeFlags | 192;
+ if ((subtreeFlags & 274432)
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeClassExpression(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
- if (subtreeFlags & 4390912
+ var transformFlags = subtreeFlags | 192;
+ if (subtreeFlags & 274432
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 107:
transformFlags |= 3;
@@ -18342,23 +18483,23 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~537920833;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.typeArguments) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18366,11 +18507,14 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeMethod(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.decorators
|| ts.hasModifier(node, 2270)
|| node.typeParameters
@@ -18378,14 +18522,17 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18395,16 +18542,19 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computePropertyDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags | 3;
if (node.initializer) {
- transformFlags |= 131072;
+ transformFlags |= 8192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -18414,27 +18564,27 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 268435456;
+ transformFlags = subtreeFlags | 33554432;
if (modifierFlags & 2270
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (modifierFlags & 256) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18444,63 +18594,60 @@ var ts;
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeArrowFunction(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (ts.hasModifier(node, 2270)
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 262144) {
- transformFlags |= 524288;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~979719509;
+ return transformFlags & ~601249089;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
if (expressionKind === 96) {
- transformFlags |= 262144;
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var nameKind = node.name.kind;
- if (nameKind === 172) {
- transformFlags |= 48 | 3072 | 67108864;
- }
- else if (nameKind === 173) {
- transformFlags |= 3072 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
if (node.type) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -18511,21 +18658,21 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- if (declarationListTransformFlags & 67108864) {
- transformFlags |= 3072;
+ if (declarationListTransformFlags & 8388608) {
+ transformFlags |= 192;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (subtreeFlags & 33554432
+ if (subtreeFlags & 4194304
&& ts.isIterationStatement(node, true)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -18533,15 +18680,15 @@ var ts;
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.transformFlags & 16384) {
- transformFlags |= 3072;
+ if (node.expression.transformFlags & 1024) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3;
@@ -18550,26 +18697,26 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~839734613;
+ return transformFlags & ~574674241;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 268435456;
- if (subtreeFlags & 67108864) {
- transformFlags |= 3072;
+ var transformFlags = subtreeFlags | 33554432;
+ if (subtreeFlags & 8388608) {
+ transformFlags |= 192;
}
if (node.flags & 3) {
- transformFlags |= 3072 | 33554432;
+ transformFlags |= 192 | 4194304;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~546309441;
}
function computeOther(node, kind, subtreeFlags) {
var transformFlags = subtreeFlags;
- var excludeFlags = 536892757;
+ var excludeFlags = 536872257;
switch (kind) {
case 119:
case 189:
- transformFlags |= 192;
+ transformFlags |= 16;
break;
case 113:
case 111:
@@ -18593,10 +18740,10 @@ var ts;
case 250:
case 251:
case 252:
- transformFlags |= 12;
+ transformFlags |= 4;
break;
case 213:
- transformFlags |= 48;
+ transformFlags |= 8;
case 12:
case 13:
case 14:
@@ -18605,10 +18752,10 @@ var ts;
case 181:
case 258:
case 114:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 195:
- transformFlags |= 3072 | 134217728;
+ transformFlags |= 192 | 16777216;
break;
case 118:
case 132:
@@ -18645,73 +18792,79 @@ var ts;
excludeFlags = -3;
break;
case 142:
- transformFlags |= 16777216;
- if (subtreeFlags & 262144) {
- transformFlags |= 1048576;
+ transformFlags |= 2097152;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 65536;
}
break;
case 196:
+ transformFlags |= 192 | 524288;
+ break;
case 259:
- transformFlags |= 8388608;
+ transformFlags |= 8 | 1048576;
break;
- case 174:
- if (node.dotDotDotToken) {
- transformFlags |= 8388608;
- }
case 96:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 98:
- transformFlags |= 262144;
+ transformFlags |= 16384;
break;
case 172:
- case 173:
- if (subtreeFlags & 8388608) {
- transformFlags |= 48 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 8 | 1048576;
}
- else {
- transformFlags |= 3072 | 67108864;
+ excludeFlags = 537396545;
+ break;
+ case 173:
+ transformFlags |= 192 | 8388608;
+ excludeFlags = 537396545;
+ break;
+ case 174:
+ transformFlags |= 192;
+ if (node.dotDotDotToken) {
+ transformFlags |= 524288;
}
break;
case 145:
- transformFlags |= 3 | 65536;
+ transformFlags |= 3 | 4096;
break;
case 176:
- excludeFlags = 554784085;
- if (subtreeFlags & 16777216) {
- transformFlags |= 3072;
+ excludeFlags = 540087617;
+ if (subtreeFlags & 2097152) {
+ transformFlags |= 192;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
break;
case 175:
case 180:
- excludeFlags = 545281365;
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ excludeFlags = 537396545;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
break;
case 209:
case 210:
case 211:
case 212:
- if (subtreeFlags & 33554432) {
- transformFlags |= 3072;
+ if (subtreeFlags & 4194304) {
+ transformFlags |= 192;
}
break;
case 261:
- if (subtreeFlags & 524288) {
- transformFlags |= 3072;
+ if (subtreeFlags & 32768) {
+ transformFlags |= 192;
}
break;
case 216:
case 214:
case 215:
- transformFlags |= 268435456;
+ transformFlags |= 33554432;
break;
}
node.transformFlags = transformFlags | 536870912;
@@ -18725,27 +18878,27 @@ var ts;
case 179:
case 180:
case 175:
- return 545281365;
+ return 537396545;
case 230:
- return 839734613;
+ return 574674241;
case 144:
- return 604001621;
+ return 536872257;
case 185:
- return 979719509;
+ return 601249089;
case 184:
case 225:
- return 980243797;
+ return 601281857;
case 224:
- return 604001621;
+ return 546309441;
case 226:
case 197:
- return 559895893;
+ return 539358529;
case 150:
- return 975983957;
+ return 601015617;
case 149:
case 151:
case 152:
- return 975983957;
+ return 601015617;
case 118:
case 132:
case 129:
@@ -18763,9 +18916,14 @@ var ts;
case 228:
return -3;
case 176:
- return 554784085;
+ return 540087617;
+ case 256:
+ return 537920833;
+ case 172:
+ case 173:
+ return 537396545;
default:
- return 536892757;
+ return 536872257;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -18800,6 +18958,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -19438,6 +19597,7 @@ var ts;
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
isOptionalParameter: isOptionalParameter,
+ tryGetMemberInModuleExports: tryGetMemberInModuleExports,
tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
return tryFindAmbientModule(moduleName, false);
}
@@ -19447,6 +19607,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var indexedAccessTypes = ts.createMap();
var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 | 67108864, "unknown");
var resolvingSymbol = createSymbol(67108864, "__resolving__");
@@ -19466,7 +19627,6 @@ var ts;
var voidType = createIntrinsicType(1024, "void");
var neverType = createIntrinsicType(8192, "never");
var silentNeverType = createIntrinsicType(8192, "never");
- var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type");
emptyTypeLiteralSymbol.members = ts.createMap();
@@ -20016,6 +20176,7 @@ var ts;
if (!errorLocation ||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
!checkAndReportErrorForExtendingInterface(errorLocation) &&
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg));
}
@@ -20092,6 +20253,16 @@ var ts;
return undefined;
}
}
+ function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
+ if (meaning === 1920) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
+ if (symbol) {
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);
+ return true;
+ }
+ }
+ return false;
+ }
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
if (meaning & (107455 & ~1024)) {
var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
@@ -20197,28 +20368,28 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_17 = specifier.propertyName || specifier.name;
- if (name_17.text) {
+ var name_16 = specifier.propertyName || specifier.name;
+ if (name_16.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);
}
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_17.text);
- if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") {
+ var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17));
+ error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));
}
return symbol;
}
@@ -20443,6 +20614,12 @@ var ts;
function getExportsOfModuleAsArray(moduleSymbol) {
return symbolsToArray(getExportsOfModule(moduleSymbol));
}
+ function tryGetMemberInModuleExports(memberName, moduleSymbol) {
+ var symbolTable = getExportsOfModule(moduleSymbol);
+ if (symbolTable) {
+ return symbolTable[memberName];
+ }
+ }
function getExportsOfSymbol(symbol) {
return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
@@ -20958,9 +21135,9 @@ var ts;
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2));
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
- var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_6) {
- walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false);
+ var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_5) {
+ walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false);
}
}
if (accessibleSymbolChain) {
@@ -21093,12 +21270,12 @@ var ts;
var length_1 = outerTypeParameters.length;
while (i < length_1) {
var start = i;
- var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_7, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);
writePunctuation(writer, 22);
}
}
@@ -21522,12 +21699,12 @@ var ts;
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_8 = getDeclarationContainer(node);
+ var parent_7 = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) {
- return isGlobalSourceFile(parent_8);
+ !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) {
+ return isGlobalSourceFile(parent_7);
}
- return isDeclarationVisible(parent_8);
+ return isDeclarationVisible(parent_7);
case 147:
case 146:
case 151:
@@ -21683,15 +21860,15 @@ var ts;
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression);
}
function getRestType(source, properties, symbol) {
ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now.");
var members = ts.createMap();
var names = ts.createMap();
for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var name_18 = properties_2[_i];
- names[ts.getTextOfPropertyName(name_18)] = true;
+ var name_17 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_17)] = true;
}
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
var prop = _b[_a];
@@ -21729,26 +21906,26 @@ var ts;
var literalMembers = [];
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 198 && !element.dotDotDotToken) {
+ if (!element.dotDotDotToken) {
literalMembers.push(element.propertyName || element.name);
}
}
type = getRestType(parentType, literalMembers, declaration.symbol);
}
else {
- var name_19 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_19)) {
+ var name_18 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_18)) {
return anyType;
}
if (declaration.initializer) {
getContextualType(declaration.initializer);
}
- var text = ts.getTextOfPropertyName(name_19);
+ var text = ts.getTextOfPropertyName(name_18);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||
getIndexTypeOfType(parentType, 0);
if (!type) {
- error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19));
+ error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18));
return unknownType;
}
}
@@ -21782,29 +21959,9 @@ var ts;
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
- if (jsDocType) {
- return getTypeFromTypeNode(jsDocType);
- }
- }
- function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var typeTag = ts.getJSDocTypeTag(declaration);
- if (typeTag && typeTag.typeExpression) {
- return typeTag.typeExpression.type;
- }
- if (declaration.kind === 223 &&
- declaration.parent.kind === 224 &&
- declaration.parent.parent.kind === 205) {
- var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
- if (annotation && annotation.typeExpression) {
- return annotation.typeExpression.type;
- }
- }
- else if (declaration.kind === 144) {
- var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type;
- }
+ var jsdocType = ts.getJSDocType(declaration);
+ if (jsdocType) {
+ return getTypeFromTypeNode(jsdocType);
}
return undefined;
}
@@ -21827,7 +21984,8 @@ var ts;
}
}
if (declaration.parent.parent.kind === 212) {
- return stringType;
+ var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
+ return indexType.flags & (16384 | 262144) ? indexType : stringType;
}
if (declaration.parent.parent.kind === 213) {
return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;
@@ -21838,7 +21996,8 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
+ if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) &&
+ declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {
if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -21977,7 +22136,7 @@ var ts;
if (declaration.kind === 240) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) {
+ if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
if (!pushTypeResolution(symbol, 0)) {
@@ -21987,9 +22146,9 @@ var ts;
if (declaration.kind === 192 ||
declaration.kind === 177 && declaration.parent.kind === 192) {
if (declaration.flags & 2097152) {
- var typeTag = ts.getJSDocTypeTag(declaration.parent);
- if (typeTag && typeTag.typeExpression) {
- return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
+ var jsdocType = ts.getJSDocType(declaration.parent);
+ if (jsdocType) {
+ return links.type = getTypeFromTypeNode(jsdocType);
}
}
var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ?
@@ -22290,6 +22449,13 @@ var ts;
}
baseType = getReturnTypeOfSignature(constructors[0]);
}
+ var valueDecl = type.symbol.valueDeclaration;
+ if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {
+ var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);
+ if (augTag) {
+ baseType = getTypeFromTypeNode(augTag.typeExpression.type);
+ }
+ }
if (baseType === unknownType) {
return;
}
@@ -22298,7 +22464,7 @@ var ts;
return;
}
if (type === baseType || hasBaseType(baseType, type)) {
- error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
+ error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
return;
}
if (type.resolvedBaseTypes === emptyArray) {
@@ -22400,7 +22566,7 @@ var ts;
if (!pushTypeResolution(symbol, 2)) {
return unknownType;
}
- var declaration = ts.getDeclarationOfKind(symbol, 284);
+ var declaration = ts.getDeclarationOfKind(symbol, 285);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -22887,6 +23053,7 @@ var ts;
var members = ts.createMap();
var stringIndexInfo;
var numberIndexInfo;
+ setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var typeParameter = getTypeParameterFromMappedType(type);
var constraintType = getConstraintTypeFromMappedType(type);
var templateType = getTemplateTypeFromMappedType(type);
@@ -22931,6 +23098,9 @@ var ts;
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
unknownType);
}
+ function getErasedTemplateTypeFromMappedType(type) {
+ return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
+ }
function isGenericMappedType(type) {
if (getObjectFlags(type) & 32) {
var constraintType = getConstraintTypeFromMappedType(type);
@@ -23018,14 +23188,18 @@ var ts;
}
return type.resolvedApparentType;
}
+ function getApparentTypeOfIndexedAccess(type) {
+ return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;
+ }
function getApparentType(type) {
- var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type;
- return t.flags & 34 ? globalStringType :
+ var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :
+ type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :
+ type;
+ return t.flags & 262178 ? globalStringType :
t.flags & 340 ? globalNumberType :
t.flags & 136 ? globalBooleanType :
t.flags & 512 ? getGlobalESSymbolType() :
- t.flags & 262144 ? stringOrNumberType :
- t;
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -23198,13 +23372,16 @@ var ts;
if (node.type && node.type.kind === 273) {
return true;
}
- var paramTag = ts.getCorrespondingJSDocParameterTag(node);
- if (paramTag) {
- if (paramTag.isBracketed) {
- return true;
- }
- if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 273;
+ var paramTags = ts.getJSDocParameterTags(node);
+ if (paramTags) {
+ for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {
+ var paramTag = paramTags_1[_i];
+ if (paramTag.isBracketed) {
+ return true;
+ }
+ if (paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 273;
+ }
}
}
}
@@ -24039,10 +24216,14 @@ var ts;
}
function getIndexType(type) {
return type.flags & 16384 ? getIndexTypeForTypeParameter(type) :
- type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType :
- getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :
+ type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType :
getLiteralTypeFromPropertyNames(type);
}
+ function getIndexTypeOrString(type) {
+ var indexType = getIndexType(type);
+ return indexType !== neverType ? indexType : stringType;
+ }
function getTypeFromTypeOperatorNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -24056,10 +24237,6 @@ var ts;
type.indexType = indexType;
return type;
}
- function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
- var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
- return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
- }
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
var propName = indexType.flags & (32 | 64 | 256) ?
@@ -24082,7 +24259,7 @@ var ts;
return getTypeOfSymbol(prop);
}
}
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) {
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) {
if (isTypeAny(objectType)) {
return anyType;
}
@@ -24122,20 +24299,38 @@ var ts;
}
return unknownType;
}
+ function getIndexedAccessForMappedType(type, indexType, accessNode) {
+ var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
+ return unknownType;
+ }
+ var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);
+ var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
+ return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken);
+ }
function getIndexedAccessType(objectType, indexType, accessNode) {
- if (indexType.flags & 16384) {
- if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
- error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
- return unknownType;
+ if (indexType.flags & 16384 ||
+ objectType.flags & 16384 && indexType.flags & 262144 ||
+ isGenericMappedType(objectType)) {
+ if (accessNode) {
+ if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
+ error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
+ return unknownType;
+ }
}
- return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ if (isGenericMappedType(objectType)) {
+ return getIndexedAccessForMappedType(objectType, indexType, accessNode);
+ }
+ var id = objectType.id + "," + indexType.id;
+ return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
}
- var apparentType = getApparentType(objectType);
+ var apparentObjectType = getApparentType(objectType);
if (indexType.flags & 65536 && !(indexType.flags & 8190)) {
var propTypes = [];
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false);
+ var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false);
if (propType === unknownType) {
return unknownType;
}
@@ -24143,7 +24338,7 @@ var ts;
}
return getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true);
+ return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -24160,6 +24355,7 @@ var ts;
type.aliasSymbol = getAliasSymbolForTypeNode(node);
type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
links.resolvedType = type;
+ getConstraintTypeFromMappedType(type);
}
return links.resolvedType;
}
@@ -24328,18 +24524,18 @@ var ts;
return nullType;
case 129:
return neverType;
- case 288:
- return nullType;
case 289:
- return undefinedType;
+ return nullType;
case 290:
+ return undefinedType;
+ case 291:
return neverType;
case 167:
case 98:
return getTypeFromThisTypeNode(node);
case 171:
return getTypeFromLiteralTypeNode(node);
- case 287:
+ case 288:
return getTypeFromLiteralTypeNode(node.literal);
case 157:
case 272:
@@ -24372,7 +24568,7 @@ var ts;
case 158:
case 159:
case 161:
- case 286:
+ case 287:
case 274:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 168:
@@ -24533,6 +24729,28 @@ var ts;
return result;
}
function instantiateMappedType(type, mapper) {
+ var constraintType = getConstraintTypeFromMappedType(type);
+ if (constraintType.flags & 262144) {
+ var typeParameter_1 = constraintType.type;
+ var mappedTypeParameter = mapper(typeParameter_1);
+ if (typeParameter_1 !== mappedTypeParameter) {
+ return mapType(mappedTypeParameter, function (t) {
+ if (isMappableType(t)) {
+ var replacementMapper = createUnaryTypeMapper(typeParameter_1, t);
+ var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);
+ combinedMapper.mappedTypes = mapper.mappedTypes;
+ return instantiateMappedObjectType(type, combinedMapper);
+ }
+ return t;
+ });
+ }
+ }
+ return instantiateMappedObjectType(type, mapper);
+ }
+ function isMappableType(type) {
+ return type.flags & (16384 | 32768 | 131072 | 524288);
+ }
+ function instantiateMappedObjectType(type, mapper) {
var result = createObjectType(32 | 64, type.symbol);
result.declaration = type.declaration;
result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
@@ -24891,7 +25109,7 @@ var ts;
return false;
if (target.flags & 1 || source.flags & 8192)
return true;
- if (source.flags & 34 && target.flags & 2)
+ if (source.flags & 262178 && target.flags & 2)
return true;
if (source.flags & 340 && target.flags & 4)
return true;
@@ -25015,11 +25233,6 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1;
- if (source.flags & 262144) {
- if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) {
- return -1;
- }
- }
if (getObjectFlags(source) & 128 && source.flags & 1048576) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
@@ -25059,10 +25272,21 @@ var ts;
}
}
if (target.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(target);
- if (constraint && constraint.flags & 262144) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
- return result;
+ if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
+ if (!source.declaration.questionToken) {
+ var templateType = getTemplateTypeFromMappedType(source);
+ var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
+ if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
}
}
}
@@ -25079,16 +25303,32 @@ var ts;
}
}
}
+ else if (target.flags & 524288) {
+ if (source.flags & 524288 && source.indexType === target.indexType) {
+ if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(source);
- if (!constraint || constraint.flags & 1) {
- constraint = emptyObjectType;
- }
- constraint = getTypeWithThisArgument(constraint, source);
- var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
- errorInfo = saveErrorInfo;
- return result;
+ if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
+ var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
+ var templateType = getTemplateTypeFromMappedType(target);
+ if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
+ return result;
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(source);
+ if (!constraint || constraint.flags & 1) {
+ constraint = emptyObjectType;
+ }
+ constraint = getTypeWithThisArgument(constraint, source);
+ var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
+ if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
+ }
}
}
else {
@@ -25097,22 +25337,12 @@ var ts;
return result;
}
}
- if (isGenericMappedType(target)) {
- if (isGenericMappedType(source)) {
- if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) &&
- (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) {
- return result;
- }
- }
- }
- else {
- var apparentSource = getApparentType(source);
- if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
- var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
- if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
- errorInfo = saveErrorInfo;
- return result;
- }
+ var apparentSource = getApparentType(source);
+ if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
+ var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
+ if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
}
}
}
@@ -25319,6 +25549,9 @@ var ts;
if (expandingFlags === 3) {
result = 1;
}
+ else if (isGenericMappedType(source) || isGenericMappedType(target)) {
+ result = mappedTypeRelatedTo(source, target, reportErrors);
+ }
else {
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
@@ -25346,6 +25579,33 @@ var ts;
}
return result;
}
+ function mappedTypeRelatedTo(source, target, reportErrors) {
+ if (isGenericMappedType(target)) {
+ if (isGenericMappedType(source)) {
+ var result_2;
+ if (relation === identityRelation) {
+ var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;
+ var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;
+ if (readonlyMatches && optionalMatches) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ else {
+ if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ }
+ }
+ else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {
+ return -1;
+ }
+ return 0;
+ }
function propertiesRelatedTo(source, target, reportErrors) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target);
@@ -25821,7 +26081,7 @@ var ts;
return type;
}
var types = [type];
- if (flags & 34)
+ if (flags & 262178)
types.push(emptyStringType);
if (flags & 340)
types.push(zeroType);
@@ -26156,19 +26416,6 @@ var ts;
}
}
else {
- if (getObjectFlags(target) & 32) {
- var constraintType = getConstraintTypeFromMappedType(target);
- if (getObjectFlags(source) & 32) {
- inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
- return;
- }
- if (constraintType.flags & 16384) {
- inferFromTypes(getIndexType(source), constraintType);
- inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
- return;
- }
- }
source = getApparentType(source);
if (source.flags & 32768) {
if (isInProcess(source, target)) {
@@ -26189,14 +26436,30 @@ var ts;
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
- inferFromProperties(source, target);
- inferFromSignatures(source, target, 0);
- inferFromSignatures(source, target, 1);
- inferFromIndexTypes(source, target);
+ inferFromObjectTypes(source, target);
depth--;
}
}
}
+ function inferFromObjectTypes(source, target) {
+ if (getObjectFlags(target) & 32) {
+ var constraintType = getConstraintTypeFromMappedType(target);
+ if (getObjectFlags(source) & 32) {
+ inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ if (constraintType.flags & 16384) {
+ inferFromTypes(getIndexType(source), constraintType);
+ inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ }
+ inferFromProperties(source, target);
+ inferFromSignatures(source, target, 0);
+ inferFromSignatures(source, target, 1);
+ inferFromIndexTypes(source, target);
+ }
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
@@ -26531,7 +26794,7 @@ var ts;
}
function getTypeWithDefault(type, defaultExpression) {
if (defaultExpression) {
- var defaultType = checkExpression(defaultExpression);
+ var defaultType = getTypeOfExpression(defaultExpression);
return getUnionType([getTypeWithFacts(type, 131072), defaultType]);
}
return type;
@@ -26554,7 +26817,7 @@ var ts;
function getAssignedTypeOfBinaryExpression(node) {
return node.parent.kind === 175 || node.parent.kind === 257 ?
getTypeWithDefault(getAssignedType(node), node.right) :
- checkExpression(node.right);
+ getTypeOfExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
@@ -26602,7 +26865,7 @@ var ts;
}
function getTypeOfInitializer(node) {
var links = getNodeLinks(node);
- return links.resolvedType || checkExpression(node);
+ return links.resolvedType || getTypeOfExpression(node);
}
function getInitialTypeOfVariableDeclaration(node) {
if (node.initializer) {
@@ -26655,7 +26918,7 @@ var ts;
}
function getTypeOfSwitchClause(clause) {
if (clause.kind === 253) {
- var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
+ var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@@ -26735,7 +26998,7 @@ var ts;
return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
}
function addEvolvingArrayElementType(evolvingArrayType, node) {
- var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
}
function createFinalArrayType(elementType) {
@@ -26783,7 +27046,7 @@ var ts;
parent.parent.operatorToken.kind === 57 &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
- isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048);
+ isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048);
return isLengthPushOrUnshift || isElementAssignment;
}
function maybeTypePredicateCall(node) {
@@ -26921,7 +27184,7 @@ var ts;
}
}
else {
- var indexType = checkExpression(node.left.argumentExpression);
+ var indexType = getTypeOfExpression(node.left.argumentExpression);
if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
}
@@ -27102,7 +27365,7 @@ var ts;
if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
- var valueType = checkExpression(value);
+ var valueType = getTypeOfExpression(value);
if (valueType.flags & 6144) {
if (!strictNullChecks) {
return type;
@@ -27174,7 +27437,7 @@ var ts;
}
return type;
}
- var rightType = checkExpression(expr.right);
+ var rightType = getTypeOfExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
@@ -27202,16 +27465,16 @@ var ts;
}
}
if (targetType) {
- return getNarrowedType(type, targetType, assumeTrue);
+ return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);
}
return type;
}
- function getNarrowedType(type, candidate, assumeTrue) {
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
if (!assumeTrue) {
- return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); });
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
}
if (type.flags & 65536) {
- var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); });
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
if (!(assignableType.flags & 8192)) {
return assignableType;
}
@@ -27238,7 +27501,7 @@ var ts;
var predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, predicateArgument)) {
return declaredType;
@@ -27251,7 +27514,7 @@ var ts;
var accessExpression = invokedExpression;
var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, possibleReference)) {
return declaredType;
@@ -27287,7 +27550,7 @@ var ts;
location = location.parent;
}
if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {
- var type = checkExpression(location);
+ var type = getTypeOfExpression(location);
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
return type;
}
@@ -27622,9 +27885,9 @@ var ts;
return anyType;
}
function getTypeForThisExpressionFromJSDoc(node) {
- var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) {
- var jsDocFunctionType = typeTag.typeExpression.type;
+ var jsdocType = ts.getJSDocType(node);
+ if (jsdocType && jsdocType.kind === 274) {
+ var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
@@ -27809,11 +28072,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_20 = declaration.propertyName || declaration.name;
+ var name_19 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_20)) {
- var text = ts.getTextOfPropertyName(name_20);
+ !ts.isBindingPattern(name_19)) {
+ var text = ts.getTextOfPropertyName(name_19);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -27892,13 +28155,13 @@ var ts;
return undefined;
}
if (node === binaryExpression.right) {
- return checkExpression(binaryExpression.left);
+ return getTypeOfExpression(binaryExpression.left);
}
}
else if (operator === 53) {
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
- type = checkExpression(binaryExpression.left);
+ type = getTypeOfExpression(binaryExpression.left);
}
return type;
}
@@ -28204,7 +28467,7 @@ var ts;
var links = getNodeLinks(node.expression);
if (!links.resolvedType) {
links.resolvedType = checkExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) {
error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
@@ -28213,10 +28476,10 @@ var ts;
}
return links.resolvedType;
}
- function getObjectLiteralIndexInfo(node, properties, kind) {
+ function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {
var propTypes = [];
for (var i = 0; i < properties.length; i++) {
- if (kind === 0 || isNumericName(node.properties[i].name)) {
+ if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) {
propTypes.push(getTypeOfSymbol(properties[i]));
}
}
@@ -28237,8 +28500,9 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var memberDecl = _a[_i];
+ var offset = 0;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
var member = memberDecl.symbol;
if (memberDecl.kind === 257 ||
memberDecl.kind === 258 ||
@@ -28299,6 +28563,7 @@ var ts;
return unknownType;
}
spread = getSpreadType(spread, type, false);
+ offset = i + 1;
continue;
}
else {
@@ -28319,8 +28584,8 @@ var ts;
propertiesArray.push(member);
}
if (contextualTypeHasPattern) {
- for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) {
- var prop = _c[_b];
+ for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {
+ var prop = _a[_i];
if (!propertiesTable[prop.name]) {
if (!(prop.flags & 536870912)) {
error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
@@ -28340,8 +28605,8 @@ var ts;
}
return createObjectLiteralType();
function createObjectLiteralType() {
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined;
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined;
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;
result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);
@@ -28883,7 +29148,7 @@ var ts;
if (node.kind === 212 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
- hasNumericPropertyNames(checkExpression(node.expression))) {
+ hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
return true;
}
child = node;
@@ -28976,19 +29241,19 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_9 = signature.declaration && signature.declaration.parent;
+ var parent_8 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_9 === lastParent) {
+ if (lastParent && parent_8 === lastParent) {
index++;
}
else {
- lastParent = parent_9;
+ lastParent = parent_8;
index = cutoffIndex;
}
}
else {
index = cutoffIndex = result.length;
- lastParent = parent_9;
+ lastParent = parent_8;
}
lastSymbol = symbol;
if (signature.hasLiteralTypes) {
@@ -29956,7 +30221,7 @@ var ts;
if (!node.possiblyExhaustive) {
return false;
}
- var type = checkExpression(node.expression);
+ var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
return false;
}
@@ -30292,10 +30557,10 @@ var ts;
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) {
+ if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) {
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -30304,20 +30569,20 @@ var ts;
var properties = node.properties;
for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {
if (property.kind === 257 || property.kind === 258) {
- var name_21 = property.name;
- if (name_21.kind === 142) {
- checkComputedPropertyName(name_21);
+ var name_20 = property.name;
+ if (name_20.kind === 142) {
+ checkComputedPropertyName(name_20);
}
- if (isComputedNonLiteralName(name_21)) {
+ if (isComputedNonLiteralName(name_20)) {
return undefined;
}
- var text = ts.getTextOfPropertyName(name_21);
+ var text = ts.getTextOfPropertyName(name_20);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -30332,13 +30597,18 @@ var ts;
}
}
else {
- error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21));
+ error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));
}
}
else if (property.kind === 259) {
- if (property.expression.kind !== 70) {
- error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier);
+ var nonRestNames = [];
+ if (allProperties) {
+ for (var i = 0; i < allProperties.length - 1; i++) {
+ nonRestNames.push(allProperties[i].name);
+ }
}
+ var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
+ return checkDestructuringAssignment(property.expression, type);
}
else {
error(property, ts.Diagnostics.Property_assignment_expected);
@@ -30423,7 +30693,10 @@ var ts;
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ var error = target.parent.kind === 259 ?
+ ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
+ ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
+ if (checkReferenceExpression(target, error)) {
checkTypeAssignableTo(sourceType, targetType, target, undefined);
}
return sourceType;
@@ -30560,7 +30833,7 @@ var ts;
resultType = numberType;
}
else {
- if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) {
+ if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) {
resultType = stringType;
}
else if (isTypeAny(leftType) || isTypeAny(rightType)) {
@@ -30583,6 +30856,8 @@ var ts;
case 29:
case 30:
if (checkForDisallowedESSymbolOperand(operator)) {
+ leftType = getBaseTypeOfLiteralType(leftType);
+ rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -30756,7 +31031,7 @@ var ts;
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
return ts.getCombinedNodeFlags(declaration) & 2 ||
- ts.getCombinedModifierFlags(declaration) & 64 ||
+ ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) ||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
}
function isLiteralContextualType(contextualType) {
@@ -30768,7 +31043,7 @@ var ts;
}
contextualType = apparentType;
}
- return maybeTypeOfKind(contextualType, 480);
+ return maybeTypeOfKind(contextualType, (480 | 262144));
}
return false;
}
@@ -30805,6 +31080,16 @@ var ts;
}
return type;
}
+ function getTypeOfExpression(node) {
+ if (node.kind === 179 && node.expression.kind !== 96) {
+ var funcType = checkNonNullExpression(node.expression);
+ var signature = getSingleCallSignature(funcType);
+ if (signature && !signature.typeParameters) {
+ return getReturnTypeOfSignature(signature);
+ }
+ }
+ return checkExpression(node);
+ }
function checkExpression(node, contextualMapper) {
var type;
if (node.kind === 141) {
@@ -30985,9 +31270,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_22 = _a[_i].name;
- if (ts.isBindingPattern(name_22) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) {
+ var name_21 = _a[_i].name;
+ if (ts.isBindingPattern(name_21) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -31007,9 +31292,9 @@ var ts;
case 158:
case 149:
case 148:
- var parent_10 = node.parent;
- if (node === parent_10.type) {
- return parent_10;
+ var parent_9 = node.parent;
+ if (node === parent_9.type) {
+ return parent_9;
}
}
}
@@ -31019,15 +31304,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_23 = element.name;
- if (name_23.kind === 70 &&
- name_23.text === predicateVariableName) {
+ var name_22 = element.name;
+ if (name_22.kind === 70 &&
+ name_22.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_23.kind === 173 ||
- name_23.kind === 172) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) {
+ else if (name_22.kind === 173 ||
+ name_22.kind === 172) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -31258,8 +31543,8 @@ var ts;
if (superCallShouldBeFirst) {
var statements = node.body.statements;
var superCallStatement = void 0;
- for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
- var statement = statements_2[_i];
+ for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
+ var statement = statements_3[_i];
if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
@@ -31402,7 +31687,7 @@ var ts;
var type = getTypeFromMappedTypeNode(node);
var constraintType = getConstraintTypeFromMappedType(type);
var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
- checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint);
+ checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
}
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node);
@@ -31646,10 +31931,10 @@ var ts;
case 229:
return 2097152 | 1048576;
case 234:
- var result_2 = 0;
+ var result_3 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
- return result_2;
+ ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });
+ return result_3;
default:
return 1048576;
}
@@ -32188,8 +32473,8 @@ var ts;
container.kind === 230 ||
container.kind === 261);
if (!namesShareScope) {
- var name_24 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24);
+ var name_23 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);
}
}
}
@@ -32260,13 +32545,13 @@ var ts;
if (node.propertyName && node.propertyName.kind === 142) {
checkComputedPropertyName(node.propertyName);
}
- var parent_11 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_11);
- var name_25 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25));
+ var parent_10 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_10);
+ var name_24 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24));
markPropertyAsReferenced(property);
- if (parent_11.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property);
+ if (parent_10.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);
}
}
if (ts.isBindingPattern(node.name)) {
@@ -32427,6 +32712,7 @@ var ts;
}
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
+ var rightType = checkNonNullExpression(node.expression);
if (node.initializer.kind === 224) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
@@ -32440,15 +32726,14 @@ var ts;
if (varExpr.kind === 175 || varExpr.kind === 176) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
- else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) {
+ else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
- var rightType = checkNonNullExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
checkSourceElement(node.statement);
@@ -32573,12 +32858,12 @@ var ts;
var arrayType = arrayOrStringType;
if (arrayOrStringType.flags & 65536) {
var arrayTypes = arrayOrStringType.types;
- var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); });
+ var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); });
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, true);
}
}
- else if (arrayOrStringType.flags & 34) {
+ else if (arrayOrStringType.flags & 262178) {
arrayType = neverType;
}
var hasStringConstituent = arrayOrStringType !== arrayType;
@@ -32603,7 +32888,7 @@ var ts;
}
var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType;
if (hasStringConstituent) {
- if (arrayElementType.flags & 34) {
+ if (arrayElementType.flags & 262178) {
return stringType;
}
return getUnionType([arrayElementType, stringType], true);
@@ -33287,7 +33572,7 @@ var ts;
return undefined;
}
}
- enumType_1 = checkExpression(expression);
+ enumType_1 = getTypeOfExpression(expression);
if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) {
return undefined;
}
@@ -33482,9 +33767,9 @@ var ts;
break;
case 174:
case 223:
- var name_26 = node.name;
- if (ts.isBindingPattern(name_26)) {
- for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) {
+ var name_25 = node.name;
+ if (ts.isBindingPattern(name_25)) {
+ for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {
var el = _c[_b];
checkModuleAugmentationElement(el, isGlobalAugmentation);
}
@@ -34222,7 +34507,7 @@ var ts;
}
}
case 96:
- var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
+ var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case 167:
return getTypeFromTypeNode(node).symbol;
@@ -34244,7 +34529,7 @@ var ts;
}
case 8:
if (node.parent.kind === 178 && node.parent.argumentExpression === node) {
- var objectType = checkExpression(node.parent.expression);
+ var objectType = getTypeOfExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
var apparentType = getApparentType(objectType);
@@ -34275,7 +34560,7 @@ var ts;
return getTypeFromTypeNode(node);
}
if (ts.isPartOfExpression(node)) {
- return getTypeOfExpression(node);
+ return getRegularTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
@@ -34313,7 +34598,7 @@ var ts;
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 192) {
- var iteratedType = checkExpression(expr.parent.right);
+ var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 257) {
@@ -34329,11 +34614,11 @@ var ts;
var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);
}
- function getTypeOfExpression(expr) {
+ function getRegularTypeOfExpression(expr) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
- return getRegularTypeOfLiteralType(checkExpression(expr));
+ return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
function getParentTypeOfClassElement(node) {
var classSymbol = getSymbolOfNode(node.parent);
@@ -34356,9 +34641,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456) {
var symbols_3 = [];
- var name_27 = symbol.name;
+ var name_26 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_27);
+ var symbol = getPropertyOfType(t, name_26);
if (symbol) {
symbols_3.push(symbol);
}
@@ -34411,7 +34696,7 @@ var ts;
}
function isNameOfModuleOrEnumDeclaration(node) {
var parent = node.parent;
- return ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
+ return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
}
function getReferencedExportContainer(node, prefixLocals) {
node = ts.getParseTreeNode(node, ts.isIdentifier);
@@ -34619,7 +34904,7 @@ var ts;
else if (isTypeOfKind(type, 340)) {
return ts.TypeReferenceSerializationKind.NumberLikeType;
}
- else if (isTypeOfKind(type, 34)) {
+ else if (isTypeOfKind(type, 262178)) {
return ts.TypeReferenceSerializationKind.StringLikeType;
}
else if (isTupleType(type)) {
@@ -34650,7 +34935,7 @@ var ts;
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
}
function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {
- var type = getWidenedType(getTypeOfExpression(expr));
+ var type = getWidenedType(getRegularTypeOfExpression(expr));
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
}
function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {
@@ -34669,9 +34954,9 @@ var ts;
}
var location = reference;
if (startInDeclarationContainer) {
- var parent_12 = reference.parent;
- if (ts.isDeclaration(parent_12) && reference === parent_12.name) {
- location = getDeclarationContainer(parent_12);
+ var parent_11 = reference.parent;
+ if (ts.isDeclaration(parent_11) && reference === parent_11.name) {
+ location = getDeclarationContainer(parent_11);
}
}
return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined);
@@ -34784,9 +35069,9 @@ var ts;
}
var current = symbol;
while (true) {
- var parent_13 = getParentOfSymbol(current);
- if (parent_13) {
- current = parent_13;
+ var parent_12 = getParentOfSymbol(current);
+ if (parent_12) {
+ current = parent_12;
}
else {
break;
@@ -35463,9 +35748,9 @@ var ts;
if (prop.kind === 259) {
continue;
}
- var name_28 = prop.name;
- if (name_28.kind === 142) {
- checkGrammarComputedPropertyName(name_28);
+ var name_27 = prop.name;
+ if (name_27.kind === 142) {
+ checkGrammarComputedPropertyName(name_27);
}
if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) {
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -35481,8 +35766,8 @@ var ts;
var currentKind = void 0;
if (prop.kind === 257 || prop.kind === 258) {
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_28.kind === 8) {
- checkGrammarNumericLiteral(name_28);
+ if (name_27.kind === 8) {
+ checkGrammarNumericLiteral(name_27);
}
currentKind = Property;
}
@@ -35498,7 +35783,7 @@ var ts;
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27);
if (effectiveName === undefined) {
continue;
}
@@ -35508,18 +35793,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));
+ grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -35532,12 +35817,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_29 = jsxAttr.name;
- if (!seen[name_29.text]) {
- seen[name_29.text] = true;
+ var name_28 = jsxAttr.name;
+ if (!seen[name_28.text]) {
+ seen[name_28.text] = true;
}
else {
- return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 252 && !initializer.expression) {
@@ -35985,10 +36270,15 @@ var ts;
function reduceNode(node, f, initial) {
return node ? f(initial, node) : initial;
}
- function reduceEachChild(node, f, initial) {
+ function reduceNodeArray(nodes, f, initial) {
+ return nodes ? f(initial, nodes) : initial;
+ }
+ function reduceEachChild(node, initial, cbNode, cbNodeArray) {
if (node === undefined) {
return initial;
}
+ var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
+ var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
if ((kind > 0 && kind <= 140)) {
return initial;
@@ -36002,108 +36292,108 @@ var ts;
case 206:
case 198:
case 222:
- case 292:
+ case 293:
break;
case 142:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 144:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 145:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 147:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 149:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 150:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 151:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 152:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 172:
case 173:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 174:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 175:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 176:
- result = ts.reduceLeft(node.properties, f, result);
+ result = reduceNodes(node.properties, cbNodes, result);
break;
case 177:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 178:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.argumentExpression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.argumentExpression, cbNode, result);
break;
case 179:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 180:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 181:
- result = reduceNode(node.tag, f, result);
- result = reduceNode(node.template, f, result);
+ result = reduceNode(node.tag, cbNode, result);
+ result = reduceNode(node.template, cbNode, result);
break;
case 184:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 185:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 183:
case 186:
@@ -36113,205 +36403,205 @@ var ts;
case 195:
case 196:
case 201:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 190:
case 191:
- result = reduceNode(node.operand, f, result);
+ result = reduceNode(node.operand, cbNode, result);
break;
case 192:
- result = reduceNode(node.left, f, result);
- result = reduceNode(node.right, f, result);
+ result = reduceNode(node.left, cbNode, result);
+ result = reduceNode(node.right, cbNode, result);
break;
case 193:
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.whenTrue, f, result);
- result = reduceNode(node.whenFalse, f, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.whenTrue, cbNode, result);
+ result = reduceNode(node.whenFalse, cbNode, result);
break;
case 194:
- result = reduceNode(node.head, f, result);
- result = ts.reduceLeft(node.templateSpans, f, result);
+ result = reduceNode(node.head, cbNode, result);
+ result = reduceNodes(node.templateSpans, cbNodes, result);
break;
case 197:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 199:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
break;
case 202:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.literal, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.literal, cbNode, result);
break;
case 204:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 205:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.declarationList, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.declarationList, cbNode, result);
break;
case 207:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 208:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.thenStatement, f, result);
- result = reduceNode(node.elseStatement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.thenStatement, cbNode, result);
+ result = reduceNode(node.elseStatement, cbNode, result);
break;
case 209:
- result = reduceNode(node.statement, f, result);
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.statement, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 210:
case 217:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 211:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.incrementor, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.incrementor, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 212:
case 213:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 216:
case 220:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 218:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.caseBlock, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.caseBlock, cbNode, result);
break;
case 219:
- result = reduceNode(node.label, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.label, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 221:
- result = reduceNode(node.tryBlock, f, result);
- result = reduceNode(node.catchClause, f, result);
- result = reduceNode(node.finallyBlock, f, result);
+ result = reduceNode(node.tryBlock, cbNode, result);
+ result = reduceNode(node.catchClause, cbNode, result);
+ result = reduceNode(node.finallyBlock, cbNode, result);
break;
case 223:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 224:
- result = ts.reduceLeft(node.declarations, f, result);
+ result = reduceNodes(node.declarations, cbNodes, result);
break;
case 225:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 226:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 232:
- result = ts.reduceLeft(node.clauses, f, result);
+ result = reduceNodes(node.clauses, cbNodes, result);
break;
case 235:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.importClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.importClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 236:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 237:
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 238:
case 242:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 239:
case 243:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 240:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.expression, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 241:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.exportClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.exportClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 246:
- result = reduceNode(node.openingElement, f, result);
- result = ts.reduceLeft(node.children, f, result);
- result = reduceNode(node.closingElement, f, result);
+ result = reduceNode(node.openingElement, cbNode, result);
+ result = ts.reduceLeft(node.children, cbNode, result);
+ result = reduceNode(node.closingElement, cbNode, result);
break;
case 247:
case 248:
- result = reduceNode(node.tagName, f, result);
- result = ts.reduceLeft(node.attributes, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
+ result = reduceNodes(node.attributes, cbNodes, result);
break;
case 249:
- result = reduceNode(node.tagName, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
break;
case 250:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 251:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 252:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 253:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
case 254:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 255:
- result = ts.reduceLeft(node.types, f, result);
+ result = reduceNodes(node.types, cbNodes, result);
break;
case 256:
- result = reduceNode(node.variableDeclaration, f, result);
- result = reduceNode(node.block, f, result);
+ result = reduceNode(node.variableDeclaration, cbNode, result);
+ result = reduceNode(node.block, cbNode, result);
break;
case 257:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 258:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.objectAssignmentInitializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
case 259:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 261:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
- case 293:
- result = reduceNode(node.expression, f, result);
+ case 294:
+ result = reduceNode(node.expression, cbNode, result);
break;
default:
var edgeTraversalPath = nodeEdgeTraversalMap[kind];
@@ -36321,8 +36611,8 @@ var ts;
var value = node[edge.name];
if (value !== undefined) {
result = ts.isArray(value)
- ? ts.reduceLeft(value, f, result)
- : f(result, value);
+ ? reduceNodes(value, cbNodes, result)
+ : cbNode(result, value);
}
}
}
@@ -36332,8 +36622,8 @@ var ts;
}
ts.reduceEachChild = reduceEachChild;
function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {
- if (node === undefined) {
- return undefined;
+ if (node === undefined || visitor === undefined) {
+ return node;
}
aggregateTransformFlags(node);
var visited = visitor(node);
@@ -36410,6 +36700,35 @@ var ts;
return updated || nodes;
}
ts.visitNodes = visitNodes;
+ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
+ context.startLexicalEnvironment();
+ statements = visitNodes(statements, visitor, ts.isStatement, start);
+ if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
+ statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements);
+ }
+ var declarations = context.endLexicalEnvironment();
+ return ts.createNodeArray(ts.concatenate(statements, declarations), statements);
+ }
+ ts.visitLexicalEnvironment = visitLexicalEnvironment;
+ function visitParameterList(nodes, visitor, context) {
+ context.startLexicalEnvironment();
+ var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);
+ context.suspendLexicalEnvironment();
+ return updated;
+ }
+ ts.visitParameterList = visitParameterList;
+ function visitFunctionBody(node, visitor, context) {
+ context.resumeLexicalEnvironment();
+ var updated = visitNode(node, visitor, ts.isConciseBody);
+ var declarations = context.endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(updated);
+ var statements = mergeLexicalEnvironment(block.statements, declarations);
+ return ts.updateBlock(block, statements);
+ }
+ return updated;
+ }
+ ts.visitFunctionBody = visitFunctionBody;
function visitEachChild(node, visitor, context) {
if (node === undefined) {
return undefined;
@@ -36430,23 +36749,23 @@ var ts;
case 142:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
case 144:
- return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 147:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 149:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 150:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 151:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 152:
- return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 172:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 173:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 174:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
case 175:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
case 176:
@@ -36464,9 +36783,9 @@ var ts;
case 183:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 184:
- return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 185:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 186:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 187:
@@ -36534,7 +36853,7 @@ var ts;
case 224:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 225:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 226:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
case 232:
@@ -36586,9 +36905,8 @@ var ts;
case 259:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
case 261:
- context.startLexicalEnvironment();
- return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
- case 293:
+ return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
+ case 294:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -36616,6 +36934,15 @@ var ts;
}
}
ts.visitEachChild = visitEachChild;
+ function mergeLexicalEnvironment(statements, declarations) {
+ if (!ts.some(declarations)) {
+ return statements;
+ }
+ return ts.isNodeArray(statements)
+ ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)
+ : ts.addRange(statements, declarations);
+ }
+ ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function mergeFunctionBodyLexicalEnvironment(body, declarations) {
if (body && declarations !== undefined && declarations.length > 0) {
if (ts.isBlock(body)) {
@@ -36646,22 +36973,37 @@ var ts;
if (node === undefined) {
return 0;
}
- else if (node.transformFlags & 536870912) {
+ if (node.transformFlags & 536870912) {
return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);
}
- else {
- var subtreeFlags = aggregateTransformFlagsForSubtree(node);
- return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ var subtreeFlags = aggregateTransformFlagsForSubtree(node);
+ return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ }
+ function aggregateTransformFlagsForNodeArray(nodes) {
+ if (nodes === undefined) {
+ return 0;
}
+ var subtreeFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
+ var node = nodes_3[_i];
+ subtreeFlags |= aggregateTransformFlagsForNode(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ return subtreeFlags;
}
function aggregateTransformFlagsForSubtree(node) {
if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) {
return 0;
}
- return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0);
+ return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
+ }
+ function aggregateTransformFlagsForChildNode(transformFlags, node) {
+ return transformFlags | aggregateTransformFlagsForNode(node);
}
- function aggregateTransformFlagsForChildNode(transformFlags, child) {
- return transformFlags | aggregateTransformFlagsForNode(child);
+ function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
+ return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
var Debug;
(function (Debug) {
@@ -36671,9 +37013,21 @@ var ts;
Debug.failBadSyntaxKind = Debug.shouldAssert(1)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
: ts.noop;
+ Debug.assertEachNode = Debug.shouldAssert(1)
+ ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
Debug.assertNode = Debug.shouldAssert(1)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
: ts.noop;
+ Debug.assertOptionalNode = Debug.shouldAssert(1)
+ ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
+ Debug.assertOptionalToken = Debug.shouldAssert(1)
+ ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); }
+ : ts.noop;
+ Debug.assertMissingNode = Debug.shouldAssert(1)
+ ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); }
+ : ts.noop;
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -36692,440 +37046,316 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
- if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
- var right = node.right;
- if (ts.isDestructuringAssignment(right)) {
- return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor);
- }
- else {
- return node.right;
- }
- }
+ function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
var location = node;
- var value = node.right;
- var expressions = [];
- if (needsValue) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor);
+ var value;
+ if (ts.isDestructuringAssignment(node)) {
+ value = node.right;
+ while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
+ if (ts.isDestructuringAssignment(value)) {
+ location = node = value;
+ value = node.right;
+ }
+ else {
+ return value;
+ }
+ }
}
- else if (ts.nodeIsSynthesized(node)) {
- location = value;
+ var expressions;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: true,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,
+ createArrayBindingOrAssignmentElement: makeAssignmentElement,
+ visitor: visitor
+ };
+ if (value) {
+ value = ts.visitNode(value, visitor, ts.isExpression);
+ if (needsValue) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ }
+ else if (ts.nodeIsSynthesized(node)) {
+ location = value;
+ }
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- if (needsValue) {
+ flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));
+ if (value && needsValue) {
+ if (!ts.some(expressions)) {
+ return value;
+ }
expressions.push(value);
}
- var expression = ts.inlineExpressions(expressions);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location) {
- var expression = ts.createAssignment(name, value, location);
- ts.setEmitFlags(expression, 2048);
+ return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();
+ function emitExpression(expression) {
+ ts.setEmitFlags(expression, 64);
ts.aggregateTransformFlags(expression);
- expressions.push(expression);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitAssignment(name, value, location);
- return name;
+ expressions = ts.append(expressions, expression);
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectLiteral(elements), value, location);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(target, value, location)
+ : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);
+ expression.original = original;
+ emitExpression(expression);
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
- function flattenParameterDestructuring(node, value, visitor, transformRest) {
+ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
+ var pendingExpressions;
+ var pendingDeclarations = [];
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location) {
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- ts.setEmitFlags(declaration, 2048);
- ts.aggregateTransformFlags(declaration);
- declarations.push(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(undefined);
- emitAssignment(name, value, location);
- return name;
- }
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location);
- }
- }
- ts.flattenParameterDestructuring = flattenParameterDestructuring;
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
- var declarations = [];
- var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location, original) {
- if (pendingAssignments) {
- pendingAssignments.push(value);
- value = ts.inlineExpressions(pendingAssignments);
- pendingAssignments = undefined;
- }
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- declaration.original = original;
- ts.setEmitFlags(declaration, 2048);
- declarations.push(declaration);
- ts.aggregateTransformFlags(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- if (recordTempVariable) {
- var assignment = ts.createAssignment(name, value, location);
- if (pendingAssignments) {
- pendingAssignments.push(assignment);
- }
- else {
- pendingAssignments = [assignment];
- }
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: hoistTempVariables,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,
+ createArrayBindingOrAssignmentElement: makeBindingElement,
+ visitor: visitor
+ };
+ flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
+ if (pendingExpressions) {
+ var temp = ts.createTempVariable(undefined);
+ if (hoistTempVariables) {
+ var value = ts.inlineExpressions(pendingExpressions);
+ pendingExpressions = undefined;
+ emitBindingOrAssignment(temp, value, undefined, undefined);
}
else {
- emitAssignment(name, value, location, undefined);
+ context.hoistVariableDeclaration(temp);
+ var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);
+ pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));
+ ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
+ pendingDeclaration.value = temp;
}
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
- }
- }
- ts.flattenVariableDestructuring = flattenVariableDestructuring;
- function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
- var pendingAssignments = [];
- flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor);
- var expression = ts.inlineExpressions(pendingAssignments);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location, original) {
- var expression = createAssignmentCallback
- ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location)
- : ts.createAssignment(name, value, location);
- emitPendingAssignment(expression, original);
}
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(ts.createAssignment(name, value, location), undefined);
- return name;
+ for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
+ var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;
+ var variable = ts.createVariableDeclaration(name_29, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);
+ variable.original = original;
+ if (ts.isIdentifier(name_29)) {
+ ts.setEmitFlags(variable, 64);
+ }
+ ts.aggregateTransformFlags(variable);
+ declarations.push(variable);
}
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectLiteral(elements), value, location, original);
+ return declarations;
+ function emitExpression(value) {
+ pendingExpressions = ts.append(pendingExpressions, value);
}
- function emitPendingAssignment(expression, original) {
- expression.original = original;
- ts.setEmitFlags(expression, 2048);
- pendingAssignments.push(expression);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, ts.isBindingName);
+ if (pendingExpressions) {
+ value = ts.inlineExpressions(ts.append(pendingExpressions, value));
+ pendingExpressions = undefined;
+ }
+ pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
}
}
- ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
- if (value && visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
- }
- if (ts.isBinaryExpression(root)) {
- emitDestructuringAssignment(root.left, value, location);
- }
- else {
- emitBindingElement(root, value);
- }
- function emitDestructuringAssignment(bindingTarget, value, location) {
- var target;
- if (ts.isShorthandPropertyAssignment(bindingTarget)) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression)
- : bindingTarget.objectAssignmentInitializer;
- if (initializer) {
- value = createDefaultValueCheck(value, initializer, location);
- }
- target = bindingTarget.name;
- }
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
- : bindingTarget.right;
- value = createDefaultValueCheck(value, initializer, location);
- target = bindingTarget.left;
+ ts.flattenDestructuringBinding = flattenDestructuringBinding;
+ function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
+ if (!skipInitializer) {
+ var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
+ if (initializer) {
+ value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;
}
- else {
- target = bindingTarget;
- }
- if (target.kind === 176) {
- emitObjectLiteralAssignment(target, value, location);
- }
- else if (target.kind === 175) {
- emitArrayLiteralAssignment(target, value, location);
- }
- else {
- var name_30 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_30, target);
- ts.setCommentRange(name_30, target);
- emitAssignment(name_30, value, location, undefined);
+ else if (!value) {
+ value = ts.createVoidZero();
}
}
- function emitObjectLiteralAssignment(target, value, location) {
- var properties = target.properties;
- if (properties.length !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var bindingElements = [];
- for (var i = 0; i < properties.length; i++) {
- var p = properties[i];
- if (p.kind === 257 || p.kind === 258) {
- if (!transformRest ||
- p.transformFlags & 8388608 ||
- (p.kind === 257 && p.initializer.transformFlags & 8388608)) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.name;
- var bindingTarget = p.kind === 258 ? p : p.initializer || propName;
- emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
- }
- else {
- bindingElements.push(p);
- }
- }
- else if (i === properties.length - 1 &&
- p.kind === 259 &&
- p.expression.kind === 70) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.expression;
- var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
- emitDestructuringAssignment(propName, restCall, p);
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
+ var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
+ if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
+ flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitArrayLiteralAssignment(target, value, location) {
- if (transformRest) {
- emitESNextArrayLiteralAssignment(target, value, location);
- }
- else {
- emitES2015ArrayLiteralAssignment(target, value, location);
- }
+ else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
+ flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitESNextArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var expressions = [];
- var spreadContainingExpressions = [];
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind === 198) {
- continue;
- }
- if (e.transformFlags & 8388608 && i < numElements - 1) {
- var tmp = ts.createTempVariable(recordTempVariable);
- spreadContainingExpressions.push([e, tmp]);
- expressions.push(tmp);
+ else {
+ flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);
+ }
+ }
+ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var computedTempVariables;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
+ if (flattenContext.level >= 1
+ && !(element.transformFlags & (524288 | 1048576))
+ && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576))
+ && !ts.isComputedPropertyName(propertyName)) {
+ bindingElements = ts.append(bindingElements, element);
}
else {
- expressions.push(e);
- }
- }
- emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
- for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
- var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
- emitDestructuringAssignment(e, tmp, e);
- }
- }
- function emitES2015ArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind !== 198) {
- if (e.kind !== 196) {
- emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- else if (i === numElements - 1) {
- emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e);
+ var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
+ if (ts.isComputedPropertyName(propertyName)) {
+ computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
}
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- }
- function createRestCall(value, elements, getPropertyName, location) {
- var propertyNames = [];
- for (var i = 0; i < elements.length - 1; i++) {
- if (ts.isOmittedExpression(elements[i])) {
- continue;
+ else if (i === numElements - 1) {
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- var str = ts.createSynthesizedNode(9);
- str.pos = location.pos;
- str.end = location.end;
- str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
- propertyNames.push(str);
+ var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
- return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
}
- function emitBindingElement(target, value) {
- var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (transformRest) {
- value = value || initializer;
- }
- else if (initializer) {
- value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
- }
- else if (!value) {
- value = ts.createVoidZero();
- }
- var name = target.name;
- if (!ts.isBindingPattern(name)) {
- emitAssignment(name, value, target, target);
- }
- else {
- var numElements = name.elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment);
- }
- if (name.kind === 173) {
- emitArrayBindingElement(name, value);
- }
- else {
- emitObjectBindingElement(target, value);
- }
- }
- }
- function emitArrayBindingElement(name, value) {
- if (transformRest) {
- emitESNextArrayBindingElement(name, value);
- }
- else {
- emitES2015ArrayBindingElement(name, value);
- }
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function emitES2015ArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (!element.dotDotDotToken) {
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
- }
+ }
+ function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
}
- function emitESNextArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- var spreadContainingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (element.transformFlags & 8388608 && i < numElements - 1) {
- spreadContainingElements.push(element);
- bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
+ var bindingElements;
+ var restContainingElements;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (flattenContext.level >= 1) {
+ if (element.transformFlags & 1048576) {
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ }
+ restContainingElements = ts.append(restContainingElements, [temp, element]);
+ bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
}
else {
- bindingElements.push(element);
+ bindingElements = ts.append(bindingElements, element);
}
}
- emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
- for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
- var element = spreadContainingElements_1[_i];
- emitBindingElement(element, ts.getGeneratedNameForNode(element));
+ else if (ts.isOmittedExpression(element)) {
+ continue;
}
- }
- function emitObjectBindingElement(target, value) {
- var name = target.name;
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (i === numElements - 1 && element.dotDotDotToken) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
- emitBindingElement(element, restCall);
- }
- else if (transformRest && !(element.transformFlags & 8388608)) {
- bindingElements.push(element);
- }
- else {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
+ else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var rhsValue = ts.createElementAccess(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
+ else if (i === numElements - 1) {
+ var rhsValue = ts.createArraySlice(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- function createDefaultValueCheck(value, defaultValue, location) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function createDestructuringPropertyAccess(expression, propertyName) {
- if (ts.isComputedPropertyName(propertyName)) {
- return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment));
- }
- else if (ts.isLiteralExpression(propertyName)) {
- var clone_2 = ts.getSynthesizedClone(propertyName);
- clone_2.text = ts.unescapeIdentifier(clone_2.text);
- return ts.createElementAccess(expression, clone_2);
- }
- else {
- if (ts.isGeneratedIdentifier(propertyName)) {
- var clone_3 = ts.getSynthesizedClone(propertyName);
- clone_3.text = ts.unescapeIdentifier(clone_3.text);
- return ts.createPropertyAccess(expression, clone_3);
- }
- else {
- return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)));
- }
+ if (restContainingElements) {
+ for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
+ var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
+ flattenBindingOrAssignmentElement(flattenContext, element, id, element);
}
}
}
- function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) {
+ function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value);
+ }
+ function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else if (ts.isStringOrNumericLiteral(propertyName)) {
+ var argumentExpression = ts.getSynthesizedClone(propertyName);
+ argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else {
+ var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));
+ return ts.createPropertyAccess(value, name_30);
+ }
+ }
+ function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
return value;
}
else {
- if (visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ flattenContext.emitExpression(ts.createAssignment(temp, value, location));
+ }
+ else {
+ flattenContext.emitBindingOrAssignment(temp, value, location, undefined);
}
- return emitTempVariableAssignment(value, location);
+ return temp;
}
}
+ function makeArrayBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
+ return ts.createArrayBindingPattern(elements);
+ }
+ function makeArrayAssignmentPattern(elements) {
+ return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));
+ }
+ function makeObjectBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isBindingElement);
+ return ts.createObjectBindingPattern(elements);
+ }
+ function makeObjectAssignmentPattern(elements) {
+ return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));
+ }
+ function makeBindingElement(name) {
+ return ts.createBindingElement(undefined, undefined, name);
+ }
+ function makeAssignmentElement(name) {
+ return name;
+ }
+ var restHelper = {
+ name: "typescript:rest",
+ scoped: false,
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ };
+ function createRestCall(context, value, elements, computedTempVariables, location) {
+ context.requestEmitHelper(restHelper);
+ var propertyNames = [];
+ var computedTempVariableOffset = 0;
+ for (var i = 0; i < elements.length - 1; i++) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
+ if (propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var temp = computedTempVariables[computedTempVariableOffset];
+ computedTempVariableOffset++;
+ propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral(""))));
+ }
+ else {
+ propertyNames.push(ts.createLiteral(propertyName));
+ }
+ }
+ }
+ return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
var USE_NEW_TYPE_METADATA_FORMAT = false;
function transformTypeScript(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -37141,7 +37371,6 @@ var ts;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentExternalHelpersModuleName;
var enabledSubstitutions;
var classAliases;
var applicableSubstitutions;
@@ -37150,7 +37379,11 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ currentSourceFile = node;
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function saveStateAndInvoke(node, f) {
var savedCurrentScope = currentScope;
@@ -37163,14 +37396,29 @@ var ts;
currentScope = savedCurrentScope;
return visited;
}
+ function onBeforeVisitNode(node) {
+ switch (node.kind) {
+ case 261:
+ case 232:
+ case 231:
+ case 204:
+ currentScope = node;
+ currentScopeFirstDeclarationsOfName = undefined;
+ break;
+ case 226:
+ case 225:
+ if (ts.hasModifier(node, 2)) {
+ break;
+ }
+ recordEmittedDeclarationInScope(node);
+ break;
+ }
+ }
function visitor(node) {
return saveStateAndInvoke(node, visitorWorker);
}
function visitorWorker(node) {
- if (node.kind === 261) {
- return visitSourceFile(node);
- }
- else if (node.transformFlags & 1) {
+ if (node.transformFlags & 1) {
return visitTypeScript(node);
}
else if (node.transformFlags & 2) {
@@ -37338,53 +37586,9 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- switch (node.kind) {
- case 261:
- case 232:
- case 231:
- case 204:
- currentScope = node;
- currentScopeFirstDeclarationsOfName = undefined;
- break;
- case 226:
- case 225:
- if (ts.hasModifier(node, 2)) {
- break;
- }
- recordEmittedDeclarationInScope(node);
- break;
- }
- }
function visitSourceFile(node) {
- currentSourceFile = node;
- if (compilerOptions.alwaysStrict &&
- !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) {
- node = ts.ensureUseStrict(node);
- }
- if (node.flags & 64512
- && compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
- var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText);
- var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- externalHelpersModuleImport.parent = node;
- externalHelpersModuleImport.flags &= ~8;
- statements.push(externalHelpersModuleImport);
- currentExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- currentExternalHelpersModuleName = undefined;
- node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
- node.externalHelpersModuleName = externalHelpersModuleName;
- }
- else {
- node = ts.visitEachChild(node, sourceElementVisitor, context);
- }
- ts.setEmitFlags(node, 1 | ts.getEmitFlags(node));
- return node;
+ var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);
+ return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));
}
function shouldEmitDecorateCallForClass(node) {
if (node.decorators && node.decorators.length > 0) {
@@ -37430,7 +37634,7 @@ var ts;
}
if (statements.length > 1) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432);
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -37438,7 +37642,7 @@ var ts;
var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);
var emitFlags = ts.getEmitFlags(node);
if (hasStaticProperties) {
- emitFlags |= 1024;
+ emitFlags |= 32;
}
ts.setOriginalNode(classDeclaration, node);
ts.setEmitFlags(classDeclaration, emitFlags);
@@ -37469,7 +37673,7 @@ var ts;
enableSubstitutionForClassAliases();
classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);
}
- ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression));
+ ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
@@ -37488,7 +37692,7 @@ var ts;
}
function transformConstructor(node, hasExtendsClause) {
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 4194304;
+ var hasParameterPropertyAssignments = node.transformFlags & 262144;
var constructor = ts.getFirstConstructorWithBody(node);
if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {
return ts.visitEachChild(constructor, visitor, context);
@@ -37498,14 +37702,13 @@ var ts;
return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));
}
function transformConstructorParameters(constructor) {
- return constructor
- ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
- : [];
+ return ts.visitParameterList(constructor && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
if (constructor) {
indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);
var propertyAssignments = getParametersWithPropertyAssignments(constructor);
@@ -37520,7 +37723,7 @@ var ts;
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
}
ts.addRange(statements, endLexicalEnvironment());
- return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true);
+ return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true);
}
function addPrologueDirectivesAndInitialSuperCall(ctor, result) {
if (ctor.body) {
@@ -37549,9 +37752,9 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name));
var name = node.name;
var propertyName = ts.getMutableClone(name);
- ts.setEmitFlags(propertyName, 49152 | 1536);
+ ts.setEmitFlags(propertyName, 1536 | 48);
var localName = ts.getMutableClone(name);
- ts.setEmitFlags(localName, 49152);
+ ts.setEmitFlags(localName, 1536);
return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1)));
}
function getInitializedProperties(node, isStatic) {
@@ -37724,8 +37927,8 @@ var ts;
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
- ts.setEmitFlags(helper, 49152);
+ var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ ts.setEmitFlags(helper, 1536);
return helper;
}
function addConstructorDecorationStatement(statements, node) {
@@ -37742,9 +37945,9 @@ var ts;
}
var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
var localName = ts.getLocalName(node, false, true);
- var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var decorate = createDecorateHelper(context, decoratorExpressions, localName);
var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
- ts.setEmitFlags(expression, 49152);
+ ts.setEmitFlags(expression, 1536);
ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
return expression;
}
@@ -37757,8 +37960,8 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression);
- ts.setEmitFlags(helper, 49152);
+ var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression);
+ ts.setEmitFlags(helper, 1536);
expressions.push(helper);
}
}
@@ -37775,13 +37978,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -37798,7 +38001,7 @@ var ts;
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
}
}
}
@@ -37967,7 +38170,7 @@ var ts;
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
- return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object"));
+ return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object"));
case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
return serializeEntityNameAsExpression(node.typeName, false);
case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
@@ -38023,7 +38226,7 @@ var ts;
return ts.createPropertyAccess(left, node.right);
}
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
var name = member.name;
@@ -38078,11 +38281,12 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function shouldEmitAccessorDeclaration(node) {
return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128));
@@ -38091,86 +38295,46 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitSetAccessor(node) {
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitFunctionDeclaration(node) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return ts.createNotEmittedStatement(node);
}
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
+ var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
if (isNamespaceExport(node)) {
- var statements = [func];
+ var statements = [updated];
addExportMemberAssignment(statements, node);
return statements;
}
- return func;
+ return updated;
}
function visitFunctionExpression(node) {
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformFunctionBodyWorker(node.body);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- currentScope = body;
- currentScopeFirstDeclarationsOfName = ts.createMap();
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- }
- function transformConciseBody(node) {
- return transformConciseBodyWorker(node.body, false);
- }
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
- if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
- }
- else {
- startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
- var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
- }
+ var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitParameter(node) {
if (ts.parameterIsThisKeyword(node)) {
@@ -38180,7 +38344,7 @@ var ts;
ts.setOriginalNode(parameter, node);
ts.setCommentRange(parameter, node);
ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));
- ts.setEmitFlags(parameter.name, 1024);
+ ts.setEmitFlags(parameter.name, 32);
return parameter;
}
function visitVariableStatement(node) {
@@ -38198,7 +38362,7 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);
@@ -38239,10 +38403,10 @@ var ts;
return undefined;
}
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -38334,13 +38498,13 @@ var ts;
ts.setSourceMapRange(statement, node);
}
ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 | 33554432);
+ ts.setEmitFlags(statement, 1024 | 2097152);
statements.push(statement);
return true;
}
else {
var mergeMarker = ts.createMergeDeclarationMarker(statement);
- ts.setEmitFlags(mergeMarker, 49152 | 33554432);
+ ts.setEmitFlags(mergeMarker, 1536 | 2097152);
statements.push(mergeMarker);
return false;
}
@@ -38352,10 +38516,10 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name.");
enableSubstitutionForNamespaceExports();
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -38411,7 +38575,7 @@ var ts;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);
if (body.kind !== 231) {
- ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152);
+ ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);
}
return block;
}
@@ -38486,7 +38650,7 @@ var ts;
return undefined;
}
var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);
- ts.setEmitFlags(moduleReference, 49152 | 65536);
+ ts.setEmitFlags(moduleReference, 1536 | 2048);
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node)
@@ -38639,10 +38803,10 @@ var ts;
if (declaration) {
var classAlias = classAliases[declaration.id];
if (classAlias) {
- var clone_4 = ts.getSynthesizedClone(classAlias);
- ts.setSourceMapRange(clone_4, node);
- ts.setCommentRange(clone_4, node);
- return clone_4;
+ var clone_2 = ts.getSynthesizedClone(classAlias);
+ ts.setSourceMapRange(clone_2, node);
+ ts.setCommentRange(clone_2, node);
+ return clone_2;
}
}
}
@@ -38650,7 +38814,7 @@ var ts;
return undefined;
}
function trySubstituteNamespaceExportedName(node) {
- if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var container = resolver.getReferencedExportContainer(node, false);
if (container && container.kind !== 261) {
var substitute = (applicableSubstitutions & 2 && container.kind === 230) ||
@@ -38695,10 +38859,278 @@ var ts;
}
}
ts.transformTypeScript = transformTypeScript;
+ var paramHelper = {
+ name: "typescript:param",
+ scoped: false,
+ priority: 4,
+ text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
+ };
+ function createParamHelper(context, expression, parameterOffset, location) {
+ context.requestEmitHelper(paramHelper);
+ return ts.createCall(ts.getHelperName("__param"), undefined, [
+ ts.createLiteral(parameterOffset),
+ expression
+ ], location);
+ }
+ var metadataHelper = {
+ name: "typescript:metadata",
+ scoped: false,
+ priority: 3,
+ text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
+ };
+ function createMetadataHelper(context, metadataKey, metadataValue) {
+ context.requestEmitHelper(metadataHelper);
+ return ts.createCall(ts.getHelperName("__metadata"), undefined, [
+ ts.createLiteral(metadataKey),
+ metadataValue
+ ]);
+ }
+ var decorateHelper = {
+ name: "typescript:decorate",
+ scoped: false,
+ priority: 2,
+ text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
+ };
+ function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {
+ context.requestEmitHelper(decorateHelper);
+ var argumentsArray = [];
+ argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
+ }
+ return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location);
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformESNext(context) {
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ return visited;
+ }
+ function visitor(node) {
+ return visitorWorker(node, false);
+ }
+ function visitorNoDestructuringValue(node) {
+ return visitorWorker(node, true);
+ }
+ function visitorWorker(node, noDestructuringValue) {
+ if ((node.transformFlags & 8) === 0) {
+ return node;
+ }
+ switch (node.kind) {
+ case 176:
+ return visitObjectLiteralExpression(node);
+ case 192:
+ return visitBinaryExpression(node, noDestructuringValue);
+ case 223:
+ return visitVariableDeclaration(node);
+ case 213:
+ return visitForOfStatement(node);
+ case 211:
+ return visitForStatement(node);
+ case 188:
+ return visitVoidExpression(node);
+ case 150:
+ return visitConstructorDeclaration(node);
+ case 149:
+ return visitMethodDeclaration(node);
+ case 151:
+ return visitGetAccessorDeclaration(node);
+ case 152:
+ return visitSetAccessorDeclaration(node);
+ case 225:
+ return visitFunctionDeclaration(node);
+ case 184:
+ return visitFunctionExpression(node);
+ case 185:
+ return visitArrowFunction(node);
+ case 144:
+ return visitParameter(node);
+ case 207:
+ return visitExpressionStatement(node);
+ case 183:
+ return visitParenthesizedExpression(node, noDestructuringValue);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 259) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 257) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ if (node.transformFlags & 1048576) {
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 176) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return createAssignHelper(context, objects);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitExpressionStatement(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitParenthesizedExpression(node, noDestructuringValue) {
+ return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);
+ }
+ function visitBinaryExpression(node, noDestructuringValue) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue);
+ }
+ else if (node.operatorToken.kind === 25) {
+ return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitVariableDeclaration(node) {
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) {
+ return ts.flattenDestructuringBinding(node, visitor, context, 1);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitForStatement(node) {
+ return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));
+ }
+ function visitVoidExpression(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitForOfStatement(node) {
+ var leadingStatements;
+ var temp;
+ var initializer = ts.skipParentheses(node.initializer);
+ if (initializer.transformFlags & 1048576) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var firstDeclaration = ts.firstOrUndefined(initializer.declarations);
+ var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ else if (ts.isAssignmentPattern(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1);
+ leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer));
+ }
+ }
+ if (temp) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var block = ts.isBlock(statement)
+ ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))
+ : ts.createBlock(ts.append(leadingStatements, statement), statement, true);
+ return ts.updateForOf(node, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, undefined, node.initializer)
+ ], node.initializer, 1), expression, block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParameter(node) {
+ if (node.transformFlags & 1048576) {
+ return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitConstructorDeclaration(node) {
+ return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitGetAccessorDeclaration(node) {
+ return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitSetAccessorDeclaration(node) {
+ return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitMethodDeclaration(node) {
+ return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionDeclaration(node) {
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitArrowFunction(node) {
+ return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionExpression(node) {
+ return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function transformFunctionBody(node) {
+ resumeLexicalEnvironment();
+ var leadingStatements;
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ if (parameter.transformFlags & 1048576) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations));
+ ts.setEmitFlags(statement, 524288);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ }
+ var body = ts.visitNode(node.body, visitor, ts.isConciseBody);
+ var trailingStatements = endLexicalEnvironment();
+ if (ts.some(leadingStatements) || ts.some(trailingStatements)) {
+ var block = ts.convertToFunctionBody(body, true);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
+ }
+ return body;
+ }
+ }
+ ts.transformESNext = transformESNext;
+ var assignHelper = {
+ name: "typescript:assign",
+ scoped: false,
+ priority: 1,
+ text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
+ };
+ function createAssignHelper(context, attributesSegments) {
+ context.requestEmitHelper(assignHelper);
+ return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments);
+ }
+ ts.createAssignHelper = createAssignHelper;
})(ts || (ts = {}));
var ts;
(function (ts) {
- var entities = createEntitiesMap();
function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
var currentSourceFile;
@@ -38708,17 +39140,15 @@ var ts;
return node;
}
currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined;
- return node;
+ return visited;
}
function visitor(node) {
if (node.transformFlags & 4) {
return visitorWorker(node);
}
- else if (node.transformFlags & 8) {
- return ts.visitEachChild(node, visitor, context);
- }
else {
return node;
}
@@ -38732,8 +39162,7 @@ var ts;
case 252:
return visitJsxExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ return ts.visitEachChild(node, visitor, context);
}
}
function transformJsxChildToExpression(node) {
@@ -38771,8 +39200,10 @@ var ts;
if (ts.isJsxSpreadAttribute(attrs[0])) {
segments.unshift(ts.createObjectLiteral());
}
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
+ objectProperties = ts.singleOrUndefined(segments);
+ if (!objectProperties) {
+ objectProperties = ts.createAssignHelper(context, segments);
+ }
}
var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
@@ -38888,458 +39319,291 @@ var ts;
}
}
ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformESNext(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
- function visitor(node) {
- if (node.transformFlags & 16) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 32) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 176:
- return visitObjectLiteralExpression(node);
- case 192:
- return visitBinaryExpression(node);
- case 223:
- return visitVariableDeclaration(node);
- case 213:
- return visitForOfStatement(node);
- case 172:
- case 173:
- return node;
- case 225:
- return visitFunctionDeclaration(node);
- case 184:
- return visitFunctionExpression(node);
- case 185:
- return visitArrowFunction(node);
- case 144:
- return visitParameter(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
- }
- }
- function chunkObjectLiteralElements(elements) {
- var chunkObject;
- var objects = [];
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
- var e = elements_3[_i];
- if (e.kind === 259) {
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- chunkObject = undefined;
- }
- var target = e.expression;
- objects.push(ts.visitNode(target, visitor, ts.isExpression));
- }
- else {
- if (!chunkObject) {
- chunkObject = [];
- }
- if (e.kind === 257) {
- var p = e;
- chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
- }
- else {
- chunkObject.push(e);
- }
- }
- }
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- }
- return objects;
- }
- function visitObjectLiteralExpression(node) {
- if (ts.forEach(node.properties, function (p) { return p.kind === 259; })) {
- var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 176) {
- objects.unshift(ts.createObjectLiteral());
- }
- return ts.aggregateTransformFlags(ts.createCall(ts.createIdentifier("__assign"), undefined, objects));
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitBinaryExpression(node) {
- if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true);
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitVariableDeclaration(node) {
- if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) {
- var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true);
- return result;
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitForOfStatement(node) {
- var initializer = node.initializer;
- if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
- return ts.visitEachChild(node, visitor, context);
- }
- return ts.convertForOf(node, undefined, visitor, ts.noop, context, true);
- }
- function isRestBindingPattern(initializer) {
- if (ts.isVariableDeclarationList(initializer)) {
- var declaration = ts.firstOrUndefined(initializer.declarations);
- return declaration && declaration.name &&
- declaration.name.kind === 172 &&
- !!(declaration.name.transformFlags & 8388608);
- }
- return false;
- }
- function isRestAssignment(initializer) {
- return initializer.kind === 176 &&
- initializer.transformFlags & 8388608;
- }
- function visitParameter(node) {
- if (isObjectRestParameter(node)) {
- return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node);
- }
- else {
- return node;
- }
- }
- function isObjectRestParameter(node) {
- return node.name &&
- node.name.kind === 172 &&
- !!(node.name.transformFlags & 8388608);
- }
- function visitFunctionDeclaration(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- function visitArrowFunction(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- var func = ts.setOriginalNode(ts.createArrowFunction(node.modifiers, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node);
- ts.setEmitFlags(func, 256);
- return func;
- }
- function visitFunctionExpression(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionExpression(node.modifiers, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- }
- ts.transformESNext = transformESNext;
+ var entities = ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
})(ts || (ts = {}));
var ts;
(function (ts) {
function transformES2017(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var currentSourceFileExternalHelpersModuleName;
+ var currentSourceFile;
var enabledSubstitutions;
- var applicableSubstitutions;
var currentSuperContainer;
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
- return ts.visitEachChild(node, visitor, context);
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 64) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 128) {
- return ts.visitEachChild(node, visitor, context);
+ if ((node.transformFlags & 16) === 0) {
+ return node;
}
- return node;
- }
- function visitorWorker(node) {
switch (node.kind) {
case 119:
return undefined;
@@ -39354,68 +39618,37 @@ var ts;
case 185:
return visitArrowFunction(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return node;
+ return ts.visitEachChild(node, visitor, context);
}
}
function visitAwaitExpression(node) {
return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
}
function visitMethodDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionExpression(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitArrowFunction(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformConciseBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- currentScope = body;
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformAsyncFunctionBody(node) {
+ resumeLexicalEnvironment();
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
@@ -39424,52 +39657,49 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, node.body, true);
if (languageVersion >= 2) {
if (resolver.getNodeCheckFlags(node) & 4096) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8);
+ ts.addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & 2048) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4);
+ ts.addEmitHelper(block, asyncSuperHelper);
}
}
return block;
}
else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
+ var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));
+ var declarations = endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(expression);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));
+ }
+ return expression;
}
}
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ function transformFunctionBodyWorker(body, start) {
if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
+ return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));
}
else {
startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));
var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
+ return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));
}
}
function getPromiseConstructor(type) {
- if (type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
+ var typeName = type && ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
}
return undefined;
@@ -39543,14 +39773,15 @@ var ts;
|| kind === 152;
}
function onEmitNode(emitContext, node, emitCallback) {
- var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
if (enabledSubstitutions & 1 && isSuperContainer(node)) {
+ var savedCurrentSuperContainer = currentSuperContainer;
currentSuperContainer = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- previousOnEmitNode(emitContext, node, emitCallback);
- applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -39573,6 +39804,33 @@ var ts;
}
}
ts.transformES2017 = transformES2017;
+ function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ context.requestEmitHelper(awaiterHelper);
+ var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body);
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072;
+ return ts.createCall(ts.getHelperName("__awaiter"), undefined, [
+ ts.createThis(),
+ hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
+ promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
+ generatorFunc
+ ]);
+ }
+ var awaiterHelper = {
+ name: "typescript:awaiter",
+ scoped: false,
+ priority: 5,
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };"
+ };
+ var asyncSuperHelper = {
+ name: "typescript:async-super",
+ scoped: true,
+ text: "\n const _super = name => super[name];"
+ };
+ var advancedAsyncSuperHelper = {
+ name: "typescript:advanced-async-super",
+ scoped: true,
+ text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -39586,55 +39844,52 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 256) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 512) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
+ if ((node.transformFlags & 32) === 0) {
return node;
}
- }
- function visitorWorker(node) {
switch (node.kind) {
case 192:
return visitBinaryExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
return ts.visitEachChild(node, visitor, context);
}
}
function visitBinaryExpression(node) {
+ switch (node.operatorToken.kind) {
+ case 61:
+ return visitExponentiationAssignmentExpression(node);
+ case 39:
+ return visitExponentiationExpression(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitExponentiationAssignmentExpression(node) {
+ var target;
+ var value;
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 61) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
- }
- else if (ts.isPropertyAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
- value = ts.createPropertyAccess(expressionTemp, left.name, left);
- }
- else {
- target = left;
- value = left;
- }
- return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ if (ts.isElementAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
}
- else if (node.operatorToken.kind === 39) {
- return ts.createMathPow(left, right, node);
+ else if (ts.isPropertyAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
+ value = ts.createPropertyAccess(expressionTemp, left.name, left);
}
else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ target = left;
+ value = left;
}
+ return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ }
+ function visitExponentiationExpression(node) {
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return ts.createMathPow(left, right, node);
}
}
ts.transformES2016 = transformES2016;
@@ -39642,7 +39897,7 @@ var ts;
var ts;
(function (ts) {
function transformES2015(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
@@ -39668,7 +39923,11 @@ var ts;
}
currentSourceFile = node;
currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ currentText = undefined;
+ return visited;
}
function visitor(node) {
return saveStateAndInvoke(node, dispatcher);
@@ -39707,6 +39966,38 @@ var ts;
currentNode = savedCurrentNode;
return visited;
}
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 185) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 131072)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ switch (currentNode.kind) {
+ case 205:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 224:
+ case 223:
+ case 174:
+ case 172:
+ case 173:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
+ }
+ currentParent = currentNode;
+ currentNode = node;
+ }
function returnCapturedThis(node) {
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
@@ -39714,7 +40005,7 @@ var ts;
return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 1024) !== 0 ||
+ return (node.transformFlags & 64) !== 0 ||
node.kind === 219 ||
(ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
}
@@ -39725,7 +40016,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -39825,14 +40116,14 @@ var ts;
return visitTemplateExpression(node);
case 195:
return visitYieldExpression(node);
+ case 196:
+ return visitSpreadElement(node);
case 96:
return visitSuperKeyword();
case 195:
return ts.visitEachChild(node, visitor, context);
case 149:
return visitMethodDeclaration(node);
- case 261:
- return visitSourceFileNode(node);
case 205:
return visitVariableStatement(node);
default:
@@ -39840,37 +40131,14 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 185) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- switch (currentNode.kind) {
- case 205:
- enclosingVariableStatement = currentNode;
- break;
- case 224:
- case 223:
- case 174:
- case 172:
- case 173:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
- }
- currentParent = currentNode;
- currentNode = node;
+ function visitSourceFile(node) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
}
function visitSwitchStatement(node) {
ts.Debug.assert(convertedLoopState !== undefined);
@@ -39972,9 +40240,9 @@ var ts;
statements.push(exportStatement);
}
var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 33554432) === 0) {
+ if ((emitFlags & 2097152) === 0) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(statement, emitFlags | 33554432);
+ ts.setEmitFlags(statement, emitFlags | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -39987,15 +40255,15 @@ var ts;
}
var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
- if (ts.getEmitFlags(node) & 524288) {
- ts.setEmitFlags(classFunction, 524288);
+ if (ts.getEmitFlags(node) & 32768) {
+ ts.setEmitFlags(classFunction, 32768);
}
var inner = ts.createPartiallyEmittedExpression(classFunction);
inner.end = node.end;
- ts.setEmitFlags(inner, 49152);
+ ts.setEmitFlags(inner, 1536);
var outer = ts.createPartiallyEmittedExpression(inner);
outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement
? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
: []));
@@ -40010,19 +40278,19 @@ var ts;
var localName = ts.getLocalName(node);
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
var statement = ts.createReturn(outer);
statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 | 12288);
+ ts.setEmitFlags(statement, 1536 | 384);
statements.push(statement);
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
return block;
}
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement));
+ statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement));
}
}
function addConstructor(statements, node, extendsClauseElement) {
@@ -40030,29 +40298,27 @@ var ts;
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);
if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256);
+ ts.setEmitFlags(constructorFunction, 8);
}
statements.push(constructorFunction);
}
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
var statements = [];
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = -1;
if (hasSynthesizedSuper) {
- statementOffset = 1;
+ statementOffset = 0;
}
else if (constructor) {
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);
}
if (constructor) {
- ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false);
- ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -40074,7 +40340,7 @@ var ts;
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);
if (!constructor) {
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
}
return block;
}
@@ -40100,7 +40366,7 @@ var ts;
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
if (ctor) {
- ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
+ addCaptureThisForNodeIfNeeded(statements, ctor);
}
return 0;
}
@@ -40109,7 +40375,7 @@ var ts;
return 2;
}
if (hasSynthesizedSuper) {
- ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1;
}
@@ -40129,11 +40395,11 @@ var ts;
|| superCallExpression.left.kind !== 179) {
ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
- ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 49152)));
+ ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536)));
statements.push(returnStatement);
return 2;
}
- ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
if (superCallExpression) {
return 1;
}
@@ -40141,7 +40407,7 @@ var ts;
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
}
@@ -40159,6 +40425,86 @@ var ts;
return node;
}
}
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 131072) !== 0;
+ }
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_35)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer);
+ }
+ }
+ }
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288));
+ }
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288));
+ }
+ }
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter))
+ ], parameter), 1 | 32 | 384), undefined, parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 384 | 32 | 524288);
+ statements.push(statement);
+ }
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ }
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 48);
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))
+ ]), parameter), 524288));
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))
+ ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0
+ ? temp
+ : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 524288);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 32768 && node.kind !== 185) {
+ captureThisForNode(statements, node, ts.createThis());
+ }
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this", undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 1536 | 524288);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
function addClassMembers(statements, node) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
@@ -40190,33 +40536,34 @@ var ts;
function transformClassMethodDeclarationToStatement(receiver, member) {
var commentRange = ts.getCommentRange(member);
var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, member, undefined);
- ts.setEmitFlags(func, 49152);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member);
+ var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name);
+ var memberFunction = transformFunctionLikeToExpression(member, member, undefined);
+ ts.setEmitFlags(memberFunction, 1536);
+ ts.setSourceMapRange(memberFunction, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member);
ts.setOriginalNode(statement, member);
ts.setCommentRange(statement, commentRange);
- ts.setEmitFlags(statement, 1536);
+ ts.setEmitFlags(statement, 48);
return statement;
}
function transformAccessorsToStatement(receiver, accessors) {
var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
return statement;
}
function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {
var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 | 1024);
+ ts.setEmitFlags(target, 1536 | 32);
ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 | 512);
+ ts.setEmitFlags(propertyName, 1536 | 16);
ts.setSourceMapRange(propertyName, firstAccessor.name);
var properties = [];
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- ts.setEmitFlags(getterFunction, 16384);
+ ts.setEmitFlags(getterFunction, 512);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -40224,7 +40571,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- ts.setEmitFlags(setterFunction, 16384);
+ ts.setEmitFlags(setterFunction, 512);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -40241,28 +40588,91 @@ var ts;
return call;
}
function visitArrowFunction(node) {
- if (node.transformFlags & 262144) {
+ if (node.transformFlags & 16384) {
enableSubstitutionsForCapturedThis();
}
- var func = transformFunctionLikeToExpression(node, node, undefined);
- ts.setEmitFlags(func, 256);
+ var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ ts.setEmitFlags(func, 8);
return func;
}
function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, node, node.name);
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node);
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformFunctionLikeToExpression(node, location, name) {
var savedContainingNonArrowFunction = enclosingNonArrowFunction;
if (node.kind !== 185) {
enclosingNonArrowFunction = node;
}
- var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node);
+ var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
+ function transformFunctionBody(node) {
+ var multiLine = false;
+ var singleLine = false;
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ resumeLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, false);
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 185);
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, body);
+ ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
+ statements.push(returnStatement);
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 1);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
+ }
function visitExpressionStatement(node) {
switch (node.expression.kind) {
case 183:
@@ -40273,19 +40683,20 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitParenthesizedExpression(node, needsDestructuringValue) {
- if (needsDestructuringValue) {
+ if (!needsDestructuringValue) {
switch (node.expression.kind) {
case 183:
- return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
+ return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));
case 192:
- return ts.createParen(visitBinaryExpression(node.expression, true), node);
+ return ts.updateParen(node, visitBinaryExpression(node.expression, false));
}
}
return ts.visitEachChild(node, visitor, context);
}
function visitBinaryExpression(node, needsDestructuringValue) {
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ if (ts.isDestructuringAssignment(node)) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue);
+ }
}
function visitVariableStatement(node) {
if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {
@@ -40296,7 +40707,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor);
+ assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);
}
else {
assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -40323,7 +40734,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 67108864
+ if (node.transformFlags & 8388608
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
var firstDeclaration = ts.firstOrUndefined(declarations);
@@ -40356,17 +40767,17 @@ var ts;
return visitVariableDeclaration(node);
}
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_5 = ts.getMutableClone(node);
- clone_5.initializer = ts.createVoidZero();
- return clone_5;
+ var clone_3 = ts.getMutableClone(node);
+ clone_3.initializer = ts.createVoidZero();
+ return clone_3;
}
return ts.visitEachChild(node, visitor, context);
}
function visitVariableDeclaration(node) {
if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1);
- return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ var hoistTempVariables = enclosingVariableStatement
+ && ts.hasModifier(enclosingVariableStatement, 1);
+ return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -40405,7 +40816,69 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false);
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(undefined);
+ var elementAccess = ts.createElementAccess(rhsReference, counter);
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess);
+ var declarationList = ts.createVariableDeclarationList(declarations, initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(undefined, declarationList));
+ }
+ else {
+ statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))
+ ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ var assignment = ts.createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0)));
+ }
+ else {
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));
+ var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);
+ ts.setEmitFlags(body, 48 | 384);
+ var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)
+ ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);
+ ts.setEmitFlags(forStatement, 256);
+ return forStatement;
}
function visitObjectLiteralExpression(node) {
var properties = node.properties;
@@ -40413,7 +40886,7 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 134217728
+ if (property.transformFlags & 16777216
|| property.name.kind === 142) {
numInitialProperties = i;
break;
@@ -40422,7 +40895,7 @@ var ts;
ts.Debug.assert(numInitialProperties !== numProperties);
var temp = ts.createTempVariable(hoistVariableDeclaration);
var expressions = [];
- var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288));
+ var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768));
if (node.multiLine) {
assignment.startsOnNewLine = true;
}
@@ -40503,26 +40976,26 @@ var ts;
var currentState = convertedLoopState;
convertedLoopState = outerConvertedLoopState;
if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1, statements_3);
- loopBody = ts.createBlock(statements_3, undefined, true);
+ var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1, statements_4);
+ loopBody = ts.createBlock(statements_4, undefined, true);
}
if (!ts.isBlock(loopBody)) {
loopBody = ts.createBlock([loopBody], undefined, true);
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
- && (node.statement.transformFlags & 134217728) !== 0;
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0
+ && (node.statement.transformFlags & 16777216) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256;
+ loopBodyFlags |= 8;
}
if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152;
+ loopBodyFlags |= 131072;
}
var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
- ]), 16777216));
+ ]), 1048576));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
if (currentState.argumentsName) {
@@ -40739,7 +41212,7 @@ var ts;
ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));
var temp = ts.createTempVariable(undefined);
var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);
- var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor);
+ var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);
var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags);
var destructure = ts.createVariableStatement(undefined, list);
return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
@@ -40751,7 +41224,7 @@ var ts;
function visitMethodDeclaration(node) {
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);
- ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression));
+ ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));
return ts.createPropertyAssignment(node.name, functionExpression, node);
}
function visitShorthandPropertyAssignment(node) {
@@ -40772,10 +41245,10 @@ var ts;
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
if (node.expression.kind === 96) {
- ts.setEmitFlags(thisArg, 128);
+ ts.setEmitFlags(thisArg, 4);
}
var resultingCall;
- if (node.transformFlags & 8388608) {
+ if (node.transformFlags & 524288) {
resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
@@ -40783,7 +41256,7 @@ var ts;
}
if (node.expression.kind === 96) {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
return assignToCapturedThis
? ts.createAssignment(ts.createIdentifier("_this"), initializer)
@@ -40792,7 +41265,7 @@ var ts;
return resultingCall;
}
function visitNewExpression(node) {
- ts.Debug.assert((node.transformFlags & 8388608) !== 0);
+ ts.Debug.assert((node.transformFlags & 524288) !== 0);
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
}
@@ -40820,6 +41293,9 @@ var ts;
function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);
}
+ function visitSpreadElement(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
function visitExpressionOfSpread(node) {
return ts.visitNode(node.expression, visitor, ts.isExpression);
}
@@ -40897,18 +41373,6 @@ var ts;
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, node.statements);
- return clone;
- }
function onEmitNode(emitContext, node, emitCallback) {
var savedEnclosingFunction = enclosingFunction;
if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
@@ -40988,7 +41452,7 @@ var ts;
function substituteThisKeyword(node) {
if (enabledSubstitutions & 1
&& enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256) {
+ && ts.getEmitFlags(enclosingFunction) & 8) {
return ts.createIdentifier("_this", node);
}
return node;
@@ -41001,8 +41465,7 @@ var ts;
if (!constructor || !hasExtendsClause) {
return false;
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ if (ts.some(constructor.parameters)) {
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
@@ -41022,10 +41485,23 @@ var ts;
return false;
}
var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ return ts.isIdentifier(expression) && expression.text === "arguments";
}
}
ts.transformES2015 = transformES2015;
+ function createExtendsHelper(context, name) {
+ context.requestEmitHelper(extendsHelper);
+ return ts.createCall(ts.getHelperName("__extends"), undefined, [
+ name,
+ ts.createIdentifier("_super")
+ ]);
+ }
+ var extendsHelper = {
+ name: "typescript:extends",
+ scoped: false,
+ priority: 0,
+ text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -41037,7 +41513,7 @@ var ts;
_a[7] = "endfinally",
_a));
function transformGenerators(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var resolver = context.getEmitResolver();
@@ -41071,15 +41547,15 @@ var ts;
var withBlockStack;
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
+ if (ts.isDeclarationFile(node)
+ || (node.transformFlags & 512) === 0) {
return node;
}
- if (node.transformFlags & 8192) {
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- }
- return node;
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
var transformFlags = node.transformFlags;
@@ -41089,10 +41565,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 4096) {
+ else if (transformFlags & 256) {
return visitGenerator(node);
}
- else if (transformFlags & 8192) {
+ else if (transformFlags & 512) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -41135,10 +41611,10 @@ var ts;
case 216:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (8192 | 268435456)) {
+ else if (node.transformFlags & (512 | 33554432)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -41180,8 +41656,8 @@ var ts;
}
}
function visitFunctionDeclaration(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -41201,8 +41677,8 @@ var ts;
}
}
function visitFunctionExpression(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -41253,7 +41729,7 @@ var ts;
operationArguments = undefined;
operationLocations = undefined;
state = ts.createTempVariable(undefined);
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
@@ -41275,12 +41751,12 @@ var ts;
return ts.createBlock(statements, body, body.multiLine);
}
function visitVariableStatement(node) {
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
else {
- if (ts.getEmitFlags(node) & 8388608) {
+ if (ts.getEmitFlags(node) & 524288) {
return node;
}
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
@@ -41357,10 +41833,10 @@ var ts;
else if (node.operatorToken.kind === 25) {
return visitCommaExpression(node);
}
- var clone_6 = ts.getMutableClone(node);
- clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_6;
+ var clone_4 = ts.getMutableClone(node);
+ clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_4;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -41425,26 +41901,30 @@ var ts;
return createGeneratorResume();
}
function visitArrayLiteralExpression(node) {
- return visitElements(node.elements, node.multiLine);
+ return visitElements(node.elements, undefined, undefined, node.multiLine);
}
- function visitElements(elements, _multiLine) {
+ function visitElements(elements, leadingElement, location, multiLine) {
var numInitialElements = countInitialNodesWithoutYield(elements);
var temp = declareLocal();
var hasAssignedTemp = false;
if (numInitialElements > 0) {
- emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements)));
+ var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
+ emitAssignment(temp, ts.createArrayLiteral(leadingElement
+ ? [leadingElement].concat(initialElements) : initialElements));
+ leadingElement = undefined;
hasAssignedTemp = true;
}
var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
return hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions);
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);
function reduceElement(expressions, element) {
if (containsYield(element) && expressions.length > 0) {
emitAssignment(temp, hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions));
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine));
hasAssignedTemp = true;
+ leadingElement = undefined;
expressions = [];
}
expressions.push(ts.visitNode(element, visitor, ts.isExpression));
@@ -41478,10 +41958,10 @@ var ts;
}
function visitElementAccessExpression(node) {
if (containsYield(node.argumentExpression)) {
- var clone_7 = ts.getMutableClone(node);
- clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_7;
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_5;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -41495,7 +41975,7 @@ var ts;
function visitNewExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node);
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -41937,7 +42417,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 134217728) !== 0;
+ return node && (node.transformFlags & 16777216) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -41967,12 +42447,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_35) {
- var clone_8 = ts.getMutableClone(name_35);
- ts.setSourceMapRange(clone_8, node);
- ts.setCommentRange(clone_8, node);
- return clone_8;
+ var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_36) {
+ var clone_6 = ts.getMutableClone(name_36);
+ ts.setSourceMapRange(clone_6, node);
+ ts.setCommentRange(clone_6, node);
+ return clone_6;
}
}
}
@@ -42363,10 +42843,7 @@ var ts;
currentExceptionBlock = undefined;
withBlockStack = undefined;
var buildResult = buildStatements();
- return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [
- ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
- ]);
+ return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144));
}
function buildStatements() {
if (operations) {
@@ -42629,6 +43106,16 @@ var ts;
}
}
ts.transformGenerators = transformGenerators;
+ function createGeneratorHelper(context, body) {
+ context.requestEmitHelper(generatorHelper);
+ return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]);
+ }
+ var generatorHelper = {
+ name: "typescript:generator",
+ scoped: false,
+ priority: 6,
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
+ };
var _a;
})(ts || (ts = {}));
var ts;
@@ -42680,13 +43167,30 @@ var ts;
(function (ts) {
function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableEmitNotification(261);
+ context.enableSubstitution(70);
+ var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
+ var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
+ if (externalHelpersModuleName) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements);
+ ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ }
+ else {
+ return ts.visitEachChild(node, visitor, context);
+ }
}
return node;
}
@@ -42702,6 +43206,32 @@ var ts;
function visitExportAssignment(node) {
return node.isExportEquals ? undefined : node;
}
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (ts.isSourceFile(node)) {
+ currentSourceFile = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isIdentifier(node) && emitContext === 1) {
+ return substituteExpressionIdentifier(node);
+ }
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ }
+ return node;
+ }
}
ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
@@ -42742,14 +43272,15 @@ var ts;
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
enclosingBlockScopedContainer = node;
- moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
contextObject = ts.createUniqueName("context");
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
ts.createParameter(undefined, undefined, undefined, exportFunction),
ts.createParameter(undefined, undefined, undefined, contextObject)
- ], undefined, createSystemModuleBody(node, dependencyGroups));
+ ], undefined, moduleBodyBlock);
var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
var updated = ts.updateSourceFileNode(node, ts.createNodeArray([
@@ -42757,7 +43288,9 @@ var ts;
? [moduleName, dependencies, moduleBodyFunction]
: [dependencies, moduleBodyFunction]))
], node.statements));
- ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1);
+ if (!(compilerOptions.outFile || compilerOptions.out)) {
+ ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
+ }
if (noSubstitution) {
noSubstitutionMap[id] = noSubstitution;
noSubstitution = undefined;
@@ -42798,6 +43331,7 @@ var ts;
statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
])));
+ ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true);
var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);
ts.addRange(statements, hoistedStatements);
ts.addRange(statements, endLexicalEnvironment());
@@ -42806,9 +43340,7 @@ var ts;
ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
]), true)));
- var body = ts.createBlock(statements, undefined, true);
- ts.setEmitFlags(body, 1);
- return body;
+ return ts.createBlock(statements, undefined, true);
}
function addExportStarIfNeeded(statements) {
if (!moduleInfo.hasExportStarsToExportValues) {
@@ -42868,7 +43400,7 @@ var ts;
var exports = ts.createIdentifier("exports");
var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n])));
}
return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([
ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
@@ -42877,7 +43409,7 @@ var ts;
ts.createForIn(ts.createVariableDeclarationList([
ts.createVariableDeclaration(n, undefined)
]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32)
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)
])),
ts.createStatement(ts.createCall(exportFunction, undefined, [exports]))
], undefined, true));
@@ -43049,14 +43581,14 @@ var ts;
}
}
function shouldHoistVariableDeclarationList(node) {
- return (ts.getEmitFlags(node) & 16777216) === 0
+ return (ts.getEmitFlags(node) & 1048576) === 0
&& (enclosingBlockScopedContainer.kind === 261
|| (ts.getOriginalNode(node).flags & 3) === 0);
}
function transformInitializedVariable(node, isExportedDeclaration) {
var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
return ts.isBindingPattern(node.name)
- ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment)
: createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
}
function createExportedVariableAssignment(name, value, location) {
@@ -43080,7 +43612,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -43197,7 +43729,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value));
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -43241,9 +43773,9 @@ var ts;
return visitCatchClause(node);
case 204:
return visitBlock(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return destructuringVisitor(node);
@@ -43333,11 +43865,11 @@ var ts;
return node;
}
function destructuringVisitor(node) {
- if (node.transformFlags & 16384
+ if (node.transformFlags & 1024
&& node.kind === 192) {
return visitDestructuringAssignment(node);
}
- else if (node.transformFlags & 32768) {
+ else if (node.transformFlags & 2048) {
return ts.visitEachChild(node, destructuringVisitor, context);
}
else {
@@ -43346,7 +43878,7 @@ var ts;
}
function visitDestructuringAssignment(node) {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor);
+ return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true);
}
return ts.visitEachChild(node, destructuringVisitor, context);
}
@@ -43428,6 +43960,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var importDeclaration = resolver.getReferencedImportDeclaration(node);
if (importDeclaration) {
@@ -43520,7 +44059,7 @@ var ts;
_a[ts.ModuleKind.AMD] = transformAMDModule,
_a[ts.ModuleKind.UMD] = transformUMDModule,
_a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
@@ -43549,7 +44088,7 @@ var ts;
return node;
}
currentSourceFile = node;
- currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule(node);
currentSourceFile = undefined;
@@ -43560,12 +44099,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, false);
var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node));
+ ts.addEmitHelper(updated, exportStarHelper);
}
return updated;
}
@@ -43575,8 +44115,7 @@ var ts;
return transformAsynchronousModule(node, define, moduleName, true);
}
function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16);
+ var define = ts.createRawExpression(umdHelper);
return transformAsynchronousModule(node, define, undefined, false);
}
function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
@@ -43613,7 +44152,7 @@ var ts;
var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
if (includeNonAmdDependencies && importAliasName) {
- ts.setEmitFlags(importAliasName, 128);
+ ts.setEmitFlags(importAliasName, 4);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName));
}
@@ -43627,12 +44166,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, true);
var body = ts.createBlock(statements, undefined, true);
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(body, 2);
+ ts.addEmitHelper(body, exportStarHelper);
}
return body;
}
@@ -43640,12 +44180,12 @@ var ts;
if (currentModuleInfo.exportEquals) {
if (emitAsReturn) {
var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 12288 | 49152);
+ ts.setEmitFlags(statement, 384 | 1536);
statements.push(statement);
}
else {
var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
statements.push(statement);
}
}
@@ -43666,9 +44206,9 @@ var ts;
return visitFunctionDeclaration(node);
case 226:
return visitClassDeclaration(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return node;
@@ -43859,7 +44399,7 @@ var ts;
}
function transformInitializedVariable(node) {
if (ts.isBindingPattern(node.name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression);
}
else {
return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer);
@@ -43873,7 +44413,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -43993,7 +44533,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value), location);
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -44060,6 +44600,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
if (exportContainer && exportContainer.kind === 261) {
@@ -44071,8 +44618,8 @@ var ts;
return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node);
}
else if (ts.isImportSpecifier(importDeclaration)) {
- var name_36 = importDeclaration.propertyName || importDeclaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36), node);
+ var name_37 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37), node);
}
}
}
@@ -44131,6 +44678,12 @@ var ts;
var _a;
}
ts.transformModule = transformModule;
+ var exportStarHelper = {
+ name: "typescript:export-star",
+ scoped: true,
+ text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }"
+ };
+ var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })";
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -44172,21 +44725,27 @@ var ts;
}
ts.getTransformers = getTransformers;
function transformFiles(resolver, host, sourceFiles, transformers) {
+ var enabledSyntaxKindFeatures = new Array(298);
+ var lexicalEnvironmentDisabled = false;
+ var lexicalEnvironmentVariableDeclarations;
+ var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(296);
var lexicalEnvironmentStackOffset = 0;
- var hoistedVariableDeclarations;
- var hoistedFunctionDeclarations;
- var lexicalEnvironmentDisabled;
+ var lexicalEnvironmentSuspended = false;
+ var emitHelpers;
var context = {
getCompilerOptions: function () { return host.getCompilerOptions(); },
getEmitResolver: function () { return resolver; },
getEmitHost: function () { return host; },
- hoistVariableDeclaration: hoistVariableDeclaration,
- hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
+ suspendLexicalEnvironment: suspendLexicalEnvironment,
+ resumeLexicalEnvironment: resumeLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
+ hoistVariableDeclaration: hoistVariableDeclaration,
+ hoistFunctionDeclaration: hoistFunctionDeclaration,
+ requestEmitHelper: requestEmitHelper,
+ readEmitHelpers: readEmitHelpers,
onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
@@ -44213,7 +44772,7 @@ var ts;
}
function isSubstitutionEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0
- && (ts.getEmitFlags(node) & 128) === 0;
+ && (ts.getEmitFlags(node) & 4) === 0;
}
function emitNodeWithSubstitution(emitContext, node, emitCallback) {
if (node) {
@@ -44232,7 +44791,7 @@ var ts;
}
function isEmitNotificationEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0
- || (ts.getEmitFlags(node) & 64) !== 0;
+ || (ts.getEmitFlags(node) & 2) !== 0;
}
function emitNodeWithNotification(emitContext, node, emitCallback) {
if (node) {
@@ -44247,39 +44806,51 @@ var ts;
function hoistVariableDeclaration(name) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
var decl = ts.createVariableDeclaration(name);
- if (!hoistedVariableDeclarations) {
- hoistedVariableDeclarations = [decl];
+ if (!lexicalEnvironmentVariableDeclarations) {
+ lexicalEnvironmentVariableDeclarations = [decl];
}
else {
- hoistedVariableDeclarations.push(decl);
+ lexicalEnvironmentVariableDeclarations.push(decl);
}
}
function hoistFunctionDeclaration(func) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
- if (!hoistedFunctionDeclarations) {
- hoistedFunctionDeclarations = [func];
+ if (!lexicalEnvironmentFunctionDeclarations) {
+ lexicalEnvironmentFunctionDeclarations = [func];
}
else {
- hoistedFunctionDeclarations.push(func);
+ lexicalEnvironmentFunctionDeclarations.push(func);
}
}
function startLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase.");
- lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations;
- lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations;
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
+ lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
+ lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStackOffset++;
- hoistedVariableDeclarations = undefined;
- hoistedFunctionDeclarations = undefined;
+ lexicalEnvironmentVariableDeclarations = undefined;
+ lexicalEnvironmentFunctionDeclarations = undefined;
+ }
+ function suspendLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
+ lexicalEnvironmentSuspended = true;
+ }
+ function resumeLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase.");
+ ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
+ lexicalEnvironmentSuspended = false;
}
function endLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
var statements;
- if (hoistedVariableDeclarations || hoistedFunctionDeclarations) {
- if (hoistedFunctionDeclarations) {
- statements = hoistedFunctionDeclarations.slice();
+ if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
+ if (lexicalEnvironmentFunctionDeclarations) {
+ statements = lexicalEnvironmentFunctionDeclarations.slice();
}
- if (hoistedVariableDeclarations) {
- var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations));
+ if (lexicalEnvironmentVariableDeclarations) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
if (!statements) {
statements = [statement];
}
@@ -44289,10 +44860,25 @@ var ts;
}
}
lexicalEnvironmentStackOffset--;
- hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
- hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ if (lexicalEnvironmentStackOffset === 0) {
+ lexicalEnvironmentVariableDeclarationsStack = [];
+ lexicalEnvironmentFunctionDeclarationsStack = [];
+ }
return statements;
}
+ function requestEmitHelper(helper) {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
+ emitHelpers = ts.append(emitHelpers, helper);
+ }
+ function readEmitHelpers() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ var helpers = emitHelpers;
+ emitHelpers = undefined;
+ return helpers;
+ }
}
ts.transformFiles = transformFiles;
var _a;
@@ -44461,12 +45047,12 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 292
- && (emitFlags & 512) === 0
+ if (node.kind !== 293
+ && (emitFlags & 16) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
}
- if (emitFlags & 2048) {
+ if (emitFlags & 64) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -44474,8 +45060,8 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 292
- && (emitFlags & 1024) === 0
+ if (node.kind !== 293
+ && (emitFlags & 32) === 0
&& end >= 0) {
emitPos(end);
}
@@ -44489,13 +45075,13 @@ var ts;
var emitFlags = emitNode && emitNode.flags;
var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);
- if ((emitFlags & 4096) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 128) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
tokenPos = emitCallback(token, tokenPos);
if (range)
tokenPos = range.end;
- if ((emitFlags & 8192) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 256) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
return tokenPos;
@@ -44605,7 +45191,7 @@ var ts;
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
var emitFlags = ts.getEmitFlags(node);
if ((pos < 0 && end < 0) || (pos === end)) {
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -44618,9 +45204,9 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 292;
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0;
+ var isEmittedNode = node.kind !== 293;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitLeadingComments(pos, isEmittedNode);
}
@@ -44639,7 +45225,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitNodeWithComment");
}
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -44668,15 +45254,15 @@ var ts;
}
var pos = detachedRange.pos, end = detachedRange.end;
var emitFlags = ts.getEmitFlags(node);
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
}
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments");
}
- if (emitFlags & 65536 && !disabled) {
+ if (emitFlags & 2048 && !disabled) {
disabled = true;
emitCallback(node);
disabled = false;
@@ -45080,15 +45666,15 @@ var ts;
}
}
function emitLines(nodes) {
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
emit(node);
}
}
function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {
var currentWriterPos = writer.getTextPos();
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (!canEmitFn || canEmitFn(node)) {
if (currentWriterPos !== writer.getTextPos()) {
write(separator);
@@ -45103,7 +45689,7 @@ var ts;
}
function writeJsDocComments(declaration) {
if (declaration) {
- var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText);
+ var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);
ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);
ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange);
}
@@ -45290,9 +45876,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_37 = baseName + "_" + count;
- if (!(name_37 in currentIdentifiers)) {
- return name_37;
+ var name_38 = baseName + "_" + count;
+ if (!(name_38 in currentIdentifiers)) {
+ return name_38;
}
}
}
@@ -45686,6 +46272,9 @@ var ts;
case 225:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
+ case 228:
+ diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
+ break;
default:
ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
@@ -45779,7 +46368,10 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
- emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false);
+ var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });
+ if (interfaceExtendsTypes && interfaceExtendsTypes.length) {
+ emitHeritageClause(interfaceExtendsTypes, false);
+ }
write(" {");
writeLine();
increaseIndent();
@@ -46340,18 +46932,6 @@ var ts;
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
- var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};";
- var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
- var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
- var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
- var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};";
- var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};";
- var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};";
- var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};";
- var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}";
- var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})";
- var superHelper = "\nconst _super = name => super[name];";
- var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);";
var compilerOptions = host.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
@@ -46373,12 +46953,7 @@ var ts;
var currentSourceFile;
var currentText;
var currentFileIdentifiers;
- var extendsEmitted;
- var assignEmitted;
- var restEmitted;
- var decorateEmitted;
- var paramEmitted;
- var awaiterEmitted;
+ var bundledHelpers;
var isOwnFileEmit;
var emitSkipped = false;
var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);
@@ -46427,11 +47002,12 @@ var ts;
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNameSet = ts.createMap();
+ bundledHelpers = isBundledEmit ? ts.createMap() : undefined;
isOwnFileEmit = !isBundledEmit;
if (isBundledEmit && moduleKind) {
for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {
var sourceFile = sourceFiles_5[_a];
- emitEmitHelpers(sourceFile);
+ emitHelpers(sourceFile, true);
}
}
ts.forEach(sourceFiles, printSourceFile);
@@ -46441,23 +47017,18 @@ var ts;
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
}
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false);
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles);
}
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
}
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM);
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
sourceMap.reset();
comments.reset();
writer.reset();
tempFlags = 0;
currentSourceFile = undefined;
currentText = undefined;
- extendsEmitted = false;
- assignEmitted = false;
- decorateEmitted = false;
- paramEmitted = false;
- awaiterEmitted = false;
isOwnFileEmit = false;
}
function printSourceFile(node) {
@@ -46825,8 +47396,10 @@ var ts;
return emitJsxElement(node);
case 247:
return emitJsxSelfClosingElement(node);
- case 293:
+ case 294:
return emitPartiallyEmittedExpression(node);
+ case 297:
+ return writeLines(node.text);
}
}
function emitNumericLiteral(node) {
@@ -46846,12 +47419,7 @@ var ts;
}
}
function emitIdentifier(node) {
- if (ts.getEmitFlags(node) & 16) {
- writeLines(umdHelper);
- }
- else {
- write(getTextOfNode(node, false));
- }
+ write(getTextOfNode(node, false));
}
function emitQualifiedName(node) {
emitEntityName(node.left);
@@ -47094,7 +47662,7 @@ var ts;
write("{}");
}
else {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -47109,7 +47677,7 @@ var ts;
function emitPropertyAccessExpression(node) {
var indentBeforeDot = false;
var indentAfterDot = false;
- if (!(ts.getEmitFlags(node) & 1048576)) {
+ if (!(ts.getEmitFlags(node) & 65536)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };
@@ -47293,7 +47861,7 @@ var ts;
}
}
function emitBlockStatements(node) {
- if (ts.getEmitFlags(node) & 32) {
+ if (ts.getEmitFlags(node) & 1) {
emitList(node, node.statements, 384);
}
else {
@@ -47469,11 +48037,11 @@ var ts;
var body = node.body;
if (body) {
if (ts.isBlock(body)) {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
- if (ts.getEmitFlags(node) & 4194304) {
+ if (ts.getEmitFlags(node) & 262144) {
emitSignatureHead(node);
emitBlockFunctionBody(body);
}
@@ -47505,7 +48073,7 @@ var ts;
emitWithPrefix(": ", node.type);
}
function shouldEmitBlockFunctionBodyOnSingleLine(body) {
- if (ts.getEmitFlags(body) & 32) {
+ if (ts.getEmitFlags(body) & 1) {
return true;
}
if (body.multiLine) {
@@ -47560,7 +48128,7 @@ var ts;
emitModifiers(node, node.modifiers);
write("class");
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -47819,7 +48387,7 @@ var ts;
emit(node.name);
write(": ");
var initializer = node.initializer;
- if ((ts.getEmitFlags(initializer) & 16384) === 0) {
+ if ((ts.getEmitFlags(initializer) & 512) === 0) {
var commentRange = ts.getCommentRange(initializer);
emitTrailingCommentsOfPosition(commentRange.pos);
}
@@ -47873,71 +48441,31 @@ var ts;
}
return statements.length;
}
- function emitHelpers(node) {
- var emitFlags = ts.getEmitFlags(node);
- var helpersEmitted = false;
- if (emitFlags & 1) {
- helpersEmitted = emitEmitHelpers(currentSourceFile);
- }
- if (emitFlags & 2) {
- writeLines(exportStarHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 4) {
- writeLines(superHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 8) {
- writeLines(advancedSuperHelper);
- helpersEmitted = true;
- }
- return helpersEmitted;
- }
- function emitEmitHelpers(node) {
- if (compilerOptions.noEmitHelpers) {
- return false;
- }
- if (compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- return false;
- }
+ function emitHelpers(node, isBundle) {
+ var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;
+ var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;
var helpersEmitted = false;
- if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) {
- writeLines(extendsHelper);
- extendsEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) &&
- compilerOptions.jsx !== 1 &&
- !assignEmitted &&
- node.flags & 16384) {
- writeLines(assignHelper);
- assignEmitted = true;
- }
- if (languageVersion < 5 && !restEmitted && node.flags & 32768) {
- writeLines(restHelper);
- restEmitted = true;
- }
- if (!decorateEmitted && node.flags & 2048) {
- writeLines(decorateHelper);
- if (compilerOptions.emitDecoratorMetadata) {
- writeLines(metadataHelper);
- }
- decorateEmitted = true;
- helpersEmitted = true;
- }
- if (!paramEmitted && node.flags & 4096) {
- writeLines(paramHelper);
- paramEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) {
- writeLines(awaiterHelper);
- if (languageVersion < 2) {
- writeLines(generatorHelper);
+ var helpers = ts.getEmitHelpers(node);
+ if (helpers) {
+ for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {
+ var helper = _b[_a];
+ if (!helper.scoped) {
+ if (shouldSkip)
+ continue;
+ if (shouldBundle) {
+ if (bundledHelpers[helper.name]) {
+ continue;
+ }
+ bundledHelpers[helper.name] = true;
+ }
+ }
+ else if (isBundle) {
+ continue;
+ }
+ writeLines(helper.text);
+ helpersEmitted = true;
}
- awaiterEmitted = true;
- helpersEmitted = true;
}
if (helpersEmitted) {
writeLine();
@@ -47945,9 +48473,10 @@ var ts;
return helpersEmitted;
}
function writeLines(text) {
- var lines = text.split(/\r\n|\r|\n/g);
+ var lines = text.split(/\r\n?|\n/g);
+ var indentation = guessIndentation(lines);
for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
+ var line = indentation ? lines[i].slice(indentation) : lines[i];
if (line.length) {
if (i > 0) {
writeLine();
@@ -47956,6 +48485,21 @@ var ts;
}
}
}
+ function guessIndentation(lines) {
+ var indentation;
+ for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
+ var line = lines_1[_a];
+ for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
+ if (!ts.isWhiteSpace(line.charCodeAt(i))) {
+ if (indentation === undefined || i < indentation) {
+ indentation = i;
+ break;
+ }
+ }
+ }
+ }
+ return indentation;
+ }
function emitShebang() {
var shebang = ts.getShebang(currentText);
if (shebang) {
@@ -48297,21 +48841,21 @@ var ts;
}
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_38 = flags === 268435456 ? "_i" : "_n";
- if (isUniqueName(name_38)) {
+ var name_39 = flags === 268435456 ? "_i" : "_n";
+ if (isUniqueName(name_39)) {
tempFlags |= flags;
- return name_38;
+ return name_39;
}
}
while (true) {
var count = tempFlags & 268435455;
tempFlags++;
if (count !== 8 && count !== 13) {
- var name_39 = count < 26
+ var name_40 = count < 26
? "_" + String.fromCharCode(97 + count)
: "_" + (count - 26);
- if (isUniqueName(name_39)) {
- return name_39;
+ if (isUniqueName(name_40)) {
+ return name_40;
}
}
}
@@ -48432,7 +48976,6 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.2.0-dev.20161115";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -48648,10 +49191,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_40 = names_1[_i];
- var result = name_40 in cache
- ? cache[name_40]
- : cache[name_40] = loader(name_40, containingFile);
+ var name_41 = names_1[_i];
+ var result = name_41 in cache
+ ? cache[name_41]
+ : cache[name_41] = loader(name_41, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -48705,7 +49248,8 @@ var ts;
ts.forEach(rootNames, function (name) { return processRootFile(name, false); });
var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);
if (typeReferences.length) {
- var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
+ var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
+ var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts");
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (var i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
@@ -49185,8 +49729,8 @@ var ts;
}
break;
}
- for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
- var node = nodes_4[_b];
+ for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {
+ var node = nodes_6[_b];
walk(node);
}
}
@@ -50206,12 +50750,16 @@ var ts;
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
];
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -50235,6 +50783,18 @@ var ts;
sourceMap: false,
};
var optionNameMapCache;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -50448,9 +51008,9 @@ var ts;
function serializeCompilerOptions(options) {
var result = ts.createMap();
var optionsNameMap = getOptionNameMap().optionNameMap;
- for (var name_41 in options) {
- if (ts.hasProperty(options, name_41)) {
- switch (name_41) {
+ for (var name_42 in options) {
+ if (ts.hasProperty(options, name_42)) {
+ switch (name_42) {
case "init":
case "watch":
case "version":
@@ -50458,12 +51018,12 @@ var ts;
case "project":
break;
default:
- var value = options[name_41];
- var optionDefinition = optionsNameMap[name_41.toLowerCase()];
+ var value = options[name_42];
+ var optionDefinition = optionsNameMap[name_42.toLowerCase()];
if (optionDefinition) {
var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
if (!customTypeMap) {
- result[name_41] = value;
+ result[name_42] = value;
}
else {
if (optionDefinition.type === "list") {
@@ -50472,10 +51032,10 @@ var ts;
var element = _a[_i];
convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
}
- result[name_41] = convertedValue;
+ result[name_42] = convertedValue;
}
else {
- result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap);
+ result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap);
}
}
}
@@ -50514,14 +51074,15 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -50548,7 +51109,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -50556,7 +51117,7 @@ var ts;
};
function tryExtendsName(extendedConfig) {
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -50619,7 +51180,7 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -50654,12 +51215,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -50667,9 +51228,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -50899,47 +51461,6 @@ var ts;
ts.sys.write("TSFILE: " + filepath + ts.sys.newLine);
}
}
- function validateLocaleAndSetLanguage(locale, errors) {
- var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
- if (!matchResult) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
- return false;
- }
- var language = matchResult[1];
- var territory = matchResult[3];
- if (!trySetLanguageAndTerritory(language, territory, errors)) {
- trySetLanguageAndTerritory(language, undefined, errors);
- }
- return true;
- }
- function trySetLanguageAndTerritory(language, territory, errors) {
- var compilerFilePath = ts.normalizePath(ts.sys.getExecutingFilePath());
- var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
- var filePath = ts.combinePaths(containingDirectoryPath, language);
- if (territory) {
- filePath = filePath + "-" + territory;
- }
- filePath = ts.sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
- if (!ts.sys.fileExists(filePath)) {
- return false;
- }
- var fileContents = "";
- try {
- fileContents = ts.sys.readFile(filePath);
- }
- catch (e) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
- return false;
- }
- try {
- ts.localizedDiagnosticMessages = JSON.parse(fileContents);
- }
- catch (e) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
- return false;
- }
- return true;
- }
function countLines(program) {
var count = 0;
ts.forEach(program.getSourceFiles(), function (file) {
@@ -51068,7 +51589,7 @@ var ts;
reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), undefined);
return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
- validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors);
+ ts.validateLocaleAndSetLanguage(commandLine.options.locale, ts.sys, commandLine.errors);
}
if (commandLine.errors.length > 0) {
reportDiagnostics(commandLine.errors, compilerHost);
@@ -51363,17 +51884,17 @@ var ts;
var nameSize = 0;
var valueSize = 0;
for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
- var _a = statistics_1[_i], name_42 = _a.name, value = _a.value;
- if (name_42.length > nameSize) {
- nameSize = name_42.length;
+ var _a = statistics_1[_i], name_43 = _a.name, value = _a.value;
+ if (name_43.length > nameSize) {
+ nameSize = name_43.length;
}
if (value.length > valueSize) {
valueSize = value.length;
}
}
for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
- var _c = statistics_2[_b], name_43 = _c.name, value = _c.value;
- ts.sys.write(padRight(name_43 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine);
+ var _c = statistics_2[_b], name_44 = _c.name, value = _c.value;
+ ts.sys.write(padRight(name_44 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine);
}
}
function reportStatisticalValue(name, value) {
diff --git a/node_modules/typescript/lib/tsserver.js b/node_modules/typescript/lib/tsserver.js
index 6d38bc71d..51ba6b309 100644
--- a/node_modules/typescript/lib/tsserver.js
+++ b/node_modules/typescript/lib/tsserver.js
@@ -137,6 +137,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+(function (ts) {
var createObject = Object.create;
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
@@ -606,7 +609,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -621,6 +624,14 @@ var ts;
return to;
}
ts.addRange = addRange;
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; })
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
+ .map(function (i) { return array[i]; });
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -775,6 +786,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -1227,6 +1247,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
@@ -1777,6 +1805,16 @@ var ts;
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
function orderedRemoveItemAt(array, index) {
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
@@ -2811,7 +2849,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -2876,7 +2914,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2947,6 +2986,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -3161,9 +3201,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -3175,6 +3215,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
var ts;
@@ -5176,12 +5219,16 @@ var ts;
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
];
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -5205,6 +5252,18 @@ var ts;
sourceMap: false,
};
var optionNameMapCache;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -5484,14 +5543,15 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -5518,7 +5578,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -5526,7 +5586,7 @@ var ts;
};
function tryExtendsName(extendedConfig) {
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -5589,7 +5649,7 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -5624,12 +5684,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -5637,9 +5697,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -5858,9 +5919,9 @@ var ts;
"constants", "process", "v8", "timers", "console"
];
var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
@@ -5874,8 +5935,8 @@ var ts;
var filesToWatch = [];
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -6057,12 +6118,12 @@ var ts;
return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName;
}
}
- function createInstallTypingsRequest(project, typingOptions, unresolvedImports, cachePath) {
+ function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) {
return {
projectName: project.getProjectName(),
fileNames: project.getFileNames(true),
compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
unresolvedImports: unresolvedImports,
projectRootPath: getProjectRootPath(project),
cachePath: cachePath,
@@ -6249,6 +6310,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -6982,28 +7044,28 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
if (nodeIsMissing(node)) {
return node.pos;
}
if (isJSDocNode(node)) {
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
}
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
+ if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
+ return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 291 && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ if (node.kind === 292 && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 262 && node.kind <= 287;
+ return node.kind >= 262 && node.kind <= 288;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 278 && node.kind <= 290;
+ return node.kind >= 278 && node.kind <= 291;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -7180,7 +7242,7 @@ var ts;
case 8:
return name.text;
case 142:
- if (isStringOrNumericLiteral(name.expression.kind)) {
+ if (isStringOrNumericLiteral(name.expression)) {
return name.expression.text;
}
}
@@ -7302,7 +7364,8 @@ var ts;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 207 && node.expression.kind === 9;
+ return node.kind === 207
+ && node.expression.kind === 9;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -7313,25 +7376,20 @@ var ts;
return ts.getLeadingCommentRanges(text, node.pos);
}
ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
- }
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
+ function getJSDocCommentRanges(node, text) {
var commentRanges = (node.kind === 144 ||
node.kind === 143 ||
node.kind === 184 ||
node.kind === 185) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
+ return ts.filter(commentRanges, function (comment) {
return text.charCodeAt(comment.pos + 1) === 42 &&
text.charCodeAt(comment.pos + 2) === 42 &&
text.charCodeAt(comment.pos + 3) !== 47;
- }
+ });
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.getJSDocCommentRanges = getJSDocCommentRanges;
ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
@@ -7857,6 +7915,7 @@ var ts;
case 145:
case 252:
case 251:
+ case 259:
return true;
case 199:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
@@ -8011,152 +8070,118 @@ var ts;
node.parameters[0].type.kind === 276;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ function getCommentsFromJSDoc(node) {
+ return ts.map(getJSDocs(node), function (doc) { return doc.comment; });
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
- }
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
- }
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ ts.getCommentsFromJSDoc = getCommentsFromJSDoc;
+ function getJSDocTags(node, kind) {
+ var docs = getJSDocs(node);
+ if (docs) {
var result = [];
for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
+ if (doc.kind === 281) {
+ if (doc.kind === kind) {
+ result.push(doc);
+ }
+ }
+ else {
+ result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));
}
}
return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- var result = undefined;
- if (checkParentVariableStatement) {
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 205;
+ }
+ }
+ function getFirstJSDocTag(node, kind) {
+ return node && ts.firstOrUndefined(getJSDocTags(node, kind));
+ }
+ function getJSDocs(node) {
+ var cache = node.jsDocCache;
+ if (!cache) {
+ getJSDocsWorker(node);
+ node.jsDocCache = cache;
+ }
+ return cache;
+ function getJSDocsWorker(node) {
+ var parent = node.parent;
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&
+ parent.initializer === node &&
+ parent.parent.parent.kind === 205;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 205;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ parent.parent.kind === 205;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? parent.parent :
undefined;
if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 230 &&
- node.parent && node.parent.kind === 230) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(variableStatementNode);
}
- var parent_4 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 192 &&
- parent_4.operatorToken.kind === 57 &&
- parent_4.parent.kind === 207;
+ var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&
+ parent.kind === 192 &&
+ parent.operatorToken.kind === 57 &&
+ parent.parent.kind === 207;
if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(parent.parent);
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
+ var isModuleDeclaration = node.kind === 230 &&
+ parent && parent.kind === 230;
+ var isPropertyAssignmentExpression = parent && parent.kind === 257;
+ if (isModuleDeclaration || isPropertyAssignmentExpression) {
+ getJSDocsWorker(parent);
}
if (node.kind === 144) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
- }
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
+ cache = ts.concatenate(cache, getJSDocParameterTags(node));
}
- else {
- return getDocs(node.jsDocComments);
+ if (isVariableLike(node) && node.initializer) {
+ cache = ts.concatenate(cache, node.initializer.jsDoc);
}
+ cache = ts.concatenate(cache, node.jsDoc);
}
- return result;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
+ function getJSDocParameterTags(param) {
+ if (!isParameter(param)) {
+ return undefined;
+ }
var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
+ var tags = getJSDocTags(func, 281);
if (!param.name) {
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70) {
var name_8 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_8; });
- if (paramTags) {
- return paramTags;
- }
+ return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; });
}
else {
return undefined;
}
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 282, false);
+ ts.getJSDocParameterTags = getJSDocParameterTags;
+ function getJSDocType(node) {
+ var tag = getFirstJSDocTag(node, 283);
+ if (!tag && node.kind === 144) {
+ var paramTags = getJSDocParameterTags(node);
+ if (paramTags) {
+ tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });
+ }
+ }
+ return tag && tag.typeExpression && tag.typeExpression.type;
+ }
+ ts.getJSDocType = getJSDocType;
+ function getJSDocAugmentsTag(node) {
+ return getFirstJSDocTag(node, 280);
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
+ ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 281, true);
+ return getFirstJSDocTag(node, 282);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 283, false);
+ return getFirstJSDocTag(node, 284);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 70) {
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 280) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
- }
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
function hasRestParameter(s) {
return isRestParameter(ts.lastOrUndefined(s.parameters));
}
@@ -8167,13 +8192,10 @@ var ts;
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
if (node && (node.flags & 2097152)) {
- if (node.type && node.type.kind === 275) {
+ if (node.type && node.type.kind === 275 ||
+ ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) {
return true;
}
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 275;
- }
}
return isDeclaredRestParam(node);
}
@@ -8396,8 +8418,10 @@ var ts;
return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);
}
ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 || kind === 8;
+ function isStringOrNumericLiteral(node) {
+ var kind = node.kind;
+ return kind === 9
+ || kind === 8;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
function hasDynamicName(declaration) {
@@ -8406,7 +8430,7 @@ var ts;
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
return name.kind === 142 &&
- !isStringOrNumericLiteral(name.expression.kind) &&
+ !isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
@@ -8612,6 +8636,7 @@ var ts;
case 194:
case 183:
case 198:
+ case 297:
return 19;
case 181:
case 177:
@@ -9373,19 +9398,19 @@ var ts;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isAssignmentExpression(node) {
+ function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node)
- && isAssignmentOperator(node.operatorToken.kind)
+ && (excludeCompoundAssignment
+ ? node.operatorToken.kind === 57
+ : isAssignmentOperator(node.operatorToken.kind))
&& isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 57) {
- var kind = node.left.kind;
- return kind === 176
- || kind === 175;
- }
+ if (isAssignmentExpression(node, true)) {
+ var kind = node.left.kind;
+ return kind === 176
+ || kind === 175;
}
return false;
}
@@ -9696,122 +9721,6 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportedBindings = ts.createMap();
- var uniqueExports = ts.createMap();
- var hasExportDefault = false;
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 235:
- externalImports.push(node);
- break;
- case 234:
- if (node.moduleReference.kind === 245) {
- externalImports.push(node);
- }
- break;
- case 241:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- else {
- externalImports.push(node);
- }
- }
- else {
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- if (!uniqueExports[specifier.name.text]) {
- var name_10 = specifier.propertyName || specifier.name;
- ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);
- var decl = resolver.getReferencedImportDeclaration(name_10)
- || resolver.getReferencedValueDeclaration(name_10);
- if (decl) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
- }
- uniqueExports[specifier.name.text] = specifier.name;
- }
- }
- }
- break;
- case 240:
- if (node.isExportEquals && !exportEquals) {
- exportEquals = node;
- }
- break;
- case 205:
- if (hasModifier(node, 1)) {
- for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
- var decl = _e[_d];
- collectExportedVariableInfo(decl, uniqueExports);
- }
- }
- break;
- case 225:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_11 = node.name;
- if (!uniqueExports[name_11.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_11);
- uniqueExports[name_11.text] = name_11;
- }
- }
- }
- break;
- case 226:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_12 = node.name;
- if (!uniqueExports[name_12.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_12);
- uniqueExports[name_12.text] = name_12;
- }
- }
- }
- break;
- }
- }
- var exportedNames;
- for (var key in uniqueExports) {
- exportedNames = ts.append(exportedNames, uniqueExports[key]);
- }
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
- }
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function collectExportedVariableInfo(decl, uniqueExports) {
- if (isBindingPattern(decl.name)) {
- for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!isOmittedExpression(element)) {
- collectExportedVariableInfo(element, uniqueExports);
- }
- }
- }
- else if (!isGeneratedIdentifier(decl.name)) {
- if (!uniqueExports[decl.name.text]) {
- uniqueExports[decl.name.text] = decl.name;
- }
- }
- }
function isDeclarationNameOfEnumOrNamespace(node) {
var parseNode = getParseTreeNode(node);
if (parseNode) {
@@ -9982,6 +9891,14 @@ var ts;
return isTypeNodeKind(node.kind);
}
ts.isTypeNode = isTypeNode;
+ function isArrayBindingPattern(node) {
+ return node.kind === 173;
+ }
+ ts.isArrayBindingPattern = isArrayBindingPattern;
+ function isObjectBindingPattern(node) {
+ return node.kind === 172;
+ }
+ ts.isObjectBindingPattern = isObjectBindingPattern;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
@@ -9991,6 +9908,12 @@ var ts;
return false;
}
ts.isBindingPattern = isBindingPattern;
+ function isAssignmentPattern(node) {
+ var kind = node.kind;
+ return kind === 175
+ || kind === 176;
+ }
+ ts.isAssignmentPattern = isAssignmentPattern;
function isBindingElement(node) {
return node.kind === 174;
}
@@ -10001,6 +9924,39 @@ var ts;
|| kind === 198;
}
ts.isArrayBindingElement = isArrayBindingElement;
+ function isDeclarationBindingElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 223:
+ case 144:
+ case 174:
+ return true;
+ }
+ return false;
+ }
+ ts.isDeclarationBindingElement = isDeclarationBindingElement;
+ function isBindingOrAssignmentPattern(node) {
+ return isObjectBindingOrAssignmentPattern(node)
+ || isArrayBindingOrAssignmentPattern(node);
+ }
+ ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
+ function isObjectBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 172:
+ case 176:
+ return true;
+ }
+ return false;
+ }
+ ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
+ function isArrayBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return true;
+ }
+ return false;
+ }
+ ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
function isArrayLiteralExpression(node) {
return node.kind === 175;
}
@@ -10067,7 +10023,8 @@ var ts;
|| kind === 98
|| kind === 100
|| kind === 96
- || kind === 201;
+ || kind === 201
+ || kind === 297;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
@@ -10095,6 +10052,7 @@ var ts;
|| kind === 196
|| kind === 200
|| kind === 198
+ || kind === 297
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -10108,11 +10066,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 293;
+ return node.kind === 294;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 292;
+ return node.kind === 293;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -10224,7 +10182,7 @@ var ts;
|| kind === 228
|| kind === 143
|| kind === 223
- || kind === 284;
+ || kind === 285;
}
function isDeclarationStatementKind(kind) {
return kind === 225
@@ -10259,9 +10217,9 @@ var ts;
|| kind === 205
|| kind === 210
|| kind === 217
- || kind === 292
- || kind === 295
- || kind === 294;
+ || kind === 293
+ || kind === 296
+ || kind === 295;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -10549,6 +10507,53 @@ var ts;
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
+ function validateLocaleAndSetLanguage(locale, sys, errors) {
+ var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
+ if (!matchResult) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
+ }
+ return;
+ }
+ var language = matchResult[1];
+ var territory = matchResult[3];
+ if (!trySetLanguageAndTerritory(language, territory, errors)) {
+ trySetLanguageAndTerritory(language, undefined, errors);
+ }
+ function trySetLanguageAndTerritory(language, territory, errors) {
+ var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
+ var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
+ var filePath = ts.combinePaths(containingDirectoryPath, language);
+ if (territory) {
+ filePath = filePath + "-" + territory;
+ }
+ filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
+ if (!sys.fileExists(filePath)) {
+ return false;
+ }
+ var fileContents = "";
+ try {
+ fileContents = sys.readFile(filePath);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
+ }
+ return false;
+ }
+ try {
+ ts.localizedDiagnosticMessages = JSON.parse(fileContents);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -10749,9 +10754,9 @@ var ts;
return node;
}
ts.createParameter = createParameter;
- function updateParameter(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
+ function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
}
return node;
}
@@ -10884,9 +10889,9 @@ var ts;
return node;
}
ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);
}
return node;
}
@@ -10926,7 +10931,7 @@ var ts;
function createPropertyAccess(expression, name, location, flags) {
var node = createNode(177, location, flags);
node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576;
+ (node.emitNode || (node.emitNode = {})).flags |= 65536;
node.name = typeof name === "string" ? createIdentifier(name) : name;
return node;
}
@@ -11147,13 +11152,21 @@ var ts;
return node;
}
ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(193, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
+ function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {
+ var node = createNode(193, whenFalse ? location : colonTokenOrLocation);
+ node.condition = parenthesizeForConditionalHead(condition);
+ if (whenFalse) {
+ node.questionToken = questionTokenOrWhenTrue;
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ node.colonToken = colonTokenOrLocation;
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);
+ }
+ else {
+ node.questionToken = createToken(54);
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);
+ node.colonToken = createToken(55);
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ }
return node;
}
ts.createConditional = createConditional;
@@ -11963,35 +11976,33 @@ var ts;
updated.imports = node.imports;
if (node.moduleAugmentations !== undefined)
updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
return updateNode(updated, node);
}
return node;
}
ts.updateSourceFileNode = updateSourceFileNode;
function createNotEmittedStatement(original) {
- var node = createNode(292, original);
+ var node = createNode(293, original);
node.original = original;
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createNode(295);
+ var node = createNode(296);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createNode(294);
+ var node = createNode(295);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(293, location || original);
+ var node = createNode(294, location || original);
node.expression = expression;
node.original = original;
return node;
@@ -12004,6 +12015,12 @@ var ts;
return node;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ function createRawExpression(text) {
+ var node = createNode(297);
+ node.text = text;
+ return node;
+ }
+ ts.createRawExpression = createRawExpression;
function createComma(left, right) {
return createBinary(left, 25, right);
}
@@ -12052,13 +12069,19 @@ var ts;
return createVoid(createLiteral(0));
}
ts.createVoidZero = createVoidZero;
+ function createTypeCheck(value, tag) {
+ return tag === "undefined"
+ ? createStrictEquality(value, createVoidZero())
+ : createStrictEquality(createTypeOf(value), createLiteral(tag));
+ }
+ ts.createTypeCheck = createTypeCheck;
function createMemberAccessForPropertyName(target, memberName, location) {
if (ts.isComputedPropertyName(memberName)) {
return createElementAccess(target, memberName.expression, location);
}
else {
var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048;
+ (expression.emitNode || (expression.emitNode = {})).flags |= 64;
return expression;
}
}
@@ -12100,7 +12123,10 @@ var ts;
}
function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
if (ts.isQualifiedName(jsxFactory)) {
- return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536));
+ var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);
+ var right = createSynthesizedNode(70);
+ right.text = jsxFactory.right.text;
+ return createPropertyAccess(left, right);
}
else {
return createReactNamespace(jsxFactory.text, parent);
@@ -12154,114 +12180,10 @@ var ts;
return createVariableDeclarationList(declarations, location, 2);
}
ts.createConstDeclarationList = createConstDeclarationList;
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [
- name,
- createIdentifier("_super")
- ]);
- }
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
- }
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location);
+ function getHelperName(name) {
+ return setEmitFlags(createIdentifier(name), 4096 | 2);
}
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body);
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
- }
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]);
- }
- function createGeti(target) {
- return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- return createArrowFunction(undefined, undefined, [
- createParameter(undefined, undefined, undefined, "name"),
- createParameter(undefined, undefined, undefined, "value")
- ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- var createCache = createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("cache", undefined, createObjectCreate(createNull()))
- ]));
- var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")]))
- ]));
- var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([
- createStatement(createCall(createIdentifier("seti"), undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [
- createParameter(undefined, undefined, undefined, "geti"),
- createParameter(undefined, undefined, undefined, "seti")
- ], undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))), undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ ts.getHelperName = getHelperName;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
@@ -12407,19 +12329,19 @@ var ts;
return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
}
function getLocalName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 262144);
+ return getName(node, allowComments, allowSourceMaps, 16384);
}
ts.getLocalName = getLocalName;
function isLocalName(node) {
- return (getEmitFlags(node) & 262144) !== 0;
+ return (getEmitFlags(node) & 16384) !== 0;
}
ts.isLocalName = isLocalName;
function getExportName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 131072);
+ return getName(node, allowComments, allowSourceMaps, 8192);
}
ts.getExportName = getExportName;
function isExportName(node) {
- return (getEmitFlags(node) & 131072) !== 0;
+ return (getEmitFlags(node) & 8192) !== 0;
}
ts.isExportName = isExportName;
function getDeclarationName(node, allowComments, allowSourceMaps) {
@@ -12428,15 +12350,15 @@ var ts;
ts.getDeclarationName = getDeclarationName;
function getName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
- var name_13 = getMutableClone(node.name);
+ var name_10 = getMutableClone(node.name);
emitFlags |= getEmitFlags(node.name);
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
- setEmitFlags(name_13, emitFlags);
- return name_13;
+ setEmitFlags(name_10, emitFlags);
+ return name_10;
}
return getGeneratedNameForNode(node);
}
@@ -12451,14 +12373,18 @@ var ts;
var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name);
var emitFlags;
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
setEmitFlags(qualifiedName, emitFlags);
return qualifiedName;
}
ts.getNamespaceMemberName = getNamespaceMemberName;
+ function convertToFunctionBody(node, multiLine) {
+ return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine);
+ }
+ ts.convertToFunctionBody = convertToFunctionBody;
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
@@ -12485,7 +12411,7 @@ var ts;
}
while (statementOffset < numStatements) {
var statement = source[statementOffset];
- if (getEmitFlags(statement) & 8388608) {
+ if (getEmitFlags(statement) & 524288) {
target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
}
else {
@@ -12496,10 +12422,17 @@ var ts;
return statementOffset;
}
ts.addPrologueDirectives = addPrologueDirectives;
- function ensureUseStrict(node) {
+ function startsWithUseStrict(statements) {
+ var firstStatement = ts.firstOrUndefined(statements);
+ return firstStatement !== undefined
+ && ts.isPrologueDirective(firstStatement)
+ && isUseStrictPrologue(firstStatement);
+ }
+ ts.startsWithUseStrict = startsWithUseStrict;
+ function ensureUseStrict(statements) {
var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
if (ts.isPrologueDirective(statement)) {
if (isUseStrictPrologue(statement)) {
foundUseStrict = true;
@@ -12511,11 +12444,11 @@ var ts;
}
}
if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- return updateSourceFileNode(node, statements.concat(node.statements));
+ return createNodeArray([
+ startOnNewLine(createStatement(createLiteral("use strict")))
+ ].concat(statements), statements);
}
- return node;
+ return statements;
}
ts.ensureUseStrict = ensureUseStrict;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
@@ -12590,6 +12523,21 @@ var ts;
}
return 0;
}
+ function parenthesizeForConditionalHead(condition) {
+ var conditionalPrecedence = ts.getOperatorPrecedence(193, 54);
+ var emittedCondition = skipPartiallyEmittedExpressions(condition);
+ var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
+ if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {
+ return createParen(condition);
+ }
+ return condition;
+ }
+ ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;
+ function parenthesizeSubexpressionOfConditionalExpression(e) {
+ return e.kind === 192 && e.operatorToken.kind === 25
+ ? createParen(e)
+ : e;
+ }
function parenthesizeForNew(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
switch (emittedExpression.kind) {
@@ -12695,7 +12643,7 @@ var ts;
case 177:
node = node.expression;
continue;
- case 293:
+ case 294:
node = node.expression;
continue;
}
@@ -12743,7 +12691,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 293) {
+ while (node.kind === 294) {
node = node.expression;
}
return node;
@@ -12765,8 +12713,8 @@ var ts;
}
ts.setOriginalNode = setOriginalNode;
function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;
+ if (!destEmitNode)
destEmitNode = {};
if (flags)
destEmitNode.flags = flags;
@@ -12776,6 +12724,10 @@ var ts;
destEmitNode.sourceMapRange = sourceMapRange;
if (tokenSourceMapRanges)
destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ if (constantValue !== undefined)
+ destEmitNode.constantValue = constantValue;
+ if (helpers)
+ destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);
return destEmitNode;
}
function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
@@ -12809,6 +12761,7 @@ var ts;
}
return node.emitNode;
}
+ ts.getOrCreateEmitNode = getOrCreateEmitNode;
function getEmitFlags(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.flags;
@@ -12819,11 +12772,22 @@ var ts;
return node;
}
ts.setEmitFlags = setEmitFlags;
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
+ }
+ ts.getSourceMapRange = getSourceMapRange;
function setSourceMapRange(node, range) {
getOrCreateEmitNode(node).sourceMapRange = range;
return node;
}
ts.setSourceMapRange = setSourceMapRange;
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ }
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
function setTokenSourceMapRange(node, token, range) {
var emitNode = getOrCreateEmitNode(node);
var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());
@@ -12831,27 +12795,16 @@ var ts;
return node;
}
ts.setTokenSourceMapRange = setTokenSourceMapRange;
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
function getCommentRange(node) {
var emitNode = node.emitNode;
return (emitNode && emitNode.commentRange) || node;
}
ts.getCommentRange = getCommentRange;
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
+ return node;
}
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ ts.setCommentRange = setCommentRange;
function getConstantValue(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.constantValue;
@@ -12863,6 +12816,103 @@ var ts;
return node;
}
ts.setConstantValue = setConstantValue;
+ function getExternalHelpersModuleName(node) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return emitNode && emitNode.externalHelpersModuleName;
+ }
+ ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {
+ if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
+ var externalHelpersModuleName = getExternalHelpersModuleName(node);
+ if (externalHelpersModuleName) {
+ return externalHelpersModuleName;
+ }
+ var helpers = getEmitHelpers(node);
+ if (helpers) {
+ for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
+ var helper = helpers_1[_i];
+ if (!helper.scoped) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = getOrCreateEmitNode(parseNode);
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));
+ }
+ }
+ }
+ }
+ }
+ ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
+ function addEmitHelper(node, helper) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ return node;
+ }
+ ts.addEmitHelper = addEmitHelper;
+ function addEmitHelpers(node, helpers) {
+ if (ts.some(helpers)) {
+ var emitNode = getOrCreateEmitNode(node);
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!ts.contains(emitNode.helpers, helper)) {
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ }
+ }
+ }
+ return node;
+ }
+ ts.addEmitHelpers = addEmitHelpers;
+ function removeEmitHelper(node, helper) {
+ var emitNode = node.emitNode;
+ if (emitNode) {
+ var helpers = emitNode.helpers;
+ if (helpers) {
+ return ts.orderedRemoveItem(helpers, helper);
+ }
+ }
+ return false;
+ }
+ ts.removeEmitHelper = removeEmitHelper;
+ function getEmitHelpers(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.helpers;
+ }
+ ts.getEmitHelpers = getEmitHelpers;
+ function moveEmitHelpers(source, target, predicate) {
+ var sourceEmitNode = source.emitNode;
+ var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
+ if (!ts.some(sourceEmitHelpers))
+ return;
+ var targetEmitNode = getOrCreateEmitNode(target);
+ var helpersRemoved = 0;
+ for (var i = 0; i < sourceEmitHelpers.length; i++) {
+ var helper = sourceEmitHelpers[i];
+ if (predicate(helper)) {
+ helpersRemoved++;
+ if (!ts.contains(targetEmitNode.helpers, helper)) {
+ targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);
+ }
+ }
+ else if (helpersRemoved > 0) {
+ sourceEmitHelpers[i - helpersRemoved] = helper;
+ }
+ }
+ if (helpersRemoved > 0) {
+ sourceEmitHelpers.length -= helpersRemoved;
+ }
+ }
+ ts.moveEmitHelpers = moveEmitHelpers;
+ function compareEmitHelpers(x, y) {
+ if (x === y)
+ return 0;
+ if (x.priority === y.priority)
+ return 0;
+ if (x.priority === undefined)
+ return 1;
+ if (y.priority === undefined)
+ return -1;
+ return ts.compareValues(x.priority, y.priority);
+ }
+ ts.compareEmitHelpers = compareEmitHelpers;
function setTextRange(node, location) {
if (location) {
node.pos = location.pos;
@@ -12889,8 +12939,8 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_14 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_14) ? name_14 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_11 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
if (node.kind === 235 && node.importClause) {
return getGeneratedNameForNode(node);
@@ -12933,221 +12983,291 @@ var ts;
function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
- function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
- var multiLine = false;
- var singleLine = false;
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- context.startLexicalEnvironment();
- if (ts.isBlock(body)) {
- statementOffset = addPrologueDirectives(statements, body.statements, false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
- addRestParameterIfNeeded(statements, node, false);
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
+ function getInitializerOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.initializer;
}
- else {
- ts.Debug.assert(node.kind === 185);
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = createReturn(expression, body);
- setEmitFlags(returnStatement, 12288 | 1024 | 32768);
- statements.push(returnStatement);
- closeBraceLocation = body;
+ if (ts.isPropertyAssignment(bindingElement)) {
+ return ts.isAssignmentExpression(bindingElement.initializer, true)
+ ? bindingElement.initializer.right
+ : undefined;
}
- var lexicalEnvironment = context.endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
+ if (ts.isShorthandPropertyAssignment(bindingElement)) {
+ return bindingElement.objectAssignmentInitializer;
}
- var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- setEmitFlags(block, 32);
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return bindingElement.right;
}
- if (closeBraceLocation) {
- setTokenSourceMapRange(block, 17, closeBraceLocation);
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
}
- setOriginalNode(block, node.body);
- return block;
}
- ts.transformFunctionBody = transformFunctionBody;
- function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
- if (node.transformFlags & 524288 && node.kind !== 185) {
- captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
+ ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
+ function getTargetOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.name;
+ }
+ if (ts.isObjectLiteralElementLike(bindingElement)) {
+ switch (bindingElement.kind) {
+ case 257:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
+ case 258:
+ return bindingElement.name;
+ case 259:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return undefined;
}
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.left);
+ }
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return bindingElement;
}
- ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
- function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration("_this", undefined, initializer)
- ]), originalStatement);
- setEmitFlags(captureThisStatement, 49152 | 8388608);
- setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
+ ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 144:
+ case 174:
+ return bindingElement.dotDotDotToken;
+ case 196:
+ case 259:
+ return bindingElement;
+ }
+ return undefined;
}
- ts.captureThisForNode = captureThisForNode;
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 2097152) !== 0;
+ ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 174:
+ if (bindingElement.propertyName) {
+ var propertyName = bindingElement.propertyName;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 257:
+ if (bindingElement.name) {
+ var propertyName = bindingElement.name;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 259:
+ return bindingElement.name;
+ }
+ var target = getTargetOfBindingOrAssignmentElement(bindingElement);
+ if (target && ts.isPropertyName(target)) {
+ return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)
+ ? target.expression
+ : target;
+ }
+ ts.Debug.fail("Invalid property name for binding element.");
}
- function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
+ function getElementsOfBindingOrAssignmentPattern(name) {
+ switch (name.kind) {
+ case 172:
+ case 173:
+ case 175:
+ return name.elements;
+ case 176:
+ return name.properties;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_15 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- if (dotDotDotToken) {
- continue;
+ }
+ ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
+ function convertToArrayAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpread(element.name, element), element);
}
- if (ts.isBindingPattern(name_15)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_15, initializer, visitor, convertObjectRest);
+ var expression = convertToAssignmentElementTarget(element.name);
+ return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;
+ }
+ ts.Debug.assertNode(element, ts.isExpression);
+ return element;
+ }
+ ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;
+ function convertToObjectAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpreadAssignment(element.name, element), element);
}
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_15, initializer, visitor);
+ if (element.propertyName) {
+ var expression = convertToAssignmentElementTarget(element.name);
+ return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);
}
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);
}
+ ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);
+ return element;
}
- ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
- var temp = getGeneratedNameForNode(parameter);
- if (name.elements.length > 0) {
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608));
+ ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
+ function convertToAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return convertToArrayAssignmentPattern(node);
+ case 172:
+ case 176:
+ return convertToObjectAssignmentPattern(node);
}
- else if (initializer) {
- statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
+ }
+ ts.convertToAssignmentPattern = convertToAssignmentPattern;
+ function convertToObjectAssignmentPattern(node) {
+ if (ts.isObjectBindingPattern(node)) {
+ return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);
}
+ ts.Debug.assertNode(node, ts.isObjectLiteralExpression);
+ return node;
}
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
- createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter))
- ], parameter), 32 | 1024 | 12288), undefined, parameter);
- statement.startsOnNewLine = true;
- setEmitFlags(statement, 12288 | 1024 | 8388608);
- statements.push(statement);
+ ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;
+ function convertToArrayAssignmentPattern(node) {
+ if (ts.isArrayBindingPattern(node)) {
+ return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);
+ }
+ ts.Debug.assertNode(node, ts.isArrayLiteralExpression);
+ return node;
}
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;
+ function convertToAssignmentElementTarget(node) {
+ if (ts.isBindingPattern(node)) {
+ return convertToAssignmentPattern(node);
+ }
+ ts.Debug.assertNode(node, ts.isExpression);
+ return node;
}
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;
+ function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var exportedNames;
+ var hasExportDefault = false;
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);
+ var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));
+ if (externalHelpersImportDeclaration) {
+ externalImports.push(externalHelpersImportDeclaration);
}
- var declarationName = getMutableClone(parameter.name);
- setEmitFlags(declarationName, 1536);
- var expressionName = getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = createLoopVariable();
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration(declarationName, undefined, createArrayLiteral([]))
- ]), parameter), 8388608));
- var forStatement = createFor(createVariableDeclarationList([
- createVariableDeclaration(temp, undefined, createLiteral(restIndex))
- ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([
- startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter))
- ]));
- setEmitFlags(forStatement, 8388608);
- startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
- function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- var counter = convertObjectRest ? undefined : createLoopVariable();
- var rhsReference = expression.kind === 70
- ? createUniqueName(expression.text)
- : createTempVariable(undefined);
- var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest);
- var declarationList = createVariableDeclarationList(declarations, initializer);
- setOriginalNode(declarationList, initializer);
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(createVariableStatement(undefined, declarationList));
- }
- else {
- statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([
- createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter))
- ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 235:
+ externalImports.push(node);
+ break;
+ case 234:
+ if (node.moduleReference.kind === 245) {
+ externalImports.push(node);
+ }
+ break;
+ case 241:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ externalImports.push(node);
+ }
+ }
+ else {
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ if (!uniqueExports[specifier.name.text]) {
+ var name_12 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_12.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_12)
+ || resolver.getReferencedValueDeclaration(name_12);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = true;
+ exportedNames = ts.append(exportedNames, specifier.name);
+ }
+ }
+ }
+ break;
+ case 240:
+ if (node.isExportEquals && !exportEquals) {
+ exportEquals = node;
+ }
+ break;
+ case 205:
+ if (ts.hasModifier(node, 1)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
+ }
+ }
+ break;
+ case 225:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_13 = node.name;
+ if (!uniqueExports[name_13.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13);
+ uniqueExports[name_13.text] = true;
+ exportedNames = ts.append(exportedNames, name_13);
+ }
+ }
+ }
+ break;
+ case 226:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_14 = node.name;
+ if (!uniqueExports[name_14.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14);
+ uniqueExports[name_14.text] = true;
+ exportedNames = ts.append(exportedNames, name_14);
+ }
+ }
+ }
+ break;
}
}
- else {
- var assignment = createAssignment(initializer, elementAccess);
- if (ts.isDestructuringAssignment(assignment)) {
- statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
- }
- else {
- assignment.end = initializer.end;
- statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
+ }
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
+ }
}
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
- }
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = true;
+ exportedNames = ts.append(exportedNames, decl.name);
}
}
- setEmitFlags(expression, 1536 | getEmitFlags(expression));
- var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation);
- setEmitFlags(body, 1536 | 12288);
- var forStatement;
- if (convertObjectRest) {
- forStatement = createForOf(createVariableDeclarationList([
- createVariableDeclaration(rhsReference, undefined, undefined, node.expression)
- ], node.expression), node.expression, body, node);
- }
- else {
- forStatement = createFor(setEmitFlags(createVariableDeclarationList([
- createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)),
- createVariableDeclaration(rhsReference, undefined, expression, node.expression)
- ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node);
- }
- setEmitFlags(forStatement, 8192);
- return forStatement;
+ return exportedNames;
}
- ts.convertForOf = convertForOf;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -13545,29 +13665,31 @@ var ts;
visitNode(cbNode, node.type);
case 278:
return visitNodes(cbNodes, node.tags);
- case 280:
+ case 281:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 281:
- return visitNode(cbNode, node.typeExpression);
case 282:
return visitNode(cbNode, node.typeExpression);
case 283:
- return visitNodes(cbNodes, node.typeParameters);
+ return visitNode(cbNode, node.typeExpression);
+ case 280:
+ return visitNode(cbNode, node.typeExpression);
case 284:
+ return visitNodes(cbNodes, node.typeParameters);
+ case 285:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 286:
+ case 287:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 285:
+ case 286:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 293:
+ case 294:
return visitNode(cbNode, node.expression);
- case 287:
+ case 288:
return visitNode(cbNode, node.literal);
}
}
@@ -13691,7 +13813,7 @@ var ts;
return sourceFile;
}
function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ var comments = ts.getJSDocCommentRanges(node, sourceFile.text);
if (comments) {
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var comment = comments_2[_i];
@@ -13699,10 +13821,10 @@ var ts;
if (!jsDoc) {
continue;
}
- if (!node.jsDocComments) {
- node.jsDocComments = [];
+ if (!node.jsDoc) {
+ node.jsDoc = [];
}
- node.jsDocComments.push(jsDoc);
+ node.jsDoc.push(jsDoc);
}
}
return node;
@@ -13717,12 +13839,12 @@ var ts;
var saveParent = parent;
parent = n;
forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
+ if (n.jsDoc) {
+ for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ jsDoc.parent = n;
+ parent = jsDoc;
+ forEachChild(jsDoc, visitNode);
}
}
parent = saveParent;
@@ -16899,8 +17021,8 @@ var ts;
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators || modifiers) {
- var name_16 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_16, undefined);
+ var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined);
}
ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
@@ -17547,7 +17669,7 @@ var ts;
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(287);
+ var result = createNode(288);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -17727,6 +17849,9 @@ var ts;
var tag;
if (tagName) {
switch (tagName.text) {
+ case "augments":
+ tag = parseAugmentsTag(atToken, tagName);
+ break;
case "param":
tag = parseParamTag(atToken, tagName);
break;
@@ -17866,7 +17991,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(280, atToken.pos);
+ var result = createNode(281, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -17877,20 +18002,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 281; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(281, atToken.pos);
+ var result = createNode(282, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(282, atToken.pos);
+ var result = createNode(283, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -17905,17 +18030,25 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(285, atToken.pos);
+ var result = createNode(286, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
return finishNode(result);
}
+ function parseAugmentsTag(atToken, tagName) {
+ var typeExpression = tryParseTypeExpression();
+ var result = createNode(280, atToken.pos);
+ result.atToken = atToken;
+ result.tagName = tagName;
+ result.typeExpression = typeExpression;
+ return finishNode(result);
+ }
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(284, atToken.pos);
+ var typedefTag = createNode(285, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(0);
@@ -17932,8 +18065,8 @@ var ts;
if (typeExpression.type.kind === 272) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70) {
- var name_17 = jsDocTypeReference.name;
- if (name_17.text === "Object") {
+ var name_16 = jsDocTypeReference.name;
+ if (name_16.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -17947,7 +18080,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(286, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(287, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -18032,19 +18165,19 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 284; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
var typeParameters = createNodeArray();
while (true) {
- var name_18 = parseJSDocIdentifierName();
+ var name_17 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_18) {
+ if (!name_17) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(143, name_18.pos);
- typeParameter.name = name_18;
+ var typeParameter = createNode(143, name_17.pos);
+ typeParameter.name = name_17;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25) {
@@ -18055,7 +18188,7 @@ var ts;
break;
}
}
- var result = createNode(283, atToken.pos);
+ var result = createNode(284, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -18135,8 +18268,8 @@ var ts;
ts.Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
forEachChild(jsDocComment, visitNode, visitArray);
}
@@ -18520,7 +18653,7 @@ var ts;
}
if (node.name.kind === 142) {
var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
@@ -18565,7 +18698,7 @@ var ts;
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 284:
+ case 285:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
if (parentNode && parentNode.kind === 205) {
@@ -18640,7 +18773,7 @@ var ts;
}
}
else {
- var isJSDocTypedefInJSDocNamespace = node.kind === 284 &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 285 &&
node.name &&
node.name.kind === 70 &&
node.name.isInJSDocNamespace;
@@ -18745,12 +18878,35 @@ var ts;
subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);
}
}
+ function bindEach(nodes) {
+ if (nodes === undefined) {
+ return;
+ }
+ if (skipTransformFlagAggregation) {
+ ts.forEach(nodes, bind);
+ }
+ else {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
+ var node = nodes_2[_i];
+ bind(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
+ }
+ }
+ function bindEachChild(node) {
+ ts.forEachChild(node, bind, bindEach);
+ }
function bindChildrenWorker(node) {
- if (ts.isInJavaScriptFile(node) && node.jsDocComments) {
- ts.forEach(node.jsDocComments, bind);
+ if (ts.isInJavaScriptFile(node) && node.jsDoc) {
+ ts.forEach(node.jsDoc, bind);
}
if (checkUnreachable(node)) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
return;
}
switch (node.kind) {
@@ -18815,7 +18971,7 @@ var ts;
bindCallExpressionFlow(node);
break;
default:
- ts.forEachChild(node, bind);
+ bindEachChild(node);
break;
}
}
@@ -19118,7 +19274,7 @@ var ts;
}
return undefined;
}
- function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
+ function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
var flowLabel = node.kind === 215 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
@@ -19131,11 +19287,11 @@ var ts;
var activeLabel = findActiveLabel(node.label.text);
if (activeLabel) {
activeLabel.referenced = true;
- bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
+ bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
}
}
else {
- bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
+ bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
}
}
function bindTryStatement(node) {
@@ -19186,6 +19342,8 @@ var ts;
currentFlow = finishFlowLabel(postSwitchLabel);
}
function bindCaseBlock(node) {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
var clauses = node.clauses;
var fallthroughFlow = unreachableFlow;
for (var i = 0; i < clauses.length; i++) {
@@ -19205,13 +19363,15 @@ var ts;
errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);
}
}
+ clauses.transformFlags = subtreeTransformFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
}
function bindCaseClause(node) {
var saveCurrentFlow = currentFlow;
currentFlow = preSwitchCaseFlow;
bind(node.expression);
currentFlow = saveCurrentFlow;
- ts.forEach(node.statements, bind);
+ bindEach(node.statements);
}
function pushActiveLabel(name, breakTarget, continueTarget) {
var activeLabel = {
@@ -19297,19 +19457,19 @@ var ts;
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
- ts.forEachChild(node, bind);
+ bindEachChild(node);
currentFalseTarget = currentTrueTarget;
currentTrueTarget = saveTrueTarget;
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
@@ -19327,7 +19487,7 @@ var ts;
}
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
if (operator === 57 && node.left.kind === 178) {
@@ -19340,7 +19500,7 @@ var ts;
}
}
function bindDeleteExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.expression.kind === 177) {
bindAssignmentTargetFlow(node.expression);
}
@@ -19373,7 +19533,7 @@ var ts;
}
}
function bindVariableDeclarationFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) {
bindInitializedVariableFlow(node);
}
@@ -19384,12 +19544,12 @@ var ts;
expr = expr.expression;
}
if (expr.kind === 184 || expr.kind === 185) {
- ts.forEach(node.typeArguments, bind);
- ts.forEach(node.arguments, bind);
+ bindEach(node.typeArguments);
+ bindEach(node.arguments);
bind(node.expression);
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
}
if (node.expression.kind === 177) {
var propertyAccess = node.expression;
@@ -19405,7 +19565,7 @@ var ts;
case 229:
case 176:
case 161:
- case 286:
+ case 287:
case 270:
return 1;
case 227:
@@ -19474,7 +19634,7 @@ var ts;
case 176:
case 227:
case 270:
- case 286:
+ case 287:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
case 158:
case 159:
@@ -19768,8 +19928,8 @@ var ts;
}
function updateStrictModeStatementList(statements) {
if (!inStrictMode) {
- for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
- var statement = statements_1[_i];
+ for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
+ var statement = statements_2[_i];
if (!ts.isPrologueDirective(statement)) {
return;
}
@@ -19789,7 +19949,7 @@ var ts;
case 70:
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 284) {
+ while (parentNode && parentNode.kind !== 285) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288, 793064);
@@ -19859,7 +20019,7 @@ var ts;
case 146:
case 271:
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);
- case 285:
+ case 286:
return bindJSDocProperty(node);
case 257:
case 258:
@@ -19903,7 +20063,7 @@ var ts;
return bindFunctionOrConstructorType(node);
case 161:
case 170:
- case 286:
+ case 287:
case 270:
return bindAnonymousDeclaration(node, 2048, "__type");
case 176:
@@ -19922,7 +20082,7 @@ var ts;
return bindClassLikeDeclaration(node);
case 227:
return bindBlockScopedDeclaration(node, 64, 792968);
- case 284:
+ case 285:
if (!node.fullName || node.fullName.kind === 70) {
return bindBlockScopedDeclaration(node, 524288, 793064);
}
@@ -19996,12 +20156,12 @@ var ts;
return;
}
else {
- var parent_5 = node.parent;
- if (!ts.isExternalModule(parent_5)) {
+ var parent_4 = node.parent;
+ if (!ts.isExternalModule(parent_4)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_5.isDeclarationFile) {
+ if (!parent_4.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -20287,12 +20447,12 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608
+ if (subtreeFlags & 524288
|| isSuperOrSuperProperty(expression, expressionKind)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
@@ -20311,28 +20471,28 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
if (operatorTokenKind === 57 && leftKind === 176) {
- transformFlags |= 48 | 3072 | 49152;
+ transformFlags |= 8 | 192 | 3072;
}
else if (operatorTokenKind === 57 && leftKind === 175) {
- transformFlags |= 3072 | 49152;
+ transformFlags |= 192 | 3072;
}
else if (operatorTokenKind === 39
|| operatorTokenKind === 61) {
- transformFlags |= 768;
+ transformFlags |= 32;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20342,21 +20502,21 @@ var ts;
var dotDotDotToken = node.dotDotDotToken;
if (node.questionToken
|| node.type
- || subtreeFlags & 65536
+ || subtreeFlags & 4096
|| ts.isThisIdentifier(name)) {
transformFlags |= 3;
}
if (modifierFlags & 92) {
- transformFlags |= 3 | 4194304;
+ transformFlags |= 3 | 262144;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 67108864 || initializer || dotDotDotToken) {
- transformFlags |= 3072 | 2097152;
+ if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {
+ transformFlags |= 192 | 131072;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~536872257;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20367,11 +20527,11 @@ var ts;
|| expressionKind === 182) {
transformFlags |= 3;
}
- if (expressionTransformFlags & 16384) {
- transformFlags |= 16384;
+ if (expressionTransformFlags & 1024) {
+ transformFlags |= 1024;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -20380,35 +20540,35 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 3072;
- if ((subtreeFlags & 4390912)
+ transformFlags = subtreeFlags | 192;
+ if ((subtreeFlags & 274432)
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeClassExpression(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
- if (subtreeFlags & 4390912
+ var transformFlags = subtreeFlags | 192;
+ if (subtreeFlags & 274432
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 107:
transformFlags |= 3;
@@ -20418,23 +20578,23 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~537920833;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.typeArguments) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20442,11 +20602,14 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeMethod(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.decorators
|| ts.hasModifier(node, 2270)
|| node.typeParameters
@@ -20454,14 +20617,17 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20471,16 +20637,19 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computePropertyDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags | 3;
if (node.initializer) {
- transformFlags |= 131072;
+ transformFlags |= 8192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -20490,27 +20659,27 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 268435456;
+ transformFlags = subtreeFlags | 33554432;
if (modifierFlags & 2270
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (modifierFlags & 256) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20520,63 +20689,60 @@ var ts;
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeArrowFunction(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (ts.hasModifier(node, 2270)
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 262144) {
- transformFlags |= 524288;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~979719509;
+ return transformFlags & ~601249089;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
if (expressionKind === 96) {
- transformFlags |= 262144;
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var nameKind = node.name.kind;
- if (nameKind === 172) {
- transformFlags |= 48 | 3072 | 67108864;
- }
- else if (nameKind === 173) {
- transformFlags |= 3072 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
if (node.type) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -20587,21 +20753,21 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- if (declarationListTransformFlags & 67108864) {
- transformFlags |= 3072;
+ if (declarationListTransformFlags & 8388608) {
+ transformFlags |= 192;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (subtreeFlags & 33554432
+ if (subtreeFlags & 4194304
&& ts.isIterationStatement(node, true)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20609,15 +20775,15 @@ var ts;
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.transformFlags & 16384) {
- transformFlags |= 3072;
+ if (node.expression.transformFlags & 1024) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3;
@@ -20626,26 +20792,26 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~839734613;
+ return transformFlags & ~574674241;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 268435456;
- if (subtreeFlags & 67108864) {
- transformFlags |= 3072;
+ var transformFlags = subtreeFlags | 33554432;
+ if (subtreeFlags & 8388608) {
+ transformFlags |= 192;
}
if (node.flags & 3) {
- transformFlags |= 3072 | 33554432;
+ transformFlags |= 192 | 4194304;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~546309441;
}
function computeOther(node, kind, subtreeFlags) {
var transformFlags = subtreeFlags;
- var excludeFlags = 536892757;
+ var excludeFlags = 536872257;
switch (kind) {
case 119:
case 189:
- transformFlags |= 192;
+ transformFlags |= 16;
break;
case 113:
case 111:
@@ -20669,10 +20835,10 @@ var ts;
case 250:
case 251:
case 252:
- transformFlags |= 12;
+ transformFlags |= 4;
break;
case 213:
- transformFlags |= 48;
+ transformFlags |= 8;
case 12:
case 13:
case 14:
@@ -20681,10 +20847,10 @@ var ts;
case 181:
case 258:
case 114:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 195:
- transformFlags |= 3072 | 134217728;
+ transformFlags |= 192 | 16777216;
break;
case 118:
case 132:
@@ -20721,73 +20887,79 @@ var ts;
excludeFlags = -3;
break;
case 142:
- transformFlags |= 16777216;
- if (subtreeFlags & 262144) {
- transformFlags |= 1048576;
+ transformFlags |= 2097152;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 65536;
}
break;
case 196:
+ transformFlags |= 192 | 524288;
+ break;
case 259:
- transformFlags |= 8388608;
+ transformFlags |= 8 | 1048576;
break;
- case 174:
- if (node.dotDotDotToken) {
- transformFlags |= 8388608;
- }
case 96:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 98:
- transformFlags |= 262144;
+ transformFlags |= 16384;
break;
case 172:
- case 173:
- if (subtreeFlags & 8388608) {
- transformFlags |= 48 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 8 | 1048576;
}
- else {
- transformFlags |= 3072 | 67108864;
+ excludeFlags = 537396545;
+ break;
+ case 173:
+ transformFlags |= 192 | 8388608;
+ excludeFlags = 537396545;
+ break;
+ case 174:
+ transformFlags |= 192;
+ if (node.dotDotDotToken) {
+ transformFlags |= 524288;
}
break;
case 145:
- transformFlags |= 3 | 65536;
+ transformFlags |= 3 | 4096;
break;
case 176:
- excludeFlags = 554784085;
- if (subtreeFlags & 16777216) {
- transformFlags |= 3072;
+ excludeFlags = 540087617;
+ if (subtreeFlags & 2097152) {
+ transformFlags |= 192;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
break;
case 175:
case 180:
- excludeFlags = 545281365;
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ excludeFlags = 537396545;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
break;
case 209:
case 210:
case 211:
case 212:
- if (subtreeFlags & 33554432) {
- transformFlags |= 3072;
+ if (subtreeFlags & 4194304) {
+ transformFlags |= 192;
}
break;
case 261:
- if (subtreeFlags & 524288) {
- transformFlags |= 3072;
+ if (subtreeFlags & 32768) {
+ transformFlags |= 192;
}
break;
case 216:
case 214:
case 215:
- transformFlags |= 268435456;
+ transformFlags |= 33554432;
break;
}
node.transformFlags = transformFlags | 536870912;
@@ -20801,27 +20973,27 @@ var ts;
case 179:
case 180:
case 175:
- return 545281365;
+ return 537396545;
case 230:
- return 839734613;
+ return 574674241;
case 144:
- return 604001621;
+ return 536872257;
case 185:
- return 979719509;
+ return 601249089;
case 184:
case 225:
- return 980243797;
+ return 601281857;
case 224:
- return 604001621;
+ return 546309441;
case 226:
case 197:
- return 559895893;
+ return 539358529;
case 150:
- return 975983957;
+ return 601015617;
case 149:
case 151:
case 152:
- return 975983957;
+ return 601015617;
case 118:
case 132:
case 129:
@@ -20839,9 +21011,14 @@ var ts;
case 228:
return -3;
case 176:
- return 554784085;
+ return 540087617;
+ case 256:
+ return 537920833;
+ case 172:
+ case 173:
+ return 537396545;
default:
- return 536892757;
+ return 536872257;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -20933,6 +21110,7 @@ var ts;
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
isOptionalParameter: isOptionalParameter,
+ tryGetMemberInModuleExports: tryGetMemberInModuleExports,
tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
return tryFindAmbientModule(moduleName, false);
}
@@ -20942,6 +21120,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var indexedAccessTypes = ts.createMap();
var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 | 67108864, "unknown");
var resolvingSymbol = createSymbol(67108864, "__resolving__");
@@ -20961,7 +21140,6 @@ var ts;
var voidType = createIntrinsicType(1024, "void");
var neverType = createIntrinsicType(8192, "never");
var silentNeverType = createIntrinsicType(8192, "never");
- var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type");
emptyTypeLiteralSymbol.members = ts.createMap();
@@ -21511,6 +21689,7 @@ var ts;
if (!errorLocation ||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
!checkAndReportErrorForExtendingInterface(errorLocation) &&
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg));
}
@@ -21587,6 +21766,16 @@ var ts;
return undefined;
}
}
+ function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
+ if (meaning === 1920) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
+ if (symbol) {
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);
+ return true;
+ }
+ }
+ return false;
+ }
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
if (meaning & (107455 & ~1024)) {
var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
@@ -21692,28 +21881,28 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_19 = specifier.propertyName || specifier.name;
- if (name_19.text) {
+ var name_18 = specifier.propertyName || specifier.name;
+ if (name_18.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_19.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_19.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text);
}
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_19.text);
- if (!symbolFromModule && allowSyntheticDefaultImports && name_19.text === "default") {
+ var symbolFromModule = getExportOfModule(targetSymbol, name_18.text);
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_19, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_19));
+ error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18));
}
return symbol;
}
@@ -21938,6 +22127,12 @@ var ts;
function getExportsOfModuleAsArray(moduleSymbol) {
return symbolsToArray(getExportsOfModule(moduleSymbol));
}
+ function tryGetMemberInModuleExports(memberName, moduleSymbol) {
+ var symbolTable = getExportsOfModule(moduleSymbol);
+ if (symbolTable) {
+ return symbolTable[memberName];
+ }
+ }
function getExportsOfSymbol(symbol) {
return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
@@ -22453,9 +22648,9 @@ var ts;
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2));
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
- var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_6) {
- walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false);
+ var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_5) {
+ walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false);
}
}
if (accessibleSymbolChain) {
@@ -22588,12 +22783,12 @@ var ts;
var length_1 = outerTypeParameters.length;
while (i < length_1) {
var start = i;
- var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_7, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);
writePunctuation(writer, 22);
}
}
@@ -23017,12 +23212,12 @@ var ts;
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_8 = getDeclarationContainer(node);
+ var parent_7 = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) {
- return isGlobalSourceFile(parent_8);
+ !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) {
+ return isGlobalSourceFile(parent_7);
}
- return isDeclarationVisible(parent_8);
+ return isDeclarationVisible(parent_7);
case 147:
case 146:
case 151:
@@ -23178,15 +23373,15 @@ var ts;
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression);
}
function getRestType(source, properties, symbol) {
ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now.");
var members = ts.createMap();
var names = ts.createMap();
for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var name_20 = properties_2[_i];
- names[ts.getTextOfPropertyName(name_20)] = true;
+ var name_19 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_19)] = true;
}
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
var prop = _b[_a];
@@ -23224,26 +23419,26 @@ var ts;
var literalMembers = [];
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 198 && !element.dotDotDotToken) {
+ if (!element.dotDotDotToken) {
literalMembers.push(element.propertyName || element.name);
}
}
type = getRestType(parentType, literalMembers, declaration.symbol);
}
else {
- var name_21 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_21)) {
+ var name_20 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_20)) {
return anyType;
}
if (declaration.initializer) {
getContextualType(declaration.initializer);
}
- var text = ts.getTextOfPropertyName(name_21);
+ var text = ts.getTextOfPropertyName(name_20);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||
getIndexTypeOfType(parentType, 0);
if (!type) {
- error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_21));
+ error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20));
return unknownType;
}
}
@@ -23277,29 +23472,9 @@ var ts;
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
- if (jsDocType) {
- return getTypeFromTypeNode(jsDocType);
- }
- }
- function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var typeTag = ts.getJSDocTypeTag(declaration);
- if (typeTag && typeTag.typeExpression) {
- return typeTag.typeExpression.type;
- }
- if (declaration.kind === 223 &&
- declaration.parent.kind === 224 &&
- declaration.parent.parent.kind === 205) {
- var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
- if (annotation && annotation.typeExpression) {
- return annotation.typeExpression.type;
- }
- }
- else if (declaration.kind === 144) {
- var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type;
- }
+ var jsdocType = ts.getJSDocType(declaration);
+ if (jsdocType) {
+ return getTypeFromTypeNode(jsdocType);
}
return undefined;
}
@@ -23322,7 +23497,8 @@ var ts;
}
}
if (declaration.parent.parent.kind === 212) {
- return stringType;
+ var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
+ return indexType.flags & (16384 | 262144) ? indexType : stringType;
}
if (declaration.parent.parent.kind === 213) {
return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;
@@ -23333,7 +23509,8 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
+ if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) &&
+ declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {
if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -23472,7 +23649,7 @@ var ts;
if (declaration.kind === 240) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) {
+ if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
if (!pushTypeResolution(symbol, 0)) {
@@ -23482,9 +23659,9 @@ var ts;
if (declaration.kind === 192 ||
declaration.kind === 177 && declaration.parent.kind === 192) {
if (declaration.flags & 2097152) {
- var typeTag = ts.getJSDocTypeTag(declaration.parent);
- if (typeTag && typeTag.typeExpression) {
- return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
+ var jsdocType = ts.getJSDocType(declaration.parent);
+ if (jsdocType) {
+ return links.type = getTypeFromTypeNode(jsdocType);
}
}
var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ?
@@ -23785,6 +23962,13 @@ var ts;
}
baseType = getReturnTypeOfSignature(constructors[0]);
}
+ var valueDecl = type.symbol.valueDeclaration;
+ if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {
+ var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);
+ if (augTag) {
+ baseType = getTypeFromTypeNode(augTag.typeExpression.type);
+ }
+ }
if (baseType === unknownType) {
return;
}
@@ -23793,7 +23977,7 @@ var ts;
return;
}
if (type === baseType || hasBaseType(baseType, type)) {
- error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
+ error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
return;
}
if (type.resolvedBaseTypes === emptyArray) {
@@ -23895,7 +24079,7 @@ var ts;
if (!pushTypeResolution(symbol, 2)) {
return unknownType;
}
- var declaration = ts.getDeclarationOfKind(symbol, 284);
+ var declaration = ts.getDeclarationOfKind(symbol, 285);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -24382,6 +24566,7 @@ var ts;
var members = ts.createMap();
var stringIndexInfo;
var numberIndexInfo;
+ setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var typeParameter = getTypeParameterFromMappedType(type);
var constraintType = getConstraintTypeFromMappedType(type);
var templateType = getTemplateTypeFromMappedType(type);
@@ -24426,6 +24611,9 @@ var ts;
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
unknownType);
}
+ function getErasedTemplateTypeFromMappedType(type) {
+ return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
+ }
function isGenericMappedType(type) {
if (getObjectFlags(type) & 32) {
var constraintType = getConstraintTypeFromMappedType(type);
@@ -24513,14 +24701,18 @@ var ts;
}
return type.resolvedApparentType;
}
+ function getApparentTypeOfIndexedAccess(type) {
+ return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;
+ }
function getApparentType(type) {
- var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type;
- return t.flags & 34 ? globalStringType :
+ var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :
+ type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :
+ type;
+ return t.flags & 262178 ? globalStringType :
t.flags & 340 ? globalNumberType :
t.flags & 136 ? globalBooleanType :
t.flags & 512 ? getGlobalESSymbolType() :
- t.flags & 262144 ? stringOrNumberType :
- t;
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -24693,13 +24885,16 @@ var ts;
if (node.type && node.type.kind === 273) {
return true;
}
- var paramTag = ts.getCorrespondingJSDocParameterTag(node);
- if (paramTag) {
- if (paramTag.isBracketed) {
- return true;
- }
- if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 273;
+ var paramTags = ts.getJSDocParameterTags(node);
+ if (paramTags) {
+ for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {
+ var paramTag = paramTags_1[_i];
+ if (paramTag.isBracketed) {
+ return true;
+ }
+ if (paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 273;
+ }
}
}
}
@@ -25534,10 +25729,14 @@ var ts;
}
function getIndexType(type) {
return type.flags & 16384 ? getIndexTypeForTypeParameter(type) :
- type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType :
- getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :
+ type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType :
getLiteralTypeFromPropertyNames(type);
}
+ function getIndexTypeOrString(type) {
+ var indexType = getIndexType(type);
+ return indexType !== neverType ? indexType : stringType;
+ }
function getTypeFromTypeOperatorNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -25551,10 +25750,6 @@ var ts;
type.indexType = indexType;
return type;
}
- function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
- var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
- return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
- }
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
var propName = indexType.flags & (32 | 64 | 256) ?
@@ -25577,7 +25772,7 @@ var ts;
return getTypeOfSymbol(prop);
}
}
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) {
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) {
if (isTypeAny(objectType)) {
return anyType;
}
@@ -25617,20 +25812,38 @@ var ts;
}
return unknownType;
}
+ function getIndexedAccessForMappedType(type, indexType, accessNode) {
+ var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
+ return unknownType;
+ }
+ var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);
+ var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
+ return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken);
+ }
function getIndexedAccessType(objectType, indexType, accessNode) {
- if (indexType.flags & 16384) {
- if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
- error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
- return unknownType;
+ if (indexType.flags & 16384 ||
+ objectType.flags & 16384 && indexType.flags & 262144 ||
+ isGenericMappedType(objectType)) {
+ if (accessNode) {
+ if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
+ error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
+ return unknownType;
+ }
+ }
+ if (isGenericMappedType(objectType)) {
+ return getIndexedAccessForMappedType(objectType, indexType, accessNode);
}
- return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ var id = objectType.id + "," + indexType.id;
+ return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
}
- var apparentType = getApparentType(objectType);
+ var apparentObjectType = getApparentType(objectType);
if (indexType.flags & 65536 && !(indexType.flags & 8190)) {
var propTypes = [];
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false);
+ var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false);
if (propType === unknownType) {
return unknownType;
}
@@ -25638,7 +25851,7 @@ var ts;
}
return getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true);
+ return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -25655,6 +25868,7 @@ var ts;
type.aliasSymbol = getAliasSymbolForTypeNode(node);
type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
links.resolvedType = type;
+ getConstraintTypeFromMappedType(type);
}
return links.resolvedType;
}
@@ -25823,18 +26037,18 @@ var ts;
return nullType;
case 129:
return neverType;
- case 288:
- return nullType;
case 289:
- return undefinedType;
+ return nullType;
case 290:
+ return undefinedType;
+ case 291:
return neverType;
case 167:
case 98:
return getTypeFromThisTypeNode(node);
case 171:
return getTypeFromLiteralTypeNode(node);
- case 287:
+ case 288:
return getTypeFromLiteralTypeNode(node.literal);
case 157:
case 272:
@@ -25867,7 +26081,7 @@ var ts;
case 158:
case 159:
case 161:
- case 286:
+ case 287:
case 274:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 168:
@@ -26028,6 +26242,28 @@ var ts;
return result;
}
function instantiateMappedType(type, mapper) {
+ var constraintType = getConstraintTypeFromMappedType(type);
+ if (constraintType.flags & 262144) {
+ var typeParameter_1 = constraintType.type;
+ var mappedTypeParameter = mapper(typeParameter_1);
+ if (typeParameter_1 !== mappedTypeParameter) {
+ return mapType(mappedTypeParameter, function (t) {
+ if (isMappableType(t)) {
+ var replacementMapper = createUnaryTypeMapper(typeParameter_1, t);
+ var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);
+ combinedMapper.mappedTypes = mapper.mappedTypes;
+ return instantiateMappedObjectType(type, combinedMapper);
+ }
+ return t;
+ });
+ }
+ }
+ return instantiateMappedObjectType(type, mapper);
+ }
+ function isMappableType(type) {
+ return type.flags & (16384 | 32768 | 131072 | 524288);
+ }
+ function instantiateMappedObjectType(type, mapper) {
var result = createObjectType(32 | 64, type.symbol);
result.declaration = type.declaration;
result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
@@ -26386,7 +26622,7 @@ var ts;
return false;
if (target.flags & 1 || source.flags & 8192)
return true;
- if (source.flags & 34 && target.flags & 2)
+ if (source.flags & 262178 && target.flags & 2)
return true;
if (source.flags & 340 && target.flags & 4)
return true;
@@ -26510,11 +26746,6 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1;
- if (source.flags & 262144) {
- if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) {
- return -1;
- }
- }
if (getObjectFlags(source) & 128 && source.flags & 1048576) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
@@ -26554,10 +26785,21 @@ var ts;
}
}
if (target.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(target);
- if (constraint && constraint.flags & 262144) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
- return result;
+ if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
+ if (!source.declaration.questionToken) {
+ var templateType = getTemplateTypeFromMappedType(source);
+ var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
+ if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
}
}
}
@@ -26574,16 +26816,32 @@ var ts;
}
}
}
+ else if (target.flags & 524288) {
+ if (source.flags & 524288 && source.indexType === target.indexType) {
+ if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(source);
- if (!constraint || constraint.flags & 1) {
- constraint = emptyObjectType;
- }
- constraint = getTypeWithThisArgument(constraint, source);
- var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
- errorInfo = saveErrorInfo;
- return result;
+ if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
+ var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
+ var templateType = getTemplateTypeFromMappedType(target);
+ if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
+ return result;
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(source);
+ if (!constraint || constraint.flags & 1) {
+ constraint = emptyObjectType;
+ }
+ constraint = getTypeWithThisArgument(constraint, source);
+ var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
+ if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
+ }
}
}
else {
@@ -26592,22 +26850,12 @@ var ts;
return result;
}
}
- if (isGenericMappedType(target)) {
- if (isGenericMappedType(source)) {
- if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) &&
- (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) {
- return result;
- }
- }
- }
- else {
- var apparentSource = getApparentType(source);
- if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
- var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
- if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
- errorInfo = saveErrorInfo;
- return result;
- }
+ var apparentSource = getApparentType(source);
+ if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
+ var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
+ if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
}
}
}
@@ -26814,6 +27062,9 @@ var ts;
if (expandingFlags === 3) {
result = 1;
}
+ else if (isGenericMappedType(source) || isGenericMappedType(target)) {
+ result = mappedTypeRelatedTo(source, target, reportErrors);
+ }
else {
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
@@ -26841,6 +27092,33 @@ var ts;
}
return result;
}
+ function mappedTypeRelatedTo(source, target, reportErrors) {
+ if (isGenericMappedType(target)) {
+ if (isGenericMappedType(source)) {
+ var result_2;
+ if (relation === identityRelation) {
+ var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;
+ var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;
+ if (readonlyMatches && optionalMatches) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ else {
+ if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ }
+ }
+ else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {
+ return -1;
+ }
+ return 0;
+ }
function propertiesRelatedTo(source, target, reportErrors) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target);
@@ -27316,7 +27594,7 @@ var ts;
return type;
}
var types = [type];
- if (flags & 34)
+ if (flags & 262178)
types.push(emptyStringType);
if (flags & 340)
types.push(zeroType);
@@ -27651,19 +27929,6 @@ var ts;
}
}
else {
- if (getObjectFlags(target) & 32) {
- var constraintType = getConstraintTypeFromMappedType(target);
- if (getObjectFlags(source) & 32) {
- inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
- return;
- }
- if (constraintType.flags & 16384) {
- inferFromTypes(getIndexType(source), constraintType);
- inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
- return;
- }
- }
source = getApparentType(source);
if (source.flags & 32768) {
if (isInProcess(source, target)) {
@@ -27684,14 +27949,30 @@ var ts;
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
- inferFromProperties(source, target);
- inferFromSignatures(source, target, 0);
- inferFromSignatures(source, target, 1);
- inferFromIndexTypes(source, target);
+ inferFromObjectTypes(source, target);
depth--;
}
}
}
+ function inferFromObjectTypes(source, target) {
+ if (getObjectFlags(target) & 32) {
+ var constraintType = getConstraintTypeFromMappedType(target);
+ if (getObjectFlags(source) & 32) {
+ inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ if (constraintType.flags & 16384) {
+ inferFromTypes(getIndexType(source), constraintType);
+ inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ }
+ inferFromProperties(source, target);
+ inferFromSignatures(source, target, 0);
+ inferFromSignatures(source, target, 1);
+ inferFromIndexTypes(source, target);
+ }
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
@@ -28026,7 +28307,7 @@ var ts;
}
function getTypeWithDefault(type, defaultExpression) {
if (defaultExpression) {
- var defaultType = checkExpression(defaultExpression);
+ var defaultType = getTypeOfExpression(defaultExpression);
return getUnionType([getTypeWithFacts(type, 131072), defaultType]);
}
return type;
@@ -28049,7 +28330,7 @@ var ts;
function getAssignedTypeOfBinaryExpression(node) {
return node.parent.kind === 175 || node.parent.kind === 257 ?
getTypeWithDefault(getAssignedType(node), node.right) :
- checkExpression(node.right);
+ getTypeOfExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
@@ -28097,7 +28378,7 @@ var ts;
}
function getTypeOfInitializer(node) {
var links = getNodeLinks(node);
- return links.resolvedType || checkExpression(node);
+ return links.resolvedType || getTypeOfExpression(node);
}
function getInitialTypeOfVariableDeclaration(node) {
if (node.initializer) {
@@ -28150,7 +28431,7 @@ var ts;
}
function getTypeOfSwitchClause(clause) {
if (clause.kind === 253) {
- var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
+ var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@@ -28230,7 +28511,7 @@ var ts;
return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
}
function addEvolvingArrayElementType(evolvingArrayType, node) {
- var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
}
function createFinalArrayType(elementType) {
@@ -28278,7 +28559,7 @@ var ts;
parent.parent.operatorToken.kind === 57 &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
- isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048);
+ isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048);
return isLengthPushOrUnshift || isElementAssignment;
}
function maybeTypePredicateCall(node) {
@@ -28416,7 +28697,7 @@ var ts;
}
}
else {
- var indexType = checkExpression(node.left.argumentExpression);
+ var indexType = getTypeOfExpression(node.left.argumentExpression);
if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
}
@@ -28597,7 +28878,7 @@ var ts;
if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
- var valueType = checkExpression(value);
+ var valueType = getTypeOfExpression(value);
if (valueType.flags & 6144) {
if (!strictNullChecks) {
return type;
@@ -28669,7 +28950,7 @@ var ts;
}
return type;
}
- var rightType = checkExpression(expr.right);
+ var rightType = getTypeOfExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
@@ -28697,16 +28978,16 @@ var ts;
}
}
if (targetType) {
- return getNarrowedType(type, targetType, assumeTrue);
+ return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);
}
return type;
}
- function getNarrowedType(type, candidate, assumeTrue) {
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
if (!assumeTrue) {
- return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); });
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
}
if (type.flags & 65536) {
- var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); });
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
if (!(assignableType.flags & 8192)) {
return assignableType;
}
@@ -28733,7 +29014,7 @@ var ts;
var predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, predicateArgument)) {
return declaredType;
@@ -28746,7 +29027,7 @@ var ts;
var accessExpression = invokedExpression;
var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, possibleReference)) {
return declaredType;
@@ -28782,7 +29063,7 @@ var ts;
location = location.parent;
}
if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {
- var type = checkExpression(location);
+ var type = getTypeOfExpression(location);
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
return type;
}
@@ -29117,9 +29398,9 @@ var ts;
return anyType;
}
function getTypeForThisExpressionFromJSDoc(node) {
- var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) {
- var jsDocFunctionType = typeTag.typeExpression.type;
+ var jsdocType = ts.getJSDocType(node);
+ if (jsdocType && jsdocType.kind === 274) {
+ var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
@@ -29304,11 +29585,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_22 = declaration.propertyName || declaration.name;
+ var name_21 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_22)) {
- var text = ts.getTextOfPropertyName(name_22);
+ !ts.isBindingPattern(name_21)) {
+ var text = ts.getTextOfPropertyName(name_21);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -29387,13 +29668,13 @@ var ts;
return undefined;
}
if (node === binaryExpression.right) {
- return checkExpression(binaryExpression.left);
+ return getTypeOfExpression(binaryExpression.left);
}
}
else if (operator === 53) {
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
- type = checkExpression(binaryExpression.left);
+ type = getTypeOfExpression(binaryExpression.left);
}
return type;
}
@@ -29699,7 +29980,7 @@ var ts;
var links = getNodeLinks(node.expression);
if (!links.resolvedType) {
links.resolvedType = checkExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) {
error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
@@ -29708,10 +29989,10 @@ var ts;
}
return links.resolvedType;
}
- function getObjectLiteralIndexInfo(node, properties, kind) {
+ function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {
var propTypes = [];
for (var i = 0; i < properties.length; i++) {
- if (kind === 0 || isNumericName(node.properties[i].name)) {
+ if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) {
propTypes.push(getTypeOfSymbol(properties[i]));
}
}
@@ -29732,8 +30013,9 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var memberDecl = _a[_i];
+ var offset = 0;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
var member = memberDecl.symbol;
if (memberDecl.kind === 257 ||
memberDecl.kind === 258 ||
@@ -29794,6 +30076,7 @@ var ts;
return unknownType;
}
spread = getSpreadType(spread, type, false);
+ offset = i + 1;
continue;
}
else {
@@ -29814,8 +30097,8 @@ var ts;
propertiesArray.push(member);
}
if (contextualTypeHasPattern) {
- for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) {
- var prop = _c[_b];
+ for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {
+ var prop = _a[_i];
if (!propertiesTable[prop.name]) {
if (!(prop.flags & 536870912)) {
error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
@@ -29835,8 +30118,8 @@ var ts;
}
return createObjectLiteralType();
function createObjectLiteralType() {
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined;
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined;
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;
result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);
@@ -30378,7 +30661,7 @@ var ts;
if (node.kind === 212 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
- hasNumericPropertyNames(checkExpression(node.expression))) {
+ hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
return true;
}
child = node;
@@ -30471,19 +30754,19 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_9 = signature.declaration && signature.declaration.parent;
+ var parent_8 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_9 === lastParent) {
+ if (lastParent && parent_8 === lastParent) {
index++;
}
else {
- lastParent = parent_9;
+ lastParent = parent_8;
index = cutoffIndex;
}
}
else {
index = cutoffIndex = result.length;
- lastParent = parent_9;
+ lastParent = parent_8;
}
lastSymbol = symbol;
if (signature.hasLiteralTypes) {
@@ -31451,7 +31734,7 @@ var ts;
if (!node.possiblyExhaustive) {
return false;
}
- var type = checkExpression(node.expression);
+ var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
return false;
}
@@ -31787,10 +32070,10 @@ var ts;
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) {
+ if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) {
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -31799,20 +32082,20 @@ var ts;
var properties = node.properties;
for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {
if (property.kind === 257 || property.kind === 258) {
- var name_23 = property.name;
- if (name_23.kind === 142) {
- checkComputedPropertyName(name_23);
+ var name_22 = property.name;
+ if (name_22.kind === 142) {
+ checkComputedPropertyName(name_22);
}
- if (isComputedNonLiteralName(name_23)) {
+ if (isComputedNonLiteralName(name_22)) {
return undefined;
}
- var text = ts.getTextOfPropertyName(name_23);
+ var text = ts.getTextOfPropertyName(name_22);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -31827,13 +32110,18 @@ var ts;
}
}
else {
- error(name_23, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_23));
+ error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22));
}
}
else if (property.kind === 259) {
- if (property.expression.kind !== 70) {
- error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier);
+ var nonRestNames = [];
+ if (allProperties) {
+ for (var i = 0; i < allProperties.length - 1; i++) {
+ nonRestNames.push(allProperties[i].name);
+ }
}
+ var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
+ return checkDestructuringAssignment(property.expression, type);
}
else {
error(property, ts.Diagnostics.Property_assignment_expected);
@@ -31918,7 +32206,10 @@ var ts;
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ var error = target.parent.kind === 259 ?
+ ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
+ ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
+ if (checkReferenceExpression(target, error)) {
checkTypeAssignableTo(sourceType, targetType, target, undefined);
}
return sourceType;
@@ -32055,7 +32346,7 @@ var ts;
resultType = numberType;
}
else {
- if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) {
+ if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) {
resultType = stringType;
}
else if (isTypeAny(leftType) || isTypeAny(rightType)) {
@@ -32078,6 +32369,8 @@ var ts;
case 29:
case 30:
if (checkForDisallowedESSymbolOperand(operator)) {
+ leftType = getBaseTypeOfLiteralType(leftType);
+ rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -32251,7 +32544,7 @@ var ts;
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
return ts.getCombinedNodeFlags(declaration) & 2 ||
- ts.getCombinedModifierFlags(declaration) & 64 ||
+ ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) ||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
}
function isLiteralContextualType(contextualType) {
@@ -32263,7 +32556,7 @@ var ts;
}
contextualType = apparentType;
}
- return maybeTypeOfKind(contextualType, 480);
+ return maybeTypeOfKind(contextualType, (480 | 262144));
}
return false;
}
@@ -32300,6 +32593,16 @@ var ts;
}
return type;
}
+ function getTypeOfExpression(node) {
+ if (node.kind === 179 && node.expression.kind !== 96) {
+ var funcType = checkNonNullExpression(node.expression);
+ var signature = getSingleCallSignature(funcType);
+ if (signature && !signature.typeParameters) {
+ return getReturnTypeOfSignature(signature);
+ }
+ }
+ return checkExpression(node);
+ }
function checkExpression(node, contextualMapper) {
var type;
if (node.kind === 141) {
@@ -32480,9 +32783,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_24 = _a[_i].name;
- if (ts.isBindingPattern(name_24) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, parameterName, typePredicate.parameterName)) {
+ var name_23 = _a[_i].name;
+ if (ts.isBindingPattern(name_23) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -32502,9 +32805,9 @@ var ts;
case 158:
case 149:
case 148:
- var parent_10 = node.parent;
- if (node === parent_10.type) {
- return parent_10;
+ var parent_9 = node.parent;
+ if (node === parent_9.type) {
+ return parent_9;
}
}
}
@@ -32514,15 +32817,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_25 = element.name;
- if (name_25.kind === 70 &&
- name_25.text === predicateVariableName) {
+ var name_24 = element.name;
+ if (name_24.kind === 70 &&
+ name_24.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_25.kind === 173 ||
- name_25.kind === 172) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_25, predicateVariableNode, predicateVariableName)) {
+ else if (name_24.kind === 173 ||
+ name_24.kind === 172) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -32753,8 +33056,8 @@ var ts;
if (superCallShouldBeFirst) {
var statements = node.body.statements;
var superCallStatement = void 0;
- for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
- var statement = statements_2[_i];
+ for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
+ var statement = statements_3[_i];
if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
@@ -32897,7 +33200,7 @@ var ts;
var type = getTypeFromMappedTypeNode(node);
var constraintType = getConstraintTypeFromMappedType(type);
var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
- checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint);
+ checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
}
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node);
@@ -33141,10 +33444,10 @@ var ts;
case 229:
return 2097152 | 1048576;
case 234:
- var result_2 = 0;
+ var result_3 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
- return result_2;
+ ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });
+ return result_3;
default:
return 1048576;
}
@@ -33683,8 +33986,8 @@ var ts;
container.kind === 230 ||
container.kind === 261);
if (!namesShareScope) {
- var name_26 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_26, name_26);
+ var name_25 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25);
}
}
}
@@ -33755,13 +34058,13 @@ var ts;
if (node.propertyName && node.propertyName.kind === 142) {
checkComputedPropertyName(node.propertyName);
}
- var parent_11 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_11);
- var name_27 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_27));
+ var parent_10 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_10);
+ var name_26 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26));
markPropertyAsReferenced(property);
- if (parent_11.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property);
+ if (parent_10.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);
}
}
if (ts.isBindingPattern(node.name)) {
@@ -33922,6 +34225,7 @@ var ts;
}
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
+ var rightType = checkNonNullExpression(node.expression);
if (node.initializer.kind === 224) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
@@ -33935,15 +34239,14 @@ var ts;
if (varExpr.kind === 175 || varExpr.kind === 176) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
- else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) {
+ else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
- var rightType = checkNonNullExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
checkSourceElement(node.statement);
@@ -34068,12 +34371,12 @@ var ts;
var arrayType = arrayOrStringType;
if (arrayOrStringType.flags & 65536) {
var arrayTypes = arrayOrStringType.types;
- var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); });
+ var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); });
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, true);
}
}
- else if (arrayOrStringType.flags & 34) {
+ else if (arrayOrStringType.flags & 262178) {
arrayType = neverType;
}
var hasStringConstituent = arrayOrStringType !== arrayType;
@@ -34098,7 +34401,7 @@ var ts;
}
var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType;
if (hasStringConstituent) {
- if (arrayElementType.flags & 34) {
+ if (arrayElementType.flags & 262178) {
return stringType;
}
return getUnionType([arrayElementType, stringType], true);
@@ -34782,7 +35085,7 @@ var ts;
return undefined;
}
}
- enumType_1 = checkExpression(expression);
+ enumType_1 = getTypeOfExpression(expression);
if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) {
return undefined;
}
@@ -34977,9 +35280,9 @@ var ts;
break;
case 174:
case 223:
- var name_28 = node.name;
- if (ts.isBindingPattern(name_28)) {
- for (var _b = 0, _c = name_28.elements; _b < _c.length; _b++) {
+ var name_27 = node.name;
+ if (ts.isBindingPattern(name_27)) {
+ for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) {
var el = _c[_b];
checkModuleAugmentationElement(el, isGlobalAugmentation);
}
@@ -35717,7 +36020,7 @@ var ts;
}
}
case 96:
- var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
+ var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case 167:
return getTypeFromTypeNode(node).symbol;
@@ -35739,7 +36042,7 @@ var ts;
}
case 8:
if (node.parent.kind === 178 && node.parent.argumentExpression === node) {
- var objectType = checkExpression(node.parent.expression);
+ var objectType = getTypeOfExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
var apparentType = getApparentType(objectType);
@@ -35770,7 +36073,7 @@ var ts;
return getTypeFromTypeNode(node);
}
if (ts.isPartOfExpression(node)) {
- return getTypeOfExpression(node);
+ return getRegularTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
@@ -35808,7 +36111,7 @@ var ts;
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 192) {
- var iteratedType = checkExpression(expr.parent.right);
+ var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 257) {
@@ -35824,11 +36127,11 @@ var ts;
var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);
}
- function getTypeOfExpression(expr) {
+ function getRegularTypeOfExpression(expr) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
- return getRegularTypeOfLiteralType(checkExpression(expr));
+ return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
function getParentTypeOfClassElement(node) {
var classSymbol = getSymbolOfNode(node.parent);
@@ -35851,9 +36154,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456) {
var symbols_3 = [];
- var name_29 = symbol.name;
+ var name_28 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_29);
+ var symbol = getPropertyOfType(t, name_28);
if (symbol) {
symbols_3.push(symbol);
}
@@ -35906,7 +36209,7 @@ var ts;
}
function isNameOfModuleOrEnumDeclaration(node) {
var parent = node.parent;
- return ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
+ return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
}
function getReferencedExportContainer(node, prefixLocals) {
node = ts.getParseTreeNode(node, ts.isIdentifier);
@@ -36114,7 +36417,7 @@ var ts;
else if (isTypeOfKind(type, 340)) {
return ts.TypeReferenceSerializationKind.NumberLikeType;
}
- else if (isTypeOfKind(type, 34)) {
+ else if (isTypeOfKind(type, 262178)) {
return ts.TypeReferenceSerializationKind.StringLikeType;
}
else if (isTupleType(type)) {
@@ -36145,7 +36448,7 @@ var ts;
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
}
function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {
- var type = getWidenedType(getTypeOfExpression(expr));
+ var type = getWidenedType(getRegularTypeOfExpression(expr));
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
}
function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {
@@ -36164,9 +36467,9 @@ var ts;
}
var location = reference;
if (startInDeclarationContainer) {
- var parent_12 = reference.parent;
- if (ts.isDeclaration(parent_12) && reference === parent_12.name) {
- location = getDeclarationContainer(parent_12);
+ var parent_11 = reference.parent;
+ if (ts.isDeclaration(parent_11) && reference === parent_11.name) {
+ location = getDeclarationContainer(parent_11);
}
}
return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined);
@@ -36279,9 +36582,9 @@ var ts;
}
var current = symbol;
while (true) {
- var parent_13 = getParentOfSymbol(current);
- if (parent_13) {
- current = parent_13;
+ var parent_12 = getParentOfSymbol(current);
+ if (parent_12) {
+ current = parent_12;
}
else {
break;
@@ -36958,9 +37261,9 @@ var ts;
if (prop.kind === 259) {
continue;
}
- var name_30 = prop.name;
- if (name_30.kind === 142) {
- checkGrammarComputedPropertyName(name_30);
+ var name_29 = prop.name;
+ if (name_29.kind === 142) {
+ checkGrammarComputedPropertyName(name_29);
}
if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) {
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -36976,8 +37279,8 @@ var ts;
var currentKind = void 0;
if (prop.kind === 257 || prop.kind === 258) {
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_30.kind === 8) {
- checkGrammarNumericLiteral(name_30);
+ if (name_29.kind === 8) {
+ checkGrammarNumericLiteral(name_29);
}
currentKind = Property;
}
@@ -36993,7 +37296,7 @@ var ts;
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_30);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29);
if (effectiveName === undefined) {
continue;
}
@@ -37003,18 +37306,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_30, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_30));
+ grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -37027,12 +37330,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_31 = jsxAttr.name;
- if (!seen[name_31.text]) {
- seen[name_31.text] = true;
+ var name_30 = jsxAttr.name;
+ if (!seen[name_30.text]) {
+ seen[name_30.text] = true;
}
else {
- return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 252 && !initializer.expression) {
@@ -37480,10 +37783,15 @@ var ts;
function reduceNode(node, f, initial) {
return node ? f(initial, node) : initial;
}
- function reduceEachChild(node, f, initial) {
+ function reduceNodeArray(nodes, f, initial) {
+ return nodes ? f(initial, nodes) : initial;
+ }
+ function reduceEachChild(node, initial, cbNode, cbNodeArray) {
if (node === undefined) {
return initial;
}
+ var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
+ var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
if ((kind > 0 && kind <= 140)) {
return initial;
@@ -37497,108 +37805,108 @@ var ts;
case 206:
case 198:
case 222:
- case 292:
+ case 293:
break;
case 142:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 144:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 145:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 147:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 149:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 150:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 151:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 152:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 172:
case 173:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 174:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 175:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 176:
- result = ts.reduceLeft(node.properties, f, result);
+ result = reduceNodes(node.properties, cbNodes, result);
break;
case 177:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 178:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.argumentExpression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.argumentExpression, cbNode, result);
break;
case 179:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 180:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 181:
- result = reduceNode(node.tag, f, result);
- result = reduceNode(node.template, f, result);
+ result = reduceNode(node.tag, cbNode, result);
+ result = reduceNode(node.template, cbNode, result);
break;
case 184:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 185:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 183:
case 186:
@@ -37608,205 +37916,205 @@ var ts;
case 195:
case 196:
case 201:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 190:
case 191:
- result = reduceNode(node.operand, f, result);
+ result = reduceNode(node.operand, cbNode, result);
break;
case 192:
- result = reduceNode(node.left, f, result);
- result = reduceNode(node.right, f, result);
+ result = reduceNode(node.left, cbNode, result);
+ result = reduceNode(node.right, cbNode, result);
break;
case 193:
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.whenTrue, f, result);
- result = reduceNode(node.whenFalse, f, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.whenTrue, cbNode, result);
+ result = reduceNode(node.whenFalse, cbNode, result);
break;
case 194:
- result = reduceNode(node.head, f, result);
- result = ts.reduceLeft(node.templateSpans, f, result);
+ result = reduceNode(node.head, cbNode, result);
+ result = reduceNodes(node.templateSpans, cbNodes, result);
break;
case 197:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 199:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
break;
case 202:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.literal, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.literal, cbNode, result);
break;
case 204:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 205:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.declarationList, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.declarationList, cbNode, result);
break;
case 207:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 208:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.thenStatement, f, result);
- result = reduceNode(node.elseStatement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.thenStatement, cbNode, result);
+ result = reduceNode(node.elseStatement, cbNode, result);
break;
case 209:
- result = reduceNode(node.statement, f, result);
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.statement, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 210:
case 217:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 211:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.incrementor, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.incrementor, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 212:
case 213:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 216:
case 220:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 218:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.caseBlock, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.caseBlock, cbNode, result);
break;
case 219:
- result = reduceNode(node.label, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.label, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 221:
- result = reduceNode(node.tryBlock, f, result);
- result = reduceNode(node.catchClause, f, result);
- result = reduceNode(node.finallyBlock, f, result);
+ result = reduceNode(node.tryBlock, cbNode, result);
+ result = reduceNode(node.catchClause, cbNode, result);
+ result = reduceNode(node.finallyBlock, cbNode, result);
break;
case 223:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 224:
- result = ts.reduceLeft(node.declarations, f, result);
+ result = reduceNodes(node.declarations, cbNodes, result);
break;
case 225:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 226:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 232:
- result = ts.reduceLeft(node.clauses, f, result);
+ result = reduceNodes(node.clauses, cbNodes, result);
break;
case 235:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.importClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.importClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 236:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 237:
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 238:
case 242:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 239:
case 243:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 240:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.expression, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 241:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.exportClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.exportClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 246:
- result = reduceNode(node.openingElement, f, result);
- result = ts.reduceLeft(node.children, f, result);
- result = reduceNode(node.closingElement, f, result);
+ result = reduceNode(node.openingElement, cbNode, result);
+ result = ts.reduceLeft(node.children, cbNode, result);
+ result = reduceNode(node.closingElement, cbNode, result);
break;
case 247:
case 248:
- result = reduceNode(node.tagName, f, result);
- result = ts.reduceLeft(node.attributes, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
+ result = reduceNodes(node.attributes, cbNodes, result);
break;
case 249:
- result = reduceNode(node.tagName, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
break;
case 250:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 251:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 252:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 253:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
case 254:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 255:
- result = ts.reduceLeft(node.types, f, result);
+ result = reduceNodes(node.types, cbNodes, result);
break;
case 256:
- result = reduceNode(node.variableDeclaration, f, result);
- result = reduceNode(node.block, f, result);
+ result = reduceNode(node.variableDeclaration, cbNode, result);
+ result = reduceNode(node.block, cbNode, result);
break;
case 257:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 258:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.objectAssignmentInitializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
case 259:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 261:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
- case 293:
- result = reduceNode(node.expression, f, result);
+ case 294:
+ result = reduceNode(node.expression, cbNode, result);
break;
default:
var edgeTraversalPath = nodeEdgeTraversalMap[kind];
@@ -37816,8 +38124,8 @@ var ts;
var value = node[edge.name];
if (value !== undefined) {
result = ts.isArray(value)
- ? ts.reduceLeft(value, f, result)
- : f(result, value);
+ ? reduceNodes(value, cbNodes, result)
+ : cbNode(result, value);
}
}
}
@@ -37827,8 +38135,8 @@ var ts;
}
ts.reduceEachChild = reduceEachChild;
function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {
- if (node === undefined) {
- return undefined;
+ if (node === undefined || visitor === undefined) {
+ return node;
}
aggregateTransformFlags(node);
var visited = visitor(node);
@@ -37905,6 +38213,35 @@ var ts;
return updated || nodes;
}
ts.visitNodes = visitNodes;
+ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
+ context.startLexicalEnvironment();
+ statements = visitNodes(statements, visitor, ts.isStatement, start);
+ if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
+ statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements);
+ }
+ var declarations = context.endLexicalEnvironment();
+ return ts.createNodeArray(ts.concatenate(statements, declarations), statements);
+ }
+ ts.visitLexicalEnvironment = visitLexicalEnvironment;
+ function visitParameterList(nodes, visitor, context) {
+ context.startLexicalEnvironment();
+ var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);
+ context.suspendLexicalEnvironment();
+ return updated;
+ }
+ ts.visitParameterList = visitParameterList;
+ function visitFunctionBody(node, visitor, context) {
+ context.resumeLexicalEnvironment();
+ var updated = visitNode(node, visitor, ts.isConciseBody);
+ var declarations = context.endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(updated);
+ var statements = mergeLexicalEnvironment(block.statements, declarations);
+ return ts.updateBlock(block, statements);
+ }
+ return updated;
+ }
+ ts.visitFunctionBody = visitFunctionBody;
function visitEachChild(node, visitor, context) {
if (node === undefined) {
return undefined;
@@ -37925,23 +38262,23 @@ var ts;
case 142:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
case 144:
- return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 147:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 149:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 150:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 151:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 152:
- return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 172:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 173:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 174:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
case 175:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
case 176:
@@ -37959,9 +38296,9 @@ var ts;
case 183:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 184:
- return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 185:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 186:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 187:
@@ -38029,7 +38366,7 @@ var ts;
case 224:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 225:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 226:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
case 232:
@@ -38081,9 +38418,8 @@ var ts;
case 259:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
case 261:
- context.startLexicalEnvironment();
- return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
- case 293:
+ return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
+ case 294:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -38111,6 +38447,15 @@ var ts;
}
}
ts.visitEachChild = visitEachChild;
+ function mergeLexicalEnvironment(statements, declarations) {
+ if (!ts.some(declarations)) {
+ return statements;
+ }
+ return ts.isNodeArray(statements)
+ ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)
+ : ts.addRange(statements, declarations);
+ }
+ ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function mergeFunctionBodyLexicalEnvironment(body, declarations) {
if (body && declarations !== undefined && declarations.length > 0) {
if (ts.isBlock(body)) {
@@ -38141,22 +38486,37 @@ var ts;
if (node === undefined) {
return 0;
}
- else if (node.transformFlags & 536870912) {
+ if (node.transformFlags & 536870912) {
return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);
}
- else {
- var subtreeFlags = aggregateTransformFlagsForSubtree(node);
- return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ var subtreeFlags = aggregateTransformFlagsForSubtree(node);
+ return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ }
+ function aggregateTransformFlagsForNodeArray(nodes) {
+ if (nodes === undefined) {
+ return 0;
}
+ var subtreeFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
+ var node = nodes_3[_i];
+ subtreeFlags |= aggregateTransformFlagsForNode(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ return subtreeFlags;
}
function aggregateTransformFlagsForSubtree(node) {
if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) {
return 0;
}
- return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0);
+ return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
+ }
+ function aggregateTransformFlagsForChildNode(transformFlags, node) {
+ return transformFlags | aggregateTransformFlagsForNode(node);
}
- function aggregateTransformFlagsForChildNode(transformFlags, child) {
- return transformFlags | aggregateTransformFlagsForNode(child);
+ function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
+ return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
var Debug;
(function (Debug) {
@@ -38166,9 +38526,21 @@ var ts;
Debug.failBadSyntaxKind = Debug.shouldAssert(1)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
: ts.noop;
+ Debug.assertEachNode = Debug.shouldAssert(1)
+ ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
Debug.assertNode = Debug.shouldAssert(1)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
: ts.noop;
+ Debug.assertOptionalNode = Debug.shouldAssert(1)
+ ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
+ Debug.assertOptionalToken = Debug.shouldAssert(1)
+ ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); }
+ : ts.noop;
+ Debug.assertMissingNode = Debug.shouldAssert(1)
+ ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); }
+ : ts.noop;
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -38187,440 +38559,316 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
- if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
- var right = node.right;
- if (ts.isDestructuringAssignment(right)) {
- return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor);
- }
- else {
- return node.right;
- }
- }
+ function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
var location = node;
- var value = node.right;
- var expressions = [];
- if (needsValue) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor);
+ var value;
+ if (ts.isDestructuringAssignment(node)) {
+ value = node.right;
+ while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
+ if (ts.isDestructuringAssignment(value)) {
+ location = node = value;
+ value = node.right;
+ }
+ else {
+ return value;
+ }
+ }
}
- else if (ts.nodeIsSynthesized(node)) {
- location = value;
+ var expressions;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: true,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,
+ createArrayBindingOrAssignmentElement: makeAssignmentElement,
+ visitor: visitor
+ };
+ if (value) {
+ value = ts.visitNode(value, visitor, ts.isExpression);
+ if (needsValue) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ }
+ else if (ts.nodeIsSynthesized(node)) {
+ location = value;
+ }
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- if (needsValue) {
+ flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));
+ if (value && needsValue) {
+ if (!ts.some(expressions)) {
+ return value;
+ }
expressions.push(value);
}
- var expression = ts.inlineExpressions(expressions);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location) {
- var expression = ts.createAssignment(name, value, location);
- ts.setEmitFlags(expression, 2048);
+ return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();
+ function emitExpression(expression) {
+ ts.setEmitFlags(expression, 64);
ts.aggregateTransformFlags(expression);
- expressions.push(expression);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitAssignment(name, value, location);
- return name;
+ expressions = ts.append(expressions, expression);
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectLiteral(elements), value, location);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(target, value, location)
+ : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);
+ expression.original = original;
+ emitExpression(expression);
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
- function flattenParameterDestructuring(node, value, visitor, transformRest) {
+ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
+ var pendingExpressions;
+ var pendingDeclarations = [];
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location) {
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- ts.setEmitFlags(declaration, 2048);
- ts.aggregateTransformFlags(declaration);
- declarations.push(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(undefined);
- emitAssignment(name, value, location);
- return name;
- }
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location);
- }
- }
- ts.flattenParameterDestructuring = flattenParameterDestructuring;
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
- var declarations = [];
- var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location, original) {
- if (pendingAssignments) {
- pendingAssignments.push(value);
- value = ts.inlineExpressions(pendingAssignments);
- pendingAssignments = undefined;
- }
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- declaration.original = original;
- ts.setEmitFlags(declaration, 2048);
- declarations.push(declaration);
- ts.aggregateTransformFlags(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- if (recordTempVariable) {
- var assignment = ts.createAssignment(name, value, location);
- if (pendingAssignments) {
- pendingAssignments.push(assignment);
- }
- else {
- pendingAssignments = [assignment];
- }
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: hoistTempVariables,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,
+ createArrayBindingOrAssignmentElement: makeBindingElement,
+ visitor: visitor
+ };
+ flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
+ if (pendingExpressions) {
+ var temp = ts.createTempVariable(undefined);
+ if (hoistTempVariables) {
+ var value = ts.inlineExpressions(pendingExpressions);
+ pendingExpressions = undefined;
+ emitBindingOrAssignment(temp, value, undefined, undefined);
}
else {
- emitAssignment(name, value, location, undefined);
+ context.hoistVariableDeclaration(temp);
+ var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);
+ pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));
+ ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
+ pendingDeclaration.value = temp;
}
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
- }
- }
- ts.flattenVariableDestructuring = flattenVariableDestructuring;
- function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
- var pendingAssignments = [];
- flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor);
- var expression = ts.inlineExpressions(pendingAssignments);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location, original) {
- var expression = createAssignmentCallback
- ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location)
- : ts.createAssignment(name, value, location);
- emitPendingAssignment(expression, original);
}
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(ts.createAssignment(name, value, location), undefined);
- return name;
+ for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
+ var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;
+ var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);
+ variable.original = original;
+ if (ts.isIdentifier(name_31)) {
+ ts.setEmitFlags(variable, 64);
+ }
+ ts.aggregateTransformFlags(variable);
+ declarations.push(variable);
}
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectLiteral(elements), value, location, original);
+ return declarations;
+ function emitExpression(value) {
+ pendingExpressions = ts.append(pendingExpressions, value);
}
- function emitPendingAssignment(expression, original) {
- expression.original = original;
- ts.setEmitFlags(expression, 2048);
- pendingAssignments.push(expression);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, ts.isBindingName);
+ if (pendingExpressions) {
+ value = ts.inlineExpressions(ts.append(pendingExpressions, value));
+ pendingExpressions = undefined;
+ }
+ pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
}
}
- ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
- if (value && visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
- }
- if (ts.isBinaryExpression(root)) {
- emitDestructuringAssignment(root.left, value, location);
- }
- else {
- emitBindingElement(root, value);
- }
- function emitDestructuringAssignment(bindingTarget, value, location) {
- var target;
- if (ts.isShorthandPropertyAssignment(bindingTarget)) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression)
- : bindingTarget.objectAssignmentInitializer;
- if (initializer) {
- value = createDefaultValueCheck(value, initializer, location);
- }
- target = bindingTarget.name;
- }
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
- : bindingTarget.right;
- value = createDefaultValueCheck(value, initializer, location);
- target = bindingTarget.left;
- }
- else {
- target = bindingTarget;
+ ts.flattenDestructuringBinding = flattenDestructuringBinding;
+ function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
+ if (!skipInitializer) {
+ var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
+ if (initializer) {
+ value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;
}
- if (target.kind === 176) {
- emitObjectLiteralAssignment(target, value, location);
- }
- else if (target.kind === 175) {
- emitArrayLiteralAssignment(target, value, location);
- }
- else {
- var name_32 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_32, target);
- ts.setCommentRange(name_32, target);
- emitAssignment(name_32, value, location, undefined);
+ else if (!value) {
+ value = ts.createVoidZero();
}
}
- function emitObjectLiteralAssignment(target, value, location) {
- var properties = target.properties;
- if (properties.length !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var bindingElements = [];
- for (var i = 0; i < properties.length; i++) {
- var p = properties[i];
- if (p.kind === 257 || p.kind === 258) {
- if (!transformRest ||
- p.transformFlags & 8388608 ||
- (p.kind === 257 && p.initializer.transformFlags & 8388608)) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.name;
- var bindingTarget = p.kind === 258 ? p : p.initializer || propName;
- emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
- }
- else {
- bindingElements.push(p);
- }
- }
- else if (i === properties.length - 1 &&
- p.kind === 259 &&
- p.expression.kind === 70) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.expression;
- var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
- emitDestructuringAssignment(propName, restCall, p);
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
+ var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
+ if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
+ flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitArrayLiteralAssignment(target, value, location) {
- if (transformRest) {
- emitESNextArrayLiteralAssignment(target, value, location);
- }
- else {
- emitES2015ArrayLiteralAssignment(target, value, location);
- }
+ else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
+ flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitESNextArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var expressions = [];
- var spreadContainingExpressions = [];
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind === 198) {
- continue;
- }
- if (e.transformFlags & 8388608 && i < numElements - 1) {
- var tmp = ts.createTempVariable(recordTempVariable);
- spreadContainingExpressions.push([e, tmp]);
- expressions.push(tmp);
+ else {
+ flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);
+ }
+ }
+ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var computedTempVariables;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
+ if (flattenContext.level >= 1
+ && !(element.transformFlags & (524288 | 1048576))
+ && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576))
+ && !ts.isComputedPropertyName(propertyName)) {
+ bindingElements = ts.append(bindingElements, element);
}
else {
- expressions.push(e);
- }
- }
- emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
- for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
- var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
- emitDestructuringAssignment(e, tmp, e);
- }
- }
- function emitES2015ArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind !== 198) {
- if (e.kind !== 196) {
- emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- else if (i === numElements - 1) {
- emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e);
+ var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
+ if (ts.isComputedPropertyName(propertyName)) {
+ computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
}
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- }
- function createRestCall(value, elements, getPropertyName, location) {
- var propertyNames = [];
- for (var i = 0; i < elements.length - 1; i++) {
- if (ts.isOmittedExpression(elements[i])) {
- continue;
- }
- var str = ts.createSynthesizedNode(9);
- str.pos = location.pos;
- str.end = location.end;
- str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
- propertyNames.push(str);
- }
- var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
- return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
- }
- function emitBindingElement(target, value) {
- var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (transformRest) {
- value = value || initializer;
- }
- else if (initializer) {
- value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
- }
- else if (!value) {
- value = ts.createVoidZero();
- }
- var name = target.name;
- if (!ts.isBindingPattern(name)) {
- emitAssignment(name, value, target, target);
- }
- else {
- var numElements = name.elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment);
- }
- if (name.kind === 173) {
- emitArrayBindingElement(name, value);
- }
- else {
- emitObjectBindingElement(target, value);
+ else if (i === numElements - 1) {
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
+ var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- function emitArrayBindingElement(name, value) {
- if (transformRest) {
- emitESNextArrayBindingElement(name, value);
- }
- else {
- emitES2015ArrayBindingElement(name, value);
- }
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function emitES2015ArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (!element.dotDotDotToken) {
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
- }
+ }
+ function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
}
- function emitESNextArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- var spreadContainingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (element.transformFlags & 8388608 && i < numElements - 1) {
- spreadContainingElements.push(element);
- bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
+ var bindingElements;
+ var restContainingElements;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (flattenContext.level >= 1) {
+ if (element.transformFlags & 1048576) {
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ }
+ restContainingElements = ts.append(restContainingElements, [temp, element]);
+ bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
}
else {
- bindingElements.push(element);
+ bindingElements = ts.append(bindingElements, element);
}
}
- emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
- for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
- var element = spreadContainingElements_1[_i];
- emitBindingElement(element, ts.getGeneratedNameForNode(element));
+ else if (ts.isOmittedExpression(element)) {
+ continue;
}
- }
- function emitObjectBindingElement(target, value) {
- var name = target.name;
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (i === numElements - 1 && element.dotDotDotToken) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
- emitBindingElement(element, restCall);
- }
- else if (transformRest && !(element.transformFlags & 8388608)) {
- bindingElements.push(element);
- }
- else {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
+ else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var rhsValue = ts.createElementAccess(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
+ else if (i === numElements - 1) {
+ var rhsValue = ts.createArraySlice(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- function createDefaultValueCheck(value, defaultValue, location) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function createDestructuringPropertyAccess(expression, propertyName) {
- if (ts.isComputedPropertyName(propertyName)) {
- return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment));
- }
- else if (ts.isLiteralExpression(propertyName)) {
- var clone_2 = ts.getSynthesizedClone(propertyName);
- clone_2.text = ts.unescapeIdentifier(clone_2.text);
- return ts.createElementAccess(expression, clone_2);
- }
- else {
- if (ts.isGeneratedIdentifier(propertyName)) {
- var clone_3 = ts.getSynthesizedClone(propertyName);
- clone_3.text = ts.unescapeIdentifier(clone_3.text);
- return ts.createPropertyAccess(expression, clone_3);
- }
- else {
- return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)));
- }
+ if (restContainingElements) {
+ for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
+ var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
+ flattenBindingOrAssignmentElement(flattenContext, element, id, element);
}
}
}
- function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) {
+ function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value);
+ }
+ function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else if (ts.isStringOrNumericLiteral(propertyName)) {
+ var argumentExpression = ts.getSynthesizedClone(propertyName);
+ argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else {
+ var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));
+ return ts.createPropertyAccess(value, name_32);
+ }
+ }
+ function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
return value;
}
else {
- if (visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ flattenContext.emitExpression(ts.createAssignment(temp, value, location));
}
- return emitTempVariableAssignment(value, location);
+ else {
+ flattenContext.emitBindingOrAssignment(temp, value, location, undefined);
+ }
+ return temp;
}
}
+ function makeArrayBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
+ return ts.createArrayBindingPattern(elements);
+ }
+ function makeArrayAssignmentPattern(elements) {
+ return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));
+ }
+ function makeObjectBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isBindingElement);
+ return ts.createObjectBindingPattern(elements);
+ }
+ function makeObjectAssignmentPattern(elements) {
+ return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));
+ }
+ function makeBindingElement(name) {
+ return ts.createBindingElement(undefined, undefined, name);
+ }
+ function makeAssignmentElement(name) {
+ return name;
+ }
+ var restHelper = {
+ name: "typescript:rest",
+ scoped: false,
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ };
+ function createRestCall(context, value, elements, computedTempVariables, location) {
+ context.requestEmitHelper(restHelper);
+ var propertyNames = [];
+ var computedTempVariableOffset = 0;
+ for (var i = 0; i < elements.length - 1; i++) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
+ if (propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var temp = computedTempVariables[computedTempVariableOffset];
+ computedTempVariableOffset++;
+ propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral(""))));
+ }
+ else {
+ propertyNames.push(ts.createLiteral(propertyName));
+ }
+ }
+ }
+ return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
var USE_NEW_TYPE_METADATA_FORMAT = false;
function transformTypeScript(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -38636,7 +38884,6 @@ var ts;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentExternalHelpersModuleName;
var enabledSubstitutions;
var classAliases;
var applicableSubstitutions;
@@ -38645,7 +38892,11 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ currentSourceFile = node;
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function saveStateAndInvoke(node, f) {
var savedCurrentScope = currentScope;
@@ -38658,14 +38909,29 @@ var ts;
currentScope = savedCurrentScope;
return visited;
}
+ function onBeforeVisitNode(node) {
+ switch (node.kind) {
+ case 261:
+ case 232:
+ case 231:
+ case 204:
+ currentScope = node;
+ currentScopeFirstDeclarationsOfName = undefined;
+ break;
+ case 226:
+ case 225:
+ if (ts.hasModifier(node, 2)) {
+ break;
+ }
+ recordEmittedDeclarationInScope(node);
+ break;
+ }
+ }
function visitor(node) {
return saveStateAndInvoke(node, visitorWorker);
}
function visitorWorker(node) {
- if (node.kind === 261) {
- return visitSourceFile(node);
- }
- else if (node.transformFlags & 1) {
+ if (node.transformFlags & 1) {
return visitTypeScript(node);
}
else if (node.transformFlags & 2) {
@@ -38833,53 +39099,9 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- switch (node.kind) {
- case 261:
- case 232:
- case 231:
- case 204:
- currentScope = node;
- currentScopeFirstDeclarationsOfName = undefined;
- break;
- case 226:
- case 225:
- if (ts.hasModifier(node, 2)) {
- break;
- }
- recordEmittedDeclarationInScope(node);
- break;
- }
- }
function visitSourceFile(node) {
- currentSourceFile = node;
- if (compilerOptions.alwaysStrict &&
- !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) {
- node = ts.ensureUseStrict(node);
- }
- if (node.flags & 64512
- && compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
- var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText);
- var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- externalHelpersModuleImport.parent = node;
- externalHelpersModuleImport.flags &= ~8;
- statements.push(externalHelpersModuleImport);
- currentExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- currentExternalHelpersModuleName = undefined;
- node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
- node.externalHelpersModuleName = externalHelpersModuleName;
- }
- else {
- node = ts.visitEachChild(node, sourceElementVisitor, context);
- }
- ts.setEmitFlags(node, 1 | ts.getEmitFlags(node));
- return node;
+ var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);
+ return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));
}
function shouldEmitDecorateCallForClass(node) {
if (node.decorators && node.decorators.length > 0) {
@@ -38925,7 +39147,7 @@ var ts;
}
if (statements.length > 1) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432);
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -38933,7 +39155,7 @@ var ts;
var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);
var emitFlags = ts.getEmitFlags(node);
if (hasStaticProperties) {
- emitFlags |= 1024;
+ emitFlags |= 32;
}
ts.setOriginalNode(classDeclaration, node);
ts.setEmitFlags(classDeclaration, emitFlags);
@@ -38964,7 +39186,7 @@ var ts;
enableSubstitutionForClassAliases();
classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);
}
- ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression));
+ ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
@@ -38983,7 +39205,7 @@ var ts;
}
function transformConstructor(node, hasExtendsClause) {
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 4194304;
+ var hasParameterPropertyAssignments = node.transformFlags & 262144;
var constructor = ts.getFirstConstructorWithBody(node);
if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {
return ts.visitEachChild(constructor, visitor, context);
@@ -38993,14 +39215,13 @@ var ts;
return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));
}
function transformConstructorParameters(constructor) {
- return constructor
- ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
- : [];
+ return ts.visitParameterList(constructor && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
if (constructor) {
indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);
var propertyAssignments = getParametersWithPropertyAssignments(constructor);
@@ -39015,7 +39236,7 @@ var ts;
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
}
ts.addRange(statements, endLexicalEnvironment());
- return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true);
+ return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true);
}
function addPrologueDirectivesAndInitialSuperCall(ctor, result) {
if (ctor.body) {
@@ -39044,9 +39265,9 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name));
var name = node.name;
var propertyName = ts.getMutableClone(name);
- ts.setEmitFlags(propertyName, 49152 | 1536);
+ ts.setEmitFlags(propertyName, 1536 | 48);
var localName = ts.getMutableClone(name);
- ts.setEmitFlags(localName, 49152);
+ ts.setEmitFlags(localName, 1536);
return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1)));
}
function getInitializedProperties(node, isStatic) {
@@ -39219,8 +39440,8 @@ var ts;
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
- ts.setEmitFlags(helper, 49152);
+ var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ ts.setEmitFlags(helper, 1536);
return helper;
}
function addConstructorDecorationStatement(statements, node) {
@@ -39237,9 +39458,9 @@ var ts;
}
var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
var localName = ts.getLocalName(node, false, true);
- var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var decorate = createDecorateHelper(context, decoratorExpressions, localName);
var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
- ts.setEmitFlags(expression, 49152);
+ ts.setEmitFlags(expression, 1536);
ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
return expression;
}
@@ -39252,8 +39473,8 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression);
- ts.setEmitFlags(helper, 49152);
+ var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression);
+ ts.setEmitFlags(helper, 1536);
expressions.push(helper);
}
}
@@ -39270,13 +39491,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -39293,7 +39514,7 @@ var ts;
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
}
}
}
@@ -39462,7 +39683,7 @@ var ts;
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
- return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object"));
+ return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object"));
case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
return serializeEntityNameAsExpression(node.typeName, false);
case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
@@ -39518,7 +39739,7 @@ var ts;
return ts.createPropertyAccess(left, node.right);
}
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
var name = member.name;
@@ -39573,11 +39794,12 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function shouldEmitAccessorDeclaration(node) {
return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128));
@@ -39586,86 +39808,46 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitSetAccessor(node) {
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitFunctionDeclaration(node) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return ts.createNotEmittedStatement(node);
}
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
+ var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
if (isNamespaceExport(node)) {
- var statements = [func];
+ var statements = [updated];
addExportMemberAssignment(statements, node);
return statements;
}
- return func;
+ return updated;
}
function visitFunctionExpression(node) {
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformFunctionBodyWorker(node.body);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- currentScope = body;
- currentScopeFirstDeclarationsOfName = ts.createMap();
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- }
- function transformConciseBody(node) {
- return transformConciseBodyWorker(node.body, false);
- }
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
- if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
- }
- else {
- startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
- var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
- }
+ var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitParameter(node) {
if (ts.parameterIsThisKeyword(node)) {
@@ -39675,7 +39857,7 @@ var ts;
ts.setOriginalNode(parameter, node);
ts.setCommentRange(parameter, node);
ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));
- ts.setEmitFlags(parameter.name, 1024);
+ ts.setEmitFlags(parameter.name, 32);
return parameter;
}
function visitVariableStatement(node) {
@@ -39693,7 +39875,7 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);
@@ -39734,10 +39916,10 @@ var ts;
return undefined;
}
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -39829,13 +40011,13 @@ var ts;
ts.setSourceMapRange(statement, node);
}
ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 | 33554432);
+ ts.setEmitFlags(statement, 1024 | 2097152);
statements.push(statement);
return true;
}
else {
var mergeMarker = ts.createMergeDeclarationMarker(statement);
- ts.setEmitFlags(mergeMarker, 49152 | 33554432);
+ ts.setEmitFlags(mergeMarker, 1536 | 2097152);
statements.push(mergeMarker);
return false;
}
@@ -39847,10 +40029,10 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name.");
enableSubstitutionForNamespaceExports();
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -39906,7 +40088,7 @@ var ts;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);
if (body.kind !== 231) {
- ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152);
+ ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);
}
return block;
}
@@ -39981,7 +40163,7 @@ var ts;
return undefined;
}
var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);
- ts.setEmitFlags(moduleReference, 49152 | 65536);
+ ts.setEmitFlags(moduleReference, 1536 | 2048);
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node)
@@ -40134,10 +40316,10 @@ var ts;
if (declaration) {
var classAlias = classAliases[declaration.id];
if (classAlias) {
- var clone_4 = ts.getSynthesizedClone(classAlias);
- ts.setSourceMapRange(clone_4, node);
- ts.setCommentRange(clone_4, node);
- return clone_4;
+ var clone_2 = ts.getSynthesizedClone(classAlias);
+ ts.setSourceMapRange(clone_2, node);
+ ts.setCommentRange(clone_2, node);
+ return clone_2;
}
}
}
@@ -40145,7 +40327,7 @@ var ts;
return undefined;
}
function trySubstituteNamespaceExportedName(node) {
- if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var container = resolver.getReferencedExportContainer(node, false);
if (container && container.kind !== 261) {
var substitute = (applicableSubstitutions & 2 && container.kind === 230) ||
@@ -40190,10 +40372,278 @@ var ts;
}
}
ts.transformTypeScript = transformTypeScript;
+ var paramHelper = {
+ name: "typescript:param",
+ scoped: false,
+ priority: 4,
+ text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
+ };
+ function createParamHelper(context, expression, parameterOffset, location) {
+ context.requestEmitHelper(paramHelper);
+ return ts.createCall(ts.getHelperName("__param"), undefined, [
+ ts.createLiteral(parameterOffset),
+ expression
+ ], location);
+ }
+ var metadataHelper = {
+ name: "typescript:metadata",
+ scoped: false,
+ priority: 3,
+ text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
+ };
+ function createMetadataHelper(context, metadataKey, metadataValue) {
+ context.requestEmitHelper(metadataHelper);
+ return ts.createCall(ts.getHelperName("__metadata"), undefined, [
+ ts.createLiteral(metadataKey),
+ metadataValue
+ ]);
+ }
+ var decorateHelper = {
+ name: "typescript:decorate",
+ scoped: false,
+ priority: 2,
+ text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
+ };
+ function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {
+ context.requestEmitHelper(decorateHelper);
+ var argumentsArray = [];
+ argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
+ }
+ return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location);
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformESNext(context) {
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ return visited;
+ }
+ function visitor(node) {
+ return visitorWorker(node, false);
+ }
+ function visitorNoDestructuringValue(node) {
+ return visitorWorker(node, true);
+ }
+ function visitorWorker(node, noDestructuringValue) {
+ if ((node.transformFlags & 8) === 0) {
+ return node;
+ }
+ switch (node.kind) {
+ case 176:
+ return visitObjectLiteralExpression(node);
+ case 192:
+ return visitBinaryExpression(node, noDestructuringValue);
+ case 223:
+ return visitVariableDeclaration(node);
+ case 213:
+ return visitForOfStatement(node);
+ case 211:
+ return visitForStatement(node);
+ case 188:
+ return visitVoidExpression(node);
+ case 150:
+ return visitConstructorDeclaration(node);
+ case 149:
+ return visitMethodDeclaration(node);
+ case 151:
+ return visitGetAccessorDeclaration(node);
+ case 152:
+ return visitSetAccessorDeclaration(node);
+ case 225:
+ return visitFunctionDeclaration(node);
+ case 184:
+ return visitFunctionExpression(node);
+ case 185:
+ return visitArrowFunction(node);
+ case 144:
+ return visitParameter(node);
+ case 207:
+ return visitExpressionStatement(node);
+ case 183:
+ return visitParenthesizedExpression(node, noDestructuringValue);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 259) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 257) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ if (node.transformFlags & 1048576) {
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 176) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return createAssignHelper(context, objects);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitExpressionStatement(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitParenthesizedExpression(node, noDestructuringValue) {
+ return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);
+ }
+ function visitBinaryExpression(node, noDestructuringValue) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue);
+ }
+ else if (node.operatorToken.kind === 25) {
+ return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitVariableDeclaration(node) {
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) {
+ return ts.flattenDestructuringBinding(node, visitor, context, 1);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitForStatement(node) {
+ return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));
+ }
+ function visitVoidExpression(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitForOfStatement(node) {
+ var leadingStatements;
+ var temp;
+ var initializer = ts.skipParentheses(node.initializer);
+ if (initializer.transformFlags & 1048576) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var firstDeclaration = ts.firstOrUndefined(initializer.declarations);
+ var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ else if (ts.isAssignmentPattern(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1);
+ leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer));
+ }
+ }
+ if (temp) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var block = ts.isBlock(statement)
+ ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))
+ : ts.createBlock(ts.append(leadingStatements, statement), statement, true);
+ return ts.updateForOf(node, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, undefined, node.initializer)
+ ], node.initializer, 1), expression, block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParameter(node) {
+ if (node.transformFlags & 1048576) {
+ return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitConstructorDeclaration(node) {
+ return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitGetAccessorDeclaration(node) {
+ return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitSetAccessorDeclaration(node) {
+ return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitMethodDeclaration(node) {
+ return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionDeclaration(node) {
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitArrowFunction(node) {
+ return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionExpression(node) {
+ return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function transformFunctionBody(node) {
+ resumeLexicalEnvironment();
+ var leadingStatements;
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ if (parameter.transformFlags & 1048576) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations));
+ ts.setEmitFlags(statement, 524288);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ }
+ var body = ts.visitNode(node.body, visitor, ts.isConciseBody);
+ var trailingStatements = endLexicalEnvironment();
+ if (ts.some(leadingStatements) || ts.some(trailingStatements)) {
+ var block = ts.convertToFunctionBody(body, true);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
+ }
+ return body;
+ }
+ }
+ ts.transformESNext = transformESNext;
+ var assignHelper = {
+ name: "typescript:assign",
+ scoped: false,
+ priority: 1,
+ text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
+ };
+ function createAssignHelper(context, attributesSegments) {
+ context.requestEmitHelper(assignHelper);
+ return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments);
+ }
+ ts.createAssignHelper = createAssignHelper;
})(ts || (ts = {}));
var ts;
(function (ts) {
- var entities = createEntitiesMap();
function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
var currentSourceFile;
@@ -40203,17 +40653,15 @@ var ts;
return node;
}
currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined;
- return node;
+ return visited;
}
function visitor(node) {
if (node.transformFlags & 4) {
return visitorWorker(node);
}
- else if (node.transformFlags & 8) {
- return ts.visitEachChild(node, visitor, context);
- }
else {
return node;
}
@@ -40227,8 +40675,7 @@ var ts;
case 252:
return visitJsxExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ return ts.visitEachChild(node, visitor, context);
}
}
function transformJsxChildToExpression(node) {
@@ -40266,8 +40713,10 @@ var ts;
if (ts.isJsxSpreadAttribute(attrs[0])) {
segments.unshift(ts.createObjectLiteral());
}
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
+ objectProperties = ts.singleOrUndefined(segments);
+ if (!objectProperties) {
+ objectProperties = ts.createAssignHelper(context, segments);
+ }
}
var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
@@ -40383,458 +40832,291 @@ var ts;
}
}
ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformESNext(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
- function visitor(node) {
- if (node.transformFlags & 16) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 32) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 176:
- return visitObjectLiteralExpression(node);
- case 192:
- return visitBinaryExpression(node);
- case 223:
- return visitVariableDeclaration(node);
- case 213:
- return visitForOfStatement(node);
- case 172:
- case 173:
- return node;
- case 225:
- return visitFunctionDeclaration(node);
- case 184:
- return visitFunctionExpression(node);
- case 185:
- return visitArrowFunction(node);
- case 144:
- return visitParameter(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
- }
- }
- function chunkObjectLiteralElements(elements) {
- var chunkObject;
- var objects = [];
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
- var e = elements_3[_i];
- if (e.kind === 259) {
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- chunkObject = undefined;
- }
- var target = e.expression;
- objects.push(ts.visitNode(target, visitor, ts.isExpression));
- }
- else {
- if (!chunkObject) {
- chunkObject = [];
- }
- if (e.kind === 257) {
- var p = e;
- chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
- }
- else {
- chunkObject.push(e);
- }
- }
- }
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- }
- return objects;
- }
- function visitObjectLiteralExpression(node) {
- if (ts.forEach(node.properties, function (p) { return p.kind === 259; })) {
- var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 176) {
- objects.unshift(ts.createObjectLiteral());
- }
- return ts.aggregateTransformFlags(ts.createCall(ts.createIdentifier("__assign"), undefined, objects));
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitBinaryExpression(node) {
- if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true);
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitVariableDeclaration(node) {
- if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) {
- var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true);
- return result;
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitForOfStatement(node) {
- var initializer = node.initializer;
- if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
- return ts.visitEachChild(node, visitor, context);
- }
- return ts.convertForOf(node, undefined, visitor, ts.noop, context, true);
- }
- function isRestBindingPattern(initializer) {
- if (ts.isVariableDeclarationList(initializer)) {
- var declaration = ts.firstOrUndefined(initializer.declarations);
- return declaration && declaration.name &&
- declaration.name.kind === 172 &&
- !!(declaration.name.transformFlags & 8388608);
- }
- return false;
- }
- function isRestAssignment(initializer) {
- return initializer.kind === 176 &&
- initializer.transformFlags & 8388608;
- }
- function visitParameter(node) {
- if (isObjectRestParameter(node)) {
- return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node);
- }
- else {
- return node;
- }
- }
- function isObjectRestParameter(node) {
- return node.name &&
- node.name.kind === 172 &&
- !!(node.name.transformFlags & 8388608);
- }
- function visitFunctionDeclaration(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- function visitArrowFunction(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- var func = ts.setOriginalNode(ts.createArrowFunction(node.modifiers, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node);
- ts.setEmitFlags(func, 256);
- return func;
- }
- function visitFunctionExpression(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionExpression(node.modifiers, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- }
- ts.transformESNext = transformESNext;
+ var entities = ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
})(ts || (ts = {}));
var ts;
(function (ts) {
function transformES2017(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var currentSourceFileExternalHelpersModuleName;
+ var currentSourceFile;
var enabledSubstitutions;
- var applicableSubstitutions;
var currentSuperContainer;
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
- return ts.visitEachChild(node, visitor, context);
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 64) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 128) {
- return ts.visitEachChild(node, visitor, context);
+ if ((node.transformFlags & 16) === 0) {
+ return node;
}
- return node;
- }
- function visitorWorker(node) {
switch (node.kind) {
case 119:
return undefined;
@@ -40849,68 +41131,37 @@ var ts;
case 185:
return visitArrowFunction(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return node;
+ return ts.visitEachChild(node, visitor, context);
}
}
function visitAwaitExpression(node) {
return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
}
function visitMethodDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionExpression(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitArrowFunction(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformConciseBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- currentScope = body;
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformAsyncFunctionBody(node) {
+ resumeLexicalEnvironment();
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
@@ -40919,52 +41170,49 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, node.body, true);
if (languageVersion >= 2) {
if (resolver.getNodeCheckFlags(node) & 4096) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8);
+ ts.addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & 2048) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4);
+ ts.addEmitHelper(block, asyncSuperHelper);
}
}
return block;
}
else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
+ var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));
+ var declarations = endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(expression);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));
+ }
+ return expression;
}
}
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ function transformFunctionBodyWorker(body, start) {
if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
+ return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));
}
else {
startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));
var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
+ return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));
}
}
function getPromiseConstructor(type) {
- if (type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
+ var typeName = type && ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
}
return undefined;
@@ -41038,14 +41286,15 @@ var ts;
|| kind === 152;
}
function onEmitNode(emitContext, node, emitCallback) {
- var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
if (enabledSubstitutions & 1 && isSuperContainer(node)) {
+ var savedCurrentSuperContainer = currentSuperContainer;
currentSuperContainer = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- previousOnEmitNode(emitContext, node, emitCallback);
- applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -41068,6 +41317,33 @@ var ts;
}
}
ts.transformES2017 = transformES2017;
+ function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ context.requestEmitHelper(awaiterHelper);
+ var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body);
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072;
+ return ts.createCall(ts.getHelperName("__awaiter"), undefined, [
+ ts.createThis(),
+ hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
+ promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
+ generatorFunc
+ ]);
+ }
+ var awaiterHelper = {
+ name: "typescript:awaiter",
+ scoped: false,
+ priority: 5,
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };"
+ };
+ var asyncSuperHelper = {
+ name: "typescript:async-super",
+ scoped: true,
+ text: "\n const _super = name => super[name];"
+ };
+ var advancedAsyncSuperHelper = {
+ name: "typescript:advanced-async-super",
+ scoped: true,
+ text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -41081,55 +41357,52 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 256) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 512) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
+ if ((node.transformFlags & 32) === 0) {
return node;
}
- }
- function visitorWorker(node) {
switch (node.kind) {
case 192:
return visitBinaryExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
return ts.visitEachChild(node, visitor, context);
}
}
function visitBinaryExpression(node) {
+ switch (node.operatorToken.kind) {
+ case 61:
+ return visitExponentiationAssignmentExpression(node);
+ case 39:
+ return visitExponentiationExpression(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitExponentiationAssignmentExpression(node) {
+ var target;
+ var value;
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 61) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
- }
- else if (ts.isPropertyAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
- value = ts.createPropertyAccess(expressionTemp, left.name, left);
- }
- else {
- target = left;
- value = left;
- }
- return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ if (ts.isElementAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
}
- else if (node.operatorToken.kind === 39) {
- return ts.createMathPow(left, right, node);
+ else if (ts.isPropertyAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
+ value = ts.createPropertyAccess(expressionTemp, left.name, left);
}
else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ target = left;
+ value = left;
}
+ return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ }
+ function visitExponentiationExpression(node) {
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return ts.createMathPow(left, right, node);
}
}
ts.transformES2016 = transformES2016;
@@ -41137,7 +41410,7 @@ var ts;
var ts;
(function (ts) {
function transformES2015(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
@@ -41163,7 +41436,11 @@ var ts;
}
currentSourceFile = node;
currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ currentText = undefined;
+ return visited;
}
function visitor(node) {
return saveStateAndInvoke(node, dispatcher);
@@ -41202,6 +41479,38 @@ var ts;
currentNode = savedCurrentNode;
return visited;
}
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 185) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 131072)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ switch (currentNode.kind) {
+ case 205:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 224:
+ case 223:
+ case 174:
+ case 172:
+ case 173:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
+ }
+ currentParent = currentNode;
+ currentNode = node;
+ }
function returnCapturedThis(node) {
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
@@ -41209,7 +41518,7 @@ var ts;
return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 1024) !== 0 ||
+ return (node.transformFlags & 64) !== 0 ||
node.kind === 219 ||
(ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
}
@@ -41220,7 +41529,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -41320,14 +41629,14 @@ var ts;
return visitTemplateExpression(node);
case 195:
return visitYieldExpression(node);
+ case 196:
+ return visitSpreadElement(node);
case 96:
return visitSuperKeyword();
case 195:
return ts.visitEachChild(node, visitor, context);
case 149:
return visitMethodDeclaration(node);
- case 261:
- return visitSourceFileNode(node);
case 205:
return visitVariableStatement(node);
default:
@@ -41335,37 +41644,14 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 185) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- switch (currentNode.kind) {
- case 205:
- enclosingVariableStatement = currentNode;
- break;
- case 224:
- case 223:
- case 174:
- case 172:
- case 173:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
- }
- currentParent = currentNode;
- currentNode = node;
+ function visitSourceFile(node) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
}
function visitSwitchStatement(node) {
ts.Debug.assert(convertedLoopState !== undefined);
@@ -41467,9 +41753,9 @@ var ts;
statements.push(exportStatement);
}
var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 33554432) === 0) {
+ if ((emitFlags & 2097152) === 0) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(statement, emitFlags | 33554432);
+ ts.setEmitFlags(statement, emitFlags | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -41482,15 +41768,15 @@ var ts;
}
var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
- if (ts.getEmitFlags(node) & 524288) {
- ts.setEmitFlags(classFunction, 524288);
+ if (ts.getEmitFlags(node) & 32768) {
+ ts.setEmitFlags(classFunction, 32768);
}
var inner = ts.createPartiallyEmittedExpression(classFunction);
inner.end = node.end;
- ts.setEmitFlags(inner, 49152);
+ ts.setEmitFlags(inner, 1536);
var outer = ts.createPartiallyEmittedExpression(inner);
outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement
? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
: []));
@@ -41505,19 +41791,19 @@ var ts;
var localName = ts.getLocalName(node);
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
var statement = ts.createReturn(outer);
statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 | 12288);
+ ts.setEmitFlags(statement, 1536 | 384);
statements.push(statement);
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
return block;
}
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement));
+ statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement));
}
}
function addConstructor(statements, node, extendsClauseElement) {
@@ -41525,29 +41811,27 @@ var ts;
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);
if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256);
+ ts.setEmitFlags(constructorFunction, 8);
}
statements.push(constructorFunction);
}
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
var statements = [];
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = -1;
if (hasSynthesizedSuper) {
- statementOffset = 1;
+ statementOffset = 0;
}
else if (constructor) {
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);
}
if (constructor) {
- ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false);
- ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -41569,7 +41853,7 @@ var ts;
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);
if (!constructor) {
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
}
return block;
}
@@ -41595,7 +41879,7 @@ var ts;
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
if (ctor) {
- ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
+ addCaptureThisForNodeIfNeeded(statements, ctor);
}
return 0;
}
@@ -41604,7 +41888,7 @@ var ts;
return 2;
}
if (hasSynthesizedSuper) {
- ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1;
}
@@ -41624,11 +41908,11 @@ var ts;
|| superCallExpression.left.kind !== 179) {
ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
- ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 49152)));
+ ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536)));
statements.push(returnStatement);
return 2;
}
- ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
if (superCallExpression) {
return 1;
}
@@ -41636,7 +41920,7 @@ var ts;
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
}
@@ -41654,6 +41938,86 @@ var ts;
return node;
}
}
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 131072) !== 0;
+ }
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_37)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer);
+ }
+ }
+ }
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288));
+ }
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288));
+ }
+ }
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter))
+ ], parameter), 1 | 32 | 384), undefined, parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 384 | 32 | 524288);
+ statements.push(statement);
+ }
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ }
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 48);
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))
+ ]), parameter), 524288));
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))
+ ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0
+ ? temp
+ : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 524288);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 32768 && node.kind !== 185) {
+ captureThisForNode(statements, node, ts.createThis());
+ }
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this", undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 1536 | 524288);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
function addClassMembers(statements, node) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
@@ -41685,33 +42049,34 @@ var ts;
function transformClassMethodDeclarationToStatement(receiver, member) {
var commentRange = ts.getCommentRange(member);
var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, member, undefined);
- ts.setEmitFlags(func, 49152);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member);
+ var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name);
+ var memberFunction = transformFunctionLikeToExpression(member, member, undefined);
+ ts.setEmitFlags(memberFunction, 1536);
+ ts.setSourceMapRange(memberFunction, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member);
ts.setOriginalNode(statement, member);
ts.setCommentRange(statement, commentRange);
- ts.setEmitFlags(statement, 1536);
+ ts.setEmitFlags(statement, 48);
return statement;
}
function transformAccessorsToStatement(receiver, accessors) {
var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
return statement;
}
function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {
var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 | 1024);
+ ts.setEmitFlags(target, 1536 | 32);
ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 | 512);
+ ts.setEmitFlags(propertyName, 1536 | 16);
ts.setSourceMapRange(propertyName, firstAccessor.name);
var properties = [];
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- ts.setEmitFlags(getterFunction, 16384);
+ ts.setEmitFlags(getterFunction, 512);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -41719,7 +42084,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- ts.setEmitFlags(setterFunction, 16384);
+ ts.setEmitFlags(setterFunction, 512);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -41736,28 +42101,91 @@ var ts;
return call;
}
function visitArrowFunction(node) {
- if (node.transformFlags & 262144) {
+ if (node.transformFlags & 16384) {
enableSubstitutionsForCapturedThis();
}
- var func = transformFunctionLikeToExpression(node, node, undefined);
- ts.setEmitFlags(func, 256);
+ var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ ts.setEmitFlags(func, 8);
return func;
}
function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, node, node.name);
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node);
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformFunctionLikeToExpression(node, location, name) {
var savedContainingNonArrowFunction = enclosingNonArrowFunction;
if (node.kind !== 185) {
enclosingNonArrowFunction = node;
}
- var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node);
+ var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
+ function transformFunctionBody(node) {
+ var multiLine = false;
+ var singleLine = false;
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ resumeLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, false);
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 185);
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, body);
+ ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
+ statements.push(returnStatement);
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 1);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
+ }
function visitExpressionStatement(node) {
switch (node.expression.kind) {
case 183:
@@ -41768,19 +42196,20 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitParenthesizedExpression(node, needsDestructuringValue) {
- if (needsDestructuringValue) {
+ if (!needsDestructuringValue) {
switch (node.expression.kind) {
case 183:
- return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
+ return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));
case 192:
- return ts.createParen(visitBinaryExpression(node.expression, true), node);
+ return ts.updateParen(node, visitBinaryExpression(node.expression, false));
}
}
return ts.visitEachChild(node, visitor, context);
}
function visitBinaryExpression(node, needsDestructuringValue) {
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ if (ts.isDestructuringAssignment(node)) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue);
+ }
}
function visitVariableStatement(node) {
if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {
@@ -41791,7 +42220,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor);
+ assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);
}
else {
assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -41818,7 +42247,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 67108864
+ if (node.transformFlags & 8388608
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
var firstDeclaration = ts.firstOrUndefined(declarations);
@@ -41851,17 +42280,17 @@ var ts;
return visitVariableDeclaration(node);
}
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_5 = ts.getMutableClone(node);
- clone_5.initializer = ts.createVoidZero();
- return clone_5;
+ var clone_3 = ts.getMutableClone(node);
+ clone_3.initializer = ts.createVoidZero();
+ return clone_3;
}
return ts.visitEachChild(node, visitor, context);
}
function visitVariableDeclaration(node) {
if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1);
- return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ var hoistTempVariables = enclosingVariableStatement
+ && ts.hasModifier(enclosingVariableStatement, 1);
+ return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -41900,7 +42329,69 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false);
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(undefined);
+ var elementAccess = ts.createElementAccess(rhsReference, counter);
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess);
+ var declarationList = ts.createVariableDeclarationList(declarations, initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(undefined, declarationList));
+ }
+ else {
+ statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))
+ ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ var assignment = ts.createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0)));
+ }
+ else {
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));
+ var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);
+ ts.setEmitFlags(body, 48 | 384);
+ var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)
+ ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);
+ ts.setEmitFlags(forStatement, 256);
+ return forStatement;
}
function visitObjectLiteralExpression(node) {
var properties = node.properties;
@@ -41908,7 +42399,7 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 134217728
+ if (property.transformFlags & 16777216
|| property.name.kind === 142) {
numInitialProperties = i;
break;
@@ -41917,7 +42408,7 @@ var ts;
ts.Debug.assert(numInitialProperties !== numProperties);
var temp = ts.createTempVariable(hoistVariableDeclaration);
var expressions = [];
- var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288));
+ var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768));
if (node.multiLine) {
assignment.startsOnNewLine = true;
}
@@ -41998,26 +42489,26 @@ var ts;
var currentState = convertedLoopState;
convertedLoopState = outerConvertedLoopState;
if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1, statements_3);
- loopBody = ts.createBlock(statements_3, undefined, true);
+ var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1, statements_4);
+ loopBody = ts.createBlock(statements_4, undefined, true);
}
if (!ts.isBlock(loopBody)) {
loopBody = ts.createBlock([loopBody], undefined, true);
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
- && (node.statement.transformFlags & 134217728) !== 0;
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0
+ && (node.statement.transformFlags & 16777216) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256;
+ loopBodyFlags |= 8;
}
if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152;
+ loopBodyFlags |= 131072;
}
var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
- ]), 16777216));
+ ]), 1048576));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
if (currentState.argumentsName) {
@@ -42234,7 +42725,7 @@ var ts;
ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));
var temp = ts.createTempVariable(undefined);
var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);
- var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor);
+ var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);
var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags);
var destructure = ts.createVariableStatement(undefined, list);
return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
@@ -42246,7 +42737,7 @@ var ts;
function visitMethodDeclaration(node) {
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);
- ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression));
+ ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));
return ts.createPropertyAssignment(node.name, functionExpression, node);
}
function visitShorthandPropertyAssignment(node) {
@@ -42267,10 +42758,10 @@ var ts;
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
if (node.expression.kind === 96) {
- ts.setEmitFlags(thisArg, 128);
+ ts.setEmitFlags(thisArg, 4);
}
var resultingCall;
- if (node.transformFlags & 8388608) {
+ if (node.transformFlags & 524288) {
resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
@@ -42278,7 +42769,7 @@ var ts;
}
if (node.expression.kind === 96) {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
return assignToCapturedThis
? ts.createAssignment(ts.createIdentifier("_this"), initializer)
@@ -42287,7 +42778,7 @@ var ts;
return resultingCall;
}
function visitNewExpression(node) {
- ts.Debug.assert((node.transformFlags & 8388608) !== 0);
+ ts.Debug.assert((node.transformFlags & 524288) !== 0);
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
}
@@ -42315,6 +42806,9 @@ var ts;
function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);
}
+ function visitSpreadElement(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
function visitExpressionOfSpread(node) {
return ts.visitNode(node.expression, visitor, ts.isExpression);
}
@@ -42392,18 +42886,6 @@ var ts;
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, node.statements);
- return clone;
- }
function onEmitNode(emitContext, node, emitCallback) {
var savedEnclosingFunction = enclosingFunction;
if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
@@ -42483,7 +42965,7 @@ var ts;
function substituteThisKeyword(node) {
if (enabledSubstitutions & 1
&& enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256) {
+ && ts.getEmitFlags(enclosingFunction) & 8) {
return ts.createIdentifier("_this", node);
}
return node;
@@ -42496,8 +42978,7 @@ var ts;
if (!constructor || !hasExtendsClause) {
return false;
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ if (ts.some(constructor.parameters)) {
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
@@ -42517,10 +42998,23 @@ var ts;
return false;
}
var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ return ts.isIdentifier(expression) && expression.text === "arguments";
}
}
ts.transformES2015 = transformES2015;
+ function createExtendsHelper(context, name) {
+ context.requestEmitHelper(extendsHelper);
+ return ts.createCall(ts.getHelperName("__extends"), undefined, [
+ name,
+ ts.createIdentifier("_super")
+ ]);
+ }
+ var extendsHelper = {
+ name: "typescript:extends",
+ scoped: false,
+ priority: 0,
+ text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -42532,7 +43026,7 @@ var ts;
_a[7] = "endfinally",
_a));
function transformGenerators(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var resolver = context.getEmitResolver();
@@ -42566,15 +43060,15 @@ var ts;
var withBlockStack;
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
+ if (ts.isDeclarationFile(node)
+ || (node.transformFlags & 512) === 0) {
return node;
}
- if (node.transformFlags & 8192) {
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- }
- return node;
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
var transformFlags = node.transformFlags;
@@ -42584,10 +43078,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 4096) {
+ else if (transformFlags & 256) {
return visitGenerator(node);
}
- else if (transformFlags & 8192) {
+ else if (transformFlags & 512) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -42630,10 +43124,10 @@ var ts;
case 216:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (8192 | 268435456)) {
+ else if (node.transformFlags & (512 | 33554432)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -42675,8 +43169,8 @@ var ts;
}
}
function visitFunctionDeclaration(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -42696,8 +43190,8 @@ var ts;
}
}
function visitFunctionExpression(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -42748,7 +43242,7 @@ var ts;
operationArguments = undefined;
operationLocations = undefined;
state = ts.createTempVariable(undefined);
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
@@ -42770,12 +43264,12 @@ var ts;
return ts.createBlock(statements, body, body.multiLine);
}
function visitVariableStatement(node) {
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
else {
- if (ts.getEmitFlags(node) & 8388608) {
+ if (ts.getEmitFlags(node) & 524288) {
return node;
}
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
@@ -42852,10 +43346,10 @@ var ts;
else if (node.operatorToken.kind === 25) {
return visitCommaExpression(node);
}
- var clone_6 = ts.getMutableClone(node);
- clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_6;
+ var clone_4 = ts.getMutableClone(node);
+ clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_4;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -42920,26 +43414,30 @@ var ts;
return createGeneratorResume();
}
function visitArrayLiteralExpression(node) {
- return visitElements(node.elements, node.multiLine);
+ return visitElements(node.elements, undefined, undefined, node.multiLine);
}
- function visitElements(elements, _multiLine) {
+ function visitElements(elements, leadingElement, location, multiLine) {
var numInitialElements = countInitialNodesWithoutYield(elements);
var temp = declareLocal();
var hasAssignedTemp = false;
if (numInitialElements > 0) {
- emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements)));
+ var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
+ emitAssignment(temp, ts.createArrayLiteral(leadingElement
+ ? [leadingElement].concat(initialElements) : initialElements));
+ leadingElement = undefined;
hasAssignedTemp = true;
}
var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
return hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions);
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);
function reduceElement(expressions, element) {
if (containsYield(element) && expressions.length > 0) {
emitAssignment(temp, hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions));
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine));
hasAssignedTemp = true;
+ leadingElement = undefined;
expressions = [];
}
expressions.push(ts.visitNode(element, visitor, ts.isExpression));
@@ -42973,10 +43471,10 @@ var ts;
}
function visitElementAccessExpression(node) {
if (containsYield(node.argumentExpression)) {
- var clone_7 = ts.getMutableClone(node);
- clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_7;
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_5;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -42990,7 +43488,7 @@ var ts;
function visitNewExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node);
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -43432,7 +43930,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 134217728) !== 0;
+ return node && (node.transformFlags & 16777216) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -43462,12 +43960,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_37) {
- var clone_8 = ts.getMutableClone(name_37);
- ts.setSourceMapRange(clone_8, node);
- ts.setCommentRange(clone_8, node);
- return clone_8;
+ var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_38) {
+ var clone_6 = ts.getMutableClone(name_38);
+ ts.setSourceMapRange(clone_6, node);
+ ts.setCommentRange(clone_6, node);
+ return clone_6;
}
}
}
@@ -43858,10 +44356,7 @@ var ts;
currentExceptionBlock = undefined;
withBlockStack = undefined;
var buildResult = buildStatements();
- return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [
- ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
- ]);
+ return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144));
}
function buildStatements() {
if (operations) {
@@ -44124,6 +44619,16 @@ var ts;
}
}
ts.transformGenerators = transformGenerators;
+ function createGeneratorHelper(context, body) {
+ context.requestEmitHelper(generatorHelper);
+ return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]);
+ }
+ var generatorHelper = {
+ name: "typescript:generator",
+ scoped: false,
+ priority: 6,
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
+ };
var _a;
})(ts || (ts = {}));
var ts;
@@ -44180,7 +44685,7 @@ var ts;
_a[ts.ModuleKind.AMD] = transformAMDModule,
_a[ts.ModuleKind.UMD] = transformUMDModule,
_a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
@@ -44209,7 +44714,7 @@ var ts;
return node;
}
currentSourceFile = node;
- currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule(node);
currentSourceFile = undefined;
@@ -44220,12 +44725,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, false);
var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node));
+ ts.addEmitHelper(updated, exportStarHelper);
}
return updated;
}
@@ -44235,8 +44741,7 @@ var ts;
return transformAsynchronousModule(node, define, moduleName, true);
}
function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16);
+ var define = ts.createRawExpression(umdHelper);
return transformAsynchronousModule(node, define, undefined, false);
}
function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
@@ -44273,7 +44778,7 @@ var ts;
var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
if (includeNonAmdDependencies && importAliasName) {
- ts.setEmitFlags(importAliasName, 128);
+ ts.setEmitFlags(importAliasName, 4);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName));
}
@@ -44287,12 +44792,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, true);
var body = ts.createBlock(statements, undefined, true);
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(body, 2);
+ ts.addEmitHelper(body, exportStarHelper);
}
return body;
}
@@ -44300,12 +44806,12 @@ var ts;
if (currentModuleInfo.exportEquals) {
if (emitAsReturn) {
var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 12288 | 49152);
+ ts.setEmitFlags(statement, 384 | 1536);
statements.push(statement);
}
else {
var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
statements.push(statement);
}
}
@@ -44326,9 +44832,9 @@ var ts;
return visitFunctionDeclaration(node);
case 226:
return visitClassDeclaration(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return node;
@@ -44519,7 +45025,7 @@ var ts;
}
function transformInitializedVariable(node) {
if (ts.isBindingPattern(node.name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression);
}
else {
return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer);
@@ -44533,7 +45039,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -44653,7 +45159,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value), location);
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -44720,6 +45226,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
if (exportContainer && exportContainer.kind === 261) {
@@ -44731,8 +45244,8 @@ var ts;
return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node);
}
else if (ts.isImportSpecifier(importDeclaration)) {
- var name_38 = importDeclaration.propertyName || importDeclaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node);
+ var name_39 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node);
}
}
}
@@ -44791,6 +45304,12 @@ var ts;
var _a;
}
ts.transformModule = transformModule;
+ var exportStarHelper = {
+ name: "typescript:export-star",
+ scoped: true,
+ text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }"
+ };
+ var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })";
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -44829,14 +45348,15 @@ var ts;
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
enclosingBlockScopedContainer = node;
- moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
contextObject = ts.createUniqueName("context");
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
ts.createParameter(undefined, undefined, undefined, exportFunction),
ts.createParameter(undefined, undefined, undefined, contextObject)
- ], undefined, createSystemModuleBody(node, dependencyGroups));
+ ], undefined, moduleBodyBlock);
var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
var updated = ts.updateSourceFileNode(node, ts.createNodeArray([
@@ -44844,7 +45364,9 @@ var ts;
? [moduleName, dependencies, moduleBodyFunction]
: [dependencies, moduleBodyFunction]))
], node.statements));
- ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1);
+ if (!(compilerOptions.outFile || compilerOptions.out)) {
+ ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
+ }
if (noSubstitution) {
noSubstitutionMap[id] = noSubstitution;
noSubstitution = undefined;
@@ -44885,6 +45407,7 @@ var ts;
statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
])));
+ ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true);
var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);
ts.addRange(statements, hoistedStatements);
ts.addRange(statements, endLexicalEnvironment());
@@ -44893,9 +45416,7 @@ var ts;
ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
]), true)));
- var body = ts.createBlock(statements, undefined, true);
- ts.setEmitFlags(body, 1);
- return body;
+ return ts.createBlock(statements, undefined, true);
}
function addExportStarIfNeeded(statements) {
if (!moduleInfo.hasExportStarsToExportValues) {
@@ -44955,7 +45476,7 @@ var ts;
var exports = ts.createIdentifier("exports");
var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n])));
}
return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([
ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
@@ -44964,7 +45485,7 @@ var ts;
ts.createForIn(ts.createVariableDeclarationList([
ts.createVariableDeclaration(n, undefined)
]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32)
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)
])),
ts.createStatement(ts.createCall(exportFunction, undefined, [exports]))
], undefined, true));
@@ -45136,14 +45657,14 @@ var ts;
}
}
function shouldHoistVariableDeclarationList(node) {
- return (ts.getEmitFlags(node) & 16777216) === 0
+ return (ts.getEmitFlags(node) & 1048576) === 0
&& (enclosingBlockScopedContainer.kind === 261
|| (ts.getOriginalNode(node).flags & 3) === 0);
}
function transformInitializedVariable(node, isExportedDeclaration) {
var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
return ts.isBindingPattern(node.name)
- ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment)
: createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
}
function createExportedVariableAssignment(name, value, location) {
@@ -45167,7 +45688,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -45284,7 +45805,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value));
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -45328,9 +45849,9 @@ var ts;
return visitCatchClause(node);
case 204:
return visitBlock(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return destructuringVisitor(node);
@@ -45420,11 +45941,11 @@ var ts;
return node;
}
function destructuringVisitor(node) {
- if (node.transformFlags & 16384
+ if (node.transformFlags & 1024
&& node.kind === 192) {
return visitDestructuringAssignment(node);
}
- else if (node.transformFlags & 32768) {
+ else if (node.transformFlags & 2048) {
return ts.visitEachChild(node, destructuringVisitor, context);
}
else {
@@ -45433,7 +45954,7 @@ var ts;
}
function visitDestructuringAssignment(node) {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor);
+ return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true);
}
return ts.visitEachChild(node, destructuringVisitor, context);
}
@@ -45515,6 +46036,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var importDeclaration = resolver.getReferencedImportDeclaration(node);
if (importDeclaration) {
@@ -45602,13 +46130,30 @@ var ts;
(function (ts) {
function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableEmitNotification(261);
+ context.enableSubstitution(70);
+ var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
+ var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
+ if (externalHelpersModuleName) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements);
+ ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ }
+ else {
+ return ts.visitEachChild(node, visitor, context);
+ }
}
return node;
}
@@ -45624,6 +46169,32 @@ var ts;
function visitExportAssignment(node) {
return node.isExportEquals ? undefined : node;
}
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (ts.isSourceFile(node)) {
+ currentSourceFile = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isIdentifier(node) && emitContext === 1) {
+ return substituteExpressionIdentifier(node);
+ }
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ }
+ return node;
+ }
}
ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
@@ -45667,21 +46238,27 @@ var ts;
}
ts.getTransformers = getTransformers;
function transformFiles(resolver, host, sourceFiles, transformers) {
+ var enabledSyntaxKindFeatures = new Array(298);
+ var lexicalEnvironmentDisabled = false;
+ var lexicalEnvironmentVariableDeclarations;
+ var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(296);
var lexicalEnvironmentStackOffset = 0;
- var hoistedVariableDeclarations;
- var hoistedFunctionDeclarations;
- var lexicalEnvironmentDisabled;
+ var lexicalEnvironmentSuspended = false;
+ var emitHelpers;
var context = {
getCompilerOptions: function () { return host.getCompilerOptions(); },
getEmitResolver: function () { return resolver; },
getEmitHost: function () { return host; },
- hoistVariableDeclaration: hoistVariableDeclaration,
- hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
+ suspendLexicalEnvironment: suspendLexicalEnvironment,
+ resumeLexicalEnvironment: resumeLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
+ hoistVariableDeclaration: hoistVariableDeclaration,
+ hoistFunctionDeclaration: hoistFunctionDeclaration,
+ requestEmitHelper: requestEmitHelper,
+ readEmitHelpers: readEmitHelpers,
onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
@@ -45708,7 +46285,7 @@ var ts;
}
function isSubstitutionEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0
- && (ts.getEmitFlags(node) & 128) === 0;
+ && (ts.getEmitFlags(node) & 4) === 0;
}
function emitNodeWithSubstitution(emitContext, node, emitCallback) {
if (node) {
@@ -45727,7 +46304,7 @@ var ts;
}
function isEmitNotificationEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0
- || (ts.getEmitFlags(node) & 64) !== 0;
+ || (ts.getEmitFlags(node) & 2) !== 0;
}
function emitNodeWithNotification(emitContext, node, emitCallback) {
if (node) {
@@ -45742,39 +46319,51 @@ var ts;
function hoistVariableDeclaration(name) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
var decl = ts.createVariableDeclaration(name);
- if (!hoistedVariableDeclarations) {
- hoistedVariableDeclarations = [decl];
+ if (!lexicalEnvironmentVariableDeclarations) {
+ lexicalEnvironmentVariableDeclarations = [decl];
}
else {
- hoistedVariableDeclarations.push(decl);
+ lexicalEnvironmentVariableDeclarations.push(decl);
}
}
function hoistFunctionDeclaration(func) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
- if (!hoistedFunctionDeclarations) {
- hoistedFunctionDeclarations = [func];
+ if (!lexicalEnvironmentFunctionDeclarations) {
+ lexicalEnvironmentFunctionDeclarations = [func];
}
else {
- hoistedFunctionDeclarations.push(func);
+ lexicalEnvironmentFunctionDeclarations.push(func);
}
}
function startLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase.");
- lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations;
- lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations;
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
+ lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
+ lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStackOffset++;
- hoistedVariableDeclarations = undefined;
- hoistedFunctionDeclarations = undefined;
+ lexicalEnvironmentVariableDeclarations = undefined;
+ lexicalEnvironmentFunctionDeclarations = undefined;
+ }
+ function suspendLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
+ lexicalEnvironmentSuspended = true;
+ }
+ function resumeLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase.");
+ ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
+ lexicalEnvironmentSuspended = false;
}
function endLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
var statements;
- if (hoistedVariableDeclarations || hoistedFunctionDeclarations) {
- if (hoistedFunctionDeclarations) {
- statements = hoistedFunctionDeclarations.slice();
+ if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
+ if (lexicalEnvironmentFunctionDeclarations) {
+ statements = lexicalEnvironmentFunctionDeclarations.slice();
}
- if (hoistedVariableDeclarations) {
- var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations));
+ if (lexicalEnvironmentVariableDeclarations) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
if (!statements) {
statements = [statement];
}
@@ -45784,10 +46373,25 @@ var ts;
}
}
lexicalEnvironmentStackOffset--;
- hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
- hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ if (lexicalEnvironmentStackOffset === 0) {
+ lexicalEnvironmentVariableDeclarationsStack = [];
+ lexicalEnvironmentFunctionDeclarationsStack = [];
+ }
return statements;
}
+ function requestEmitHelper(helper) {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
+ emitHelpers = ts.append(emitHelpers, helper);
+ }
+ function readEmitHelpers() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ var helpers = emitHelpers;
+ emitHelpers = undefined;
+ return helpers;
+ }
}
ts.transformFiles = transformFiles;
var _a;
@@ -46042,15 +46646,15 @@ var ts;
}
}
function emitLines(nodes) {
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
emit(node);
}
}
function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {
var currentWriterPos = writer.getTextPos();
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (!canEmitFn || canEmitFn(node)) {
if (currentWriterPos !== writer.getTextPos()) {
write(separator);
@@ -46065,7 +46669,7 @@ var ts;
}
function writeJsDocComments(declaration) {
if (declaration) {
- var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText);
+ var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);
ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);
ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange);
}
@@ -46252,9 +46856,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_39 = baseName + "_" + count;
- if (!(name_39 in currentIdentifiers)) {
- return name_39;
+ var name_40 = baseName + "_" + count;
+ if (!(name_40 in currentIdentifiers)) {
+ return name_40;
}
}
}
@@ -46648,6 +47252,9 @@ var ts;
case 225:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
+ case 228:
+ diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
+ break;
default:
ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
@@ -46741,7 +47348,10 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
- emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false);
+ var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });
+ if (interfaceExtendsTypes && interfaceExtendsTypes.length) {
+ emitHeritageClause(interfaceExtendsTypes, false);
+ }
write(" {");
writeLine();
increaseIndent();
@@ -47459,12 +48069,12 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 292
- && (emitFlags & 512) === 0
+ if (node.kind !== 293
+ && (emitFlags & 16) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
}
- if (emitFlags & 2048) {
+ if (emitFlags & 64) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47472,8 +48082,8 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 292
- && (emitFlags & 1024) === 0
+ if (node.kind !== 293
+ && (emitFlags & 32) === 0
&& end >= 0) {
emitPos(end);
}
@@ -47487,13 +48097,13 @@ var ts;
var emitFlags = emitNode && emitNode.flags;
var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);
- if ((emitFlags & 4096) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 128) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
tokenPos = emitCallback(token, tokenPos);
if (range)
tokenPos = range.end;
- if ((emitFlags & 8192) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 256) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
return tokenPos;
@@ -47603,7 +48213,7 @@ var ts;
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
var emitFlags = ts.getEmitFlags(node);
if ((pos < 0 && end < 0) || (pos === end)) {
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47616,9 +48226,9 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 292;
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0;
+ var isEmittedNode = node.kind !== 293;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitLeadingComments(pos, isEmittedNode);
}
@@ -47637,7 +48247,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitNodeWithComment");
}
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47666,15 +48276,15 @@ var ts;
}
var pos = detachedRange.pos, end = detachedRange.end;
var emitFlags = ts.getEmitFlags(node);
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
}
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments");
}
- if (emitFlags & 65536 && !disabled) {
+ if (emitFlags & 2048 && !disabled) {
disabled = true;
emitCallback(node);
disabled = false;
@@ -47835,18 +48445,6 @@ var ts;
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
- var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};";
- var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
- var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
- var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
- var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};";
- var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};";
- var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};";
- var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};";
- var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}";
- var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})";
- var superHelper = "\nconst _super = name => super[name];";
- var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);";
var compilerOptions = host.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
@@ -47868,12 +48466,7 @@ var ts;
var currentSourceFile;
var currentText;
var currentFileIdentifiers;
- var extendsEmitted;
- var assignEmitted;
- var restEmitted;
- var decorateEmitted;
- var paramEmitted;
- var awaiterEmitted;
+ var bundledHelpers;
var isOwnFileEmit;
var emitSkipped = false;
var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);
@@ -47922,11 +48515,12 @@ var ts;
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNameSet = ts.createMap();
+ bundledHelpers = isBundledEmit ? ts.createMap() : undefined;
isOwnFileEmit = !isBundledEmit;
if (isBundledEmit && moduleKind) {
for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {
var sourceFile = sourceFiles_5[_a];
- emitEmitHelpers(sourceFile);
+ emitHelpers(sourceFile, true);
}
}
ts.forEach(sourceFiles, printSourceFile);
@@ -47936,23 +48530,18 @@ var ts;
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
}
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false);
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles);
}
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
}
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM);
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
sourceMap.reset();
comments.reset();
writer.reset();
tempFlags = 0;
currentSourceFile = undefined;
currentText = undefined;
- extendsEmitted = false;
- assignEmitted = false;
- decorateEmitted = false;
- paramEmitted = false;
- awaiterEmitted = false;
isOwnFileEmit = false;
}
function printSourceFile(node) {
@@ -48320,8 +48909,10 @@ var ts;
return emitJsxElement(node);
case 247:
return emitJsxSelfClosingElement(node);
- case 293:
+ case 294:
return emitPartiallyEmittedExpression(node);
+ case 297:
+ return writeLines(node.text);
}
}
function emitNumericLiteral(node) {
@@ -48341,12 +48932,7 @@ var ts;
}
}
function emitIdentifier(node) {
- if (ts.getEmitFlags(node) & 16) {
- writeLines(umdHelper);
- }
- else {
- write(getTextOfNode(node, false));
- }
+ write(getTextOfNode(node, false));
}
function emitQualifiedName(node) {
emitEntityName(node.left);
@@ -48589,7 +49175,7 @@ var ts;
write("{}");
}
else {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -48604,7 +49190,7 @@ var ts;
function emitPropertyAccessExpression(node) {
var indentBeforeDot = false;
var indentAfterDot = false;
- if (!(ts.getEmitFlags(node) & 1048576)) {
+ if (!(ts.getEmitFlags(node) & 65536)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };
@@ -48788,7 +49374,7 @@ var ts;
}
}
function emitBlockStatements(node) {
- if (ts.getEmitFlags(node) & 32) {
+ if (ts.getEmitFlags(node) & 1) {
emitList(node, node.statements, 384);
}
else {
@@ -48964,11 +49550,11 @@ var ts;
var body = node.body;
if (body) {
if (ts.isBlock(body)) {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
- if (ts.getEmitFlags(node) & 4194304) {
+ if (ts.getEmitFlags(node) & 262144) {
emitSignatureHead(node);
emitBlockFunctionBody(body);
}
@@ -49000,7 +49586,7 @@ var ts;
emitWithPrefix(": ", node.type);
}
function shouldEmitBlockFunctionBodyOnSingleLine(body) {
- if (ts.getEmitFlags(body) & 32) {
+ if (ts.getEmitFlags(body) & 1) {
return true;
}
if (body.multiLine) {
@@ -49055,7 +49641,7 @@ var ts;
emitModifiers(node, node.modifiers);
write("class");
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -49314,7 +49900,7 @@ var ts;
emit(node.name);
write(": ");
var initializer = node.initializer;
- if ((ts.getEmitFlags(initializer) & 16384) === 0) {
+ if ((ts.getEmitFlags(initializer) & 512) === 0) {
var commentRange = ts.getCommentRange(initializer);
emitTrailingCommentsOfPosition(commentRange.pos);
}
@@ -49368,71 +49954,31 @@ var ts;
}
return statements.length;
}
- function emitHelpers(node) {
- var emitFlags = ts.getEmitFlags(node);
+ function emitHelpers(node, isBundle) {
+ var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;
+ var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;
var helpersEmitted = false;
- if (emitFlags & 1) {
- helpersEmitted = emitEmitHelpers(currentSourceFile);
- }
- if (emitFlags & 2) {
- writeLines(exportStarHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 4) {
- writeLines(superHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 8) {
- writeLines(advancedSuperHelper);
- helpersEmitted = true;
- }
- return helpersEmitted;
- }
- function emitEmitHelpers(node) {
- if (compilerOptions.noEmitHelpers) {
- return false;
- }
- if (compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- return false;
- }
- var helpersEmitted = false;
- if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) {
- writeLines(extendsHelper);
- extendsEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) &&
- compilerOptions.jsx !== 1 &&
- !assignEmitted &&
- node.flags & 16384) {
- writeLines(assignHelper);
- assignEmitted = true;
- }
- if (languageVersion < 5 && !restEmitted && node.flags & 32768) {
- writeLines(restHelper);
- restEmitted = true;
- }
- if (!decorateEmitted && node.flags & 2048) {
- writeLines(decorateHelper);
- if (compilerOptions.emitDecoratorMetadata) {
- writeLines(metadataHelper);
- }
- decorateEmitted = true;
- helpersEmitted = true;
- }
- if (!paramEmitted && node.flags & 4096) {
- writeLines(paramHelper);
- paramEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) {
- writeLines(awaiterHelper);
- if (languageVersion < 2) {
- writeLines(generatorHelper);
+ var helpers = ts.getEmitHelpers(node);
+ if (helpers) {
+ for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {
+ var helper = _b[_a];
+ if (!helper.scoped) {
+ if (shouldSkip)
+ continue;
+ if (shouldBundle) {
+ if (bundledHelpers[helper.name]) {
+ continue;
+ }
+ bundledHelpers[helper.name] = true;
+ }
+ }
+ else if (isBundle) {
+ continue;
+ }
+ writeLines(helper.text);
+ helpersEmitted = true;
}
- awaiterEmitted = true;
- helpersEmitted = true;
}
if (helpersEmitted) {
writeLine();
@@ -49440,9 +49986,10 @@ var ts;
return helpersEmitted;
}
function writeLines(text) {
- var lines = text.split(/\r\n|\r|\n/g);
+ var lines = text.split(/\r\n?|\n/g);
+ var indentation = guessIndentation(lines);
for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
+ var line = indentation ? lines[i].slice(indentation) : lines[i];
if (line.length) {
if (i > 0) {
writeLine();
@@ -49451,6 +49998,21 @@ var ts;
}
}
}
+ function guessIndentation(lines) {
+ var indentation;
+ for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
+ var line = lines_1[_a];
+ for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
+ if (!ts.isWhiteSpace(line.charCodeAt(i))) {
+ if (indentation === undefined || i < indentation) {
+ indentation = i;
+ break;
+ }
+ }
+ }
+ }
+ return indentation;
+ }
function emitShebang() {
var shebang = ts.getShebang(currentText);
if (shebang) {
@@ -49792,21 +50354,21 @@ var ts;
}
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_40 = flags === 268435456 ? "_i" : "_n";
- if (isUniqueName(name_40)) {
+ var name_41 = flags === 268435456 ? "_i" : "_n";
+ if (isUniqueName(name_41)) {
tempFlags |= flags;
- return name_40;
+ return name_41;
}
}
while (true) {
var count = tempFlags & 268435455;
tempFlags++;
if (count !== 8 && count !== 13) {
- var name_41 = count < 26
+ var name_42 = count < 26
? "_" + String.fromCharCode(97 + count)
: "_" + (count - 26);
- if (isUniqueName(name_41)) {
- return name_41;
+ if (isUniqueName(name_42)) {
+ return name_42;
}
}
}
@@ -49927,7 +50489,6 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.2.0-dev.20161115";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -50143,10 +50704,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_42 = names_1[_i];
- var result = name_42 in cache
- ? cache[name_42]
- : cache[name_42] = loader(name_42, containingFile);
+ var name_43 = names_1[_i];
+ var result = name_43 in cache
+ ? cache[name_43]
+ : cache[name_43] = loader(name_43, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -50200,7 +50761,8 @@ var ts;
ts.forEach(rootNames, function (name) { return processRootFile(name, false); });
var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);
if (typeReferences.length) {
- var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
+ var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
+ var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts");
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (var i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
@@ -50680,8 +51242,8 @@ var ts;
}
break;
}
- for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
- var node = nodes_4[_b];
+ for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {
+ var node = nodes_6[_b];
walk(node);
}
}
@@ -51714,7 +52276,7 @@ var ts;
case 243:
case 237:
return ts.ScriptElementKind.alias;
- case 284:
+ case 285:
return ts.ScriptElementKind.typeElement;
default:
return ts.ScriptElementKind.unknown;
@@ -51929,7 +52491,7 @@ var ts;
ts.findChildOfKind = findChildOfKind;
function findContainingList(node) {
var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
- if (c.kind === 291 && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
@@ -52165,11 +52727,11 @@ var ts;
}
}
if (node) {
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- if (jsDocComment.tags) {
- for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ if (jsDoc.tags) {
+ for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {
var tag = _c[_b];
if (tag.pos <= position && position <= tag.end) {
return tag;
@@ -52491,7 +53053,7 @@ var ts;
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
- else if (ts.isStringOrNumericLiteral(location.kind) &&
+ else if (ts.isStringOrNumericLiteral(location) &&
location.parent.kind === 142) {
return location.text;
}
@@ -53574,16 +54136,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18);
pos = tag.tagName.end;
switch (tag.kind) {
- case 280:
+ case 281:
processJSDocParameterTag(tag);
break;
- case 283:
+ case 284:
processJSDocTemplateTag(tag);
break;
- case 282:
+ case 283:
processElement(tag.typeExpression);
break;
- case 281:
+ case 282:
processElement(tag.typeExpression);
break;
}
@@ -53835,13 +54397,13 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_43 in nameTable) {
- if (nameTable[name_43] === position) {
+ for (var name_44 in nameTable) {
+ if (nameTable[name_44] === position) {
continue;
}
- if (!uniqueNames[name_43]) {
- uniqueNames[name_43] = name_43;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, true);
+ if (!uniqueNames[name_44]) {
+ uniqueNames[name_44] = name_44;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, true);
if (displayName) {
var entry = {
name: displayName,
@@ -54263,11 +54825,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_14 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_14) {
+ var parent_13 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_13) {
break;
}
- currentDir = parent_14;
+ currentDir = parent_13;
}
else {
break;
@@ -54344,10 +54906,10 @@ var ts;
function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_2 = completionData.location;
- var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; });
+ var symbols = completionData.symbols, location_3 = completionData.location;
+ var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
if (symbol) {
- var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
+ var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
return {
name: entryName,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
@@ -54373,8 +54935,8 @@ var ts;
function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_3 = completionData.location;
- return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
+ var symbols = completionData.symbols, location_4 = completionData.location;
+ return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; });
}
return undefined;
}
@@ -54399,9 +54961,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 282:
- case 280:
+ case 283:
case 281:
+ case 282:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -54436,13 +54998,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_15 = contextToken.parent, kind = contextToken.kind;
+ var parent_14 = contextToken.parent, kind = contextToken.kind;
if (kind === 22) {
- if (parent_15.kind === 177) {
+ if (parent_14.kind === 177) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_15.kind === 141) {
+ else if (parent_14.kind === 141) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -54739,9 +55301,9 @@ var ts;
switch (contextToken.kind) {
case 16:
case 25:
- var parent_16 = contextToken.parent;
- if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) {
- return parent_16;
+ var parent_15 = contextToken.parent;
+ if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) {
+ return parent_15;
}
break;
}
@@ -54764,34 +55326,34 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_17 = contextToken.parent;
+ var parent_16 = contextToken.parent;
switch (contextToken.kind) {
case 27:
case 40:
case 70:
case 250:
case 251:
- if (parent_17 && (parent_17.kind === 247 || parent_17.kind === 248)) {
- return parent_17;
+ if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) {
+ return parent_16;
}
- else if (parent_17.kind === 250) {
- return parent_17.parent;
+ else if (parent_16.kind === 250) {
+ return parent_16.parent;
}
break;
case 9:
- if (parent_17 && ((parent_17.kind === 250) || (parent_17.kind === 251))) {
- return parent_17.parent;
+ if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) {
+ return parent_16.parent;
}
break;
case 17:
- if (parent_17 &&
- parent_17.kind === 252 &&
- parent_17.parent &&
- (parent_17.parent.kind === 250)) {
- return parent_17.parent.parent;
+ if (parent_16 &&
+ parent_16.kind === 252 &&
+ parent_16.parent &&
+ (parent_16.parent.kind === 250)) {
+ return parent_16.parent.parent;
}
- if (parent_17 && parent_17.kind === 251) {
- return parent_17.parent;
+ if (parent_16 && parent_16.kind === 251) {
+ return parent_16.parent;
}
break;
}
@@ -54914,8 +55476,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_44 = element.propertyName || element.name;
- existingImportsOrExports[name_44.text] = true;
+ var name_45 = element.propertyName || element.name;
+ existingImportsOrExports[name_45.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -55212,17 +55774,17 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_18 = child.parent;
- if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261) {
- return parent_18;
+ var parent_17 = child.parent;
+ if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) {
+ return parent_17;
}
- if (parent_18.kind === 221) {
- var tryStatement = parent_18;
+ if (parent_17.kind === 221) {
+ var tryStatement = parent_17;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_18;
+ child = parent_17;
}
return undefined;
}
@@ -56057,24 +56619,24 @@ var ts;
}
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_19 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.initializer));
+ var parent_18 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.initializer));
}
- else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) {
- if (parent_19.body.kind === 204) {
- ts.forEachReturnStatement(parent_19.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {
+ if (parent_18.body.kind === 204) {
+ ts.forEachReturnStatement(parent_18.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_19.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.body));
+ else if (isImplementationExpression(parent_18.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.body));
}
}
- else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.expression));
+ else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.expression));
}
}
}
@@ -56450,9 +57012,9 @@ var ts;
return undefined;
}
}
- var result_3 = [];
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap());
- return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
+ var result_4 = [];
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap());
+ return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
}
return undefined;
});
@@ -56460,7 +57022,7 @@ var ts;
function getNameFromObjectLiteralElement(node) {
if (node.name.kind === 142) {
var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
return undefined;
@@ -56472,20 +57034,20 @@ var ts;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name = getNameFromObjectLiteralElement(node);
if (name && contextualType) {
- var result_4 = [];
+ var result_5 = [];
var symbol_2 = contextualType.getProperty(name);
if (symbol_2) {
- result_4.push(symbol_2);
+ result_5.push(symbol_2);
}
if (contextualType.flags & 65536) {
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name);
if (symbol) {
- result_4.push(symbol);
+ result_5.push(symbol);
}
});
}
- return result_4;
+ return result_5;
}
return undefined;
}
@@ -56713,13 +57275,13 @@ var ts;
return undefined;
}
if (type.flags & 65536 && !(type.flags & 16)) {
- var result_5 = [];
+ var result_6 = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
- ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node));
+ ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node));
}
});
- return result_5;
+ return result_6;
}
if (!type.symbol) {
return undefined;
@@ -56911,7 +57473,7 @@ var ts;
function getJsDocCommentsFromDeclarations(declarations) {
var documentationComment = [];
forEachUnique(declarations, function (declaration) {
- var comments = ts.getJSDocComments(declaration, true);
+ var comments = ts.getCommentsFromJSDoc(declaration);
if (!comments) {
return;
}
@@ -57050,10 +57612,10 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_45 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_45];
+ for (var name_46 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_46];
if (declarations) {
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46);
if (!matches) {
continue;
}
@@ -57064,14 +57626,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_45);
+ matches = patternMatcher.getMatches(containers, name_46);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -57324,9 +57886,9 @@ var ts;
case 174:
case 223:
var decl = node;
- var name_46 = decl.name;
- if (ts.isBindingPattern(name_46)) {
- addChildrenRecursively(name_46);
+ var name_47 = decl.name;
+ if (ts.isBindingPattern(name_47)) {
+ addChildrenRecursively(name_47);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
addChildrenRecursively(decl.initializer);
@@ -57372,9 +57934,9 @@ var ts;
addLeafNode(node);
break;
default:
- ts.forEach(node.jsDocComments, function (jsDocComment) {
- ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 284) {
+ ts.forEach(node.jsDoc, function (jsDoc) {
+ ts.forEach(jsDoc.tags, function (tag) {
+ if (tag.kind === 285) {
addLeafNode(tag);
}
});
@@ -57490,7 +58052,7 @@ var ts;
case 185:
case 197:
return getFunctionOrClassName(node);
- case 284:
+ case 285:
return getJSDocTypedefTagName(node);
default:
return undefined;
@@ -57530,7 +58092,7 @@ var ts;
return "()";
case 155:
return "[]";
- case 284:
+ case 285:
return getJSDocTypedefTagName(node);
default:
return "<unknown>";
@@ -57577,7 +58139,7 @@ var ts;
case 230:
case 261:
case 228:
- case 284:
+ case 285:
return true;
case 150:
case 149:
@@ -57790,24 +58352,24 @@ var ts;
switch (n.kind) {
case 204:
if (!ts.isFunctionBlock(n)) {
- var parent_20 = n.parent;
+ var parent_19 = n.parent;
var openBrace = ts.findChildOfKind(n, 16, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17, sourceFile);
- if (parent_20.kind === 209 ||
- parent_20.kind === 212 ||
- parent_20.kind === 213 ||
- parent_20.kind === 211 ||
- parent_20.kind === 208 ||
- parent_20.kind === 210 ||
- parent_20.kind === 217 ||
- parent_20.kind === 256) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ if (parent_19.kind === 209 ||
+ parent_19.kind === 212 ||
+ parent_19.kind === 213 ||
+ parent_19.kind === 211 ||
+ parent_19.kind === 208 ||
+ parent_19.kind === 210 ||
+ parent_19.kind === 217 ||
+ parent_19.kind === 256) {
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_20.kind === 221) {
- var tryStatement = parent_20;
+ if (parent_19.kind === 221) {
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -59421,8 +59983,8 @@ var ts;
if (declaration.kind !== 223 && declaration.kind !== 225) {
return false;
}
- for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) {
- if (parent_21.kind === 261 || parent_21.kind === 231) {
+ for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {
+ if (parent_20.kind === 261 || parent_20.kind === 231) {
return false;
}
}
@@ -59909,7 +60471,7 @@ var ts;
function RuleOperationContext() {
var funcs = [];
for (var _i = 0; _i < arguments.length; _i++) {
- funcs[_i - 0] = arguments[_i];
+ funcs[_i] = arguments[_i];
}
this.customContextChecks = funcs;
}
@@ -60116,9 +60678,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_47 in o) {
- if (o[name_47] === rule) {
- return name_47;
+ for (var name_48 in o) {
+ if (o[name_48] === rule) {
+ return name_48;
}
}
throw new Error("Unknown rule");
@@ -61297,11 +61859,23 @@ var ts;
else {
var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
- if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
+ if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
+ function characterToColumn(startLinePosition, characterInLine) {
+ var column = 0;
+ for (var i = 0; i < characterInLine; i++) {
+ if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) {
+ column += options.tabSize - column % options.tabSize;
+ }
+ else {
+ column++;
+ }
+ }
+ return column;
+ }
function indentationIsDifferent(indentationString, startLinePosition) {
return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
}
@@ -62007,6 +62581,579 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var codefix;
+ (function (codefix) {
+ var ModuleSpecifierComparison;
+ (function (ModuleSpecifierComparison) {
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse";
+ })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {}));
+ var ImportCodeActionMap = (function () {
+ function ImportCodeActionMap() {
+ this.symbolIdToActionMap = ts.createMap();
+ }
+ ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) {
+ if (!newAction) {
+ return;
+ }
+ if (!this.symbolIdToActionMap[symbolId]) {
+ this.symbolIdToActionMap[symbolId] = [newAction];
+ return;
+ }
+ if (newAction.kind === "CodeChange") {
+ this.symbolIdToActionMap[symbolId].push(newAction);
+ return;
+ }
+ var updatedNewImports = [];
+ for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) {
+ var existingAction = _a[_i];
+ if (existingAction.kind === "CodeChange") {
+ updatedNewImports.push(existingAction);
+ continue;
+ }
+ switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) {
+ case ModuleSpecifierComparison.Better:
+ if (newAction.kind === "NewImport") {
+ return;
+ }
+ case ModuleSpecifierComparison.Equal:
+ updatedNewImports.push(existingAction);
+ break;
+ case ModuleSpecifierComparison.Worse:
+ continue;
+ }
+ }
+ updatedNewImports.push(newAction);
+ this.symbolIdToActionMap[symbolId] = updatedNewImports;
+ };
+ ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) {
+ for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) {
+ var newAction = newActions_1[_i];
+ this.addAction(symbolId, newAction);
+ }
+ };
+ ImportCodeActionMap.prototype.getAllActions = function () {
+ var result = [];
+ for (var symbolId in this.symbolIdToActionMap) {
+ result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]);
+ }
+ return result;
+ };
+ ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) {
+ if (moduleSpecifier1 === moduleSpecifier2) {
+ return ModuleSpecifierComparison.Equal;
+ }
+ if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) {
+ return ModuleSpecifierComparison.Better;
+ }
+ if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) {
+ return ModuleSpecifierComparison.Worse;
+ }
+ if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) {
+ var regex = new RegExp(ts.directorySeparator, "g");
+ var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length;
+ var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length;
+ return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Better
+ : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Equal
+ : ModuleSpecifierComparison.Worse;
+ }
+ return ModuleSpecifierComparison.Equal;
+ };
+ return ImportCodeActionMap;
+ }());
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.Cannot_find_name_0.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var checker = context.program.getTypeChecker();
+ var allSourceFiles = context.program.getSourceFiles();
+ var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ var name = token.getText();
+ var symbolIdActionMap = new ImportCodeActionMap();
+ var cachedImportDeclarations = ts.createMap();
+ var cachedNewImportInsertPosition;
+ var allPotentialModules = checker.getAmbientModules();
+ for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) {
+ var otherSourceFile = allSourceFiles_1[_i];
+ if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) {
+ allPotentialModules.push(otherSourceFile.symbol);
+ }
+ }
+ var currentTokenMeaning = ts.getMeaningFromLocation(token);
+ for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) {
+ var moduleSymbol = allPotentialModules_1[_a];
+ context.cancellationToken.throwIfCancellationRequested();
+ var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol);
+ if (defaultExport) {
+ var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
+ if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(localSymbol);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, true));
+ }
+ }
+ var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol);
+ if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol));
+ }
+ }
+ return symbolIdActionMap.getAllActions();
+ function getImportDeclarations(moduleSymbol) {
+ var moduleSymbolId = getUniqueSymbolId(moduleSymbol);
+ if (cachedImportDeclarations[moduleSymbolId]) {
+ return cachedImportDeclarations[moduleSymbolId];
+ }
+ var existingDeclarations = [];
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var importModuleSpecifier = _a[_i];
+ var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier);
+ if (importSymbol === moduleSymbol) {
+ existingDeclarations.push(getImportDeclaration(importModuleSpecifier));
+ }
+ }
+ cachedImportDeclarations[moduleSymbolId] = existingDeclarations;
+ return existingDeclarations;
+ function getImportDeclaration(moduleSpecifier) {
+ var node = moduleSpecifier;
+ while (node) {
+ if (node.kind === 235) {
+ return node;
+ }
+ if (node.kind === 234) {
+ return node;
+ }
+ node = node.parent;
+ }
+ return undefined;
+ }
+ }
+ function getUniqueSymbolId(symbol) {
+ if (symbol.flags & 8388608) {
+ return ts.getSymbolId(checker.getAliasedSymbol(symbol));
+ }
+ return ts.getSymbolId(symbol);
+ }
+ function checkSymbolHasMeaning(symbol, meaning) {
+ var declarations = symbol.getDeclarations();
+ return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false;
+ }
+ function getCodeActionForImport(moduleSymbol, isDefault) {
+ var existingDeclarations = getImportDeclarations(moduleSymbol);
+ if (existingDeclarations.length > 0) {
+ return getCodeActionsForExistingImport(existingDeclarations);
+ }
+ else {
+ return [getCodeActionForNewImport()];
+ }
+ function getCodeActionsForExistingImport(declarations) {
+ var actions = [];
+ var namespaceImportDeclaration;
+ var namedImportDeclaration;
+ var existingModuleSpecifier;
+ for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
+ var declaration = declarations_11[_i];
+ if (declaration.kind === 235) {
+ var namedBindings = declaration.importClause && declaration.importClause.namedBindings;
+ if (namedBindings && namedBindings.kind === 237) {
+ namespaceImportDeclaration = declaration;
+ }
+ else {
+ namedImportDeclaration = declaration;
+ }
+ existingModuleSpecifier = declaration.moduleSpecifier.getText();
+ }
+ else {
+ namespaceImportDeclaration = declaration;
+ existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration);
+ }
+ }
+ if (namespaceImportDeclaration) {
+ actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration));
+ }
+ if (namedImportDeclaration && namedImportDeclaration.importClause &&
+ (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) {
+ var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText());
+ actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes));
+ }
+ else {
+ actions.push(getCodeActionForNewImport(existingModuleSpecifier));
+ }
+ return actions;
+ function getModuleSpecifierFromImportEqualsDeclaration(declaration) {
+ if (declaration.moduleReference && declaration.moduleReference.kind === 245) {
+ return declaration.moduleReference.expression.getText();
+ }
+ return declaration.moduleReference.getText();
+ }
+ function getTextChangeForImportClause(importClause) {
+ var newImportText = isDefault ? "default as " + name : name;
+ var importList = importClause.namedBindings;
+ if (!importList && importClause.name) {
+ var start = importClause.name.getEnd();
+ return {
+ newText: ", { " + newImportText + " }",
+ span: { start: start, length: 0 }
+ };
+ }
+ if (importList.elements.length === 0) {
+ var start = importList.getStart();
+ return {
+ newText: "{ " + newImportText + " }",
+ span: { start: start, length: importList.getEnd() - start }
+ };
+ }
+ var insertPoint = importList.elements[importList.elements.length - 1].getEnd();
+ var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart());
+ var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd());
+ var oneImportPerLine = endLine - startLine > importList.elements.length;
+ return {
+ newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText,
+ span: { start: insertPoint, length: 0 }
+ };
+ }
+ function getCodeActionForNamespaceImport(declaration) {
+ var namespacePrefix;
+ if (declaration.kind === 235) {
+ namespacePrefix = declaration.importClause.namedBindings.name.getText();
+ }
+ else {
+ namespacePrefix = declaration.name.getText();
+ }
+ namespacePrefix = ts.stripQuotes(namespacePrefix);
+ return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange");
+ }
+ }
+ function getCodeActionForNewImport(moduleSpecifier) {
+ if (!cachedNewImportInsertPosition) {
+ var lastModuleSpecifierEnd = -1;
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var moduleSpecifier_1 = _a[_i];
+ var end = moduleSpecifier_1.getEnd();
+ if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) {
+ lastModuleSpecifierEnd = end;
+ }
+ }
+ cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart();
+ }
+ var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport());
+ var importStatementText = isDefault
+ ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\""
+ : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\"";
+ var newText = cachedNewImportInsertPosition === sourceFile.getStart()
+ ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter
+ : "" + context.newLineCharacter + importStatementText + ";";
+ return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes);
+ function getModuleSpecifierForNewImport() {
+ var fileName = sourceFile.path;
+ var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path;
+ var sourceDirectory = ts.getDirectoryPath(fileName);
+ var options = context.program.getCompilerOptions();
+ return tryGetModuleNameFromAmbientModule() ||
+ tryGetModuleNameFromBaseUrl() ||
+ tryGetModuleNameFromRootDirs() ||
+ tryGetModuleNameFromTypeRoots() ||
+ tryGetModuleNameAsNodeModule() ||
+ ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));
+ function tryGetModuleNameFromAmbientModule() {
+ if (moduleSymbol.valueDeclaration.kind !== 261) {
+ return moduleSymbol.name;
+ }
+ }
+ function tryGetModuleNameFromBaseUrl() {
+ if (!options.baseUrl) {
+ return undefined;
+ }
+ var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName);
+ var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl);
+ if (!relativeName) {
+ return undefined;
+ }
+ relativeName = removeExtensionAndIndexPostFix(relativeName);
+ if (options.paths) {
+ for (var key in options.paths) {
+ for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {
+ var pattern = _a[_i];
+ var indexOfStar = pattern.indexOf("*");
+ if (indexOfStar === 0 && pattern.length === 1) {
+ continue;
+ }
+ else if (indexOfStar !== -1) {
+ var prefix = pattern.substr(0, indexOfStar);
+ var suffix = pattern.substr(indexOfStar + 1);
+ if (relativeName.length >= prefix.length + suffix.length &&
+ ts.startsWith(relativeName, prefix) &&
+ ts.endsWith(relativeName, suffix)) {
+ var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
+ return key.replace("\*", matchedStar);
+ }
+ }
+ else if (pattern === relativeName) {
+ return key;
+ }
+ }
+ }
+ }
+ return relativeName;
+ }
+ function tryGetModuleNameFromRootDirs() {
+ if (options.rootDirs) {
+ var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); });
+ var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs);
+ var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs);
+ if (normalizedTargetPath !== undefined) {
+ var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath;
+ return ts.removeFileExtension(relativePath);
+ }
+ }
+ return undefined;
+ }
+ function tryGetModuleNameFromTypeRoots() {
+ var typeRoots = ts.getEffectiveTypeRoots(options, context.host);
+ if (typeRoots) {
+ var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, undefined, getCanonicalFileName); });
+ for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) {
+ var typeRoot = normalizedTypeRoots_1[_i];
+ if (ts.startsWith(moduleFileName, typeRoot)) {
+ var relativeFileName = moduleFileName.substring(typeRoot.length + 1);
+ return removeExtensionAndIndexPostFix(relativeFileName);
+ }
+ }
+ }
+ }
+ function tryGetModuleNameAsNodeModule() {
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
+ return undefined;
+ }
+ var indexOfNodeModules = moduleFileName.indexOf("node_modules");
+ if (indexOfNodeModules < 0) {
+ return undefined;
+ }
+ var relativeFileName;
+ if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) {
+ relativeFileName = moduleFileName.substring(indexOfNodeModules + 13);
+ }
+ else {
+ relativeFileName = getRelativePath(moduleFileName, sourceDirectory);
+ }
+ relativeFileName = ts.removeFileExtension(relativeFileName);
+ if (ts.endsWith(relativeFileName, "/index")) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ else {
+ try {
+ var moduleDirectory = ts.getDirectoryPath(moduleFileName);
+ var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json")));
+ if (packageJsonContent) {
+ var mainFile = packageJsonContent.main || packageJsonContent.typings;
+ if (mainFile) {
+ var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName);
+ if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ }
+ }
+ }
+ catch (e) { }
+ }
+ return relativeFileName;
+ }
+ }
+ function getPathRelativeToRootDirs(path, rootDirs) {
+ for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) {
+ var rootDir = rootDirs_2[_i];
+ var relativeName = tryRemoveParentDirectoryName(path, rootDir);
+ if (relativeName !== undefined) {
+ return relativeName;
+ }
+ }
+ return undefined;
+ }
+ function removeExtensionAndIndexPostFix(fileName) {
+ fileName = ts.removeFileExtension(fileName);
+ if (ts.endsWith(fileName, "/index")) {
+ fileName = fileName.substr(0, fileName.length - 6);
+ }
+ return fileName;
+ }
+ function getRelativePath(path, directoryPath) {
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
+ return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath;
+ }
+ function tryRemoveParentDirectoryName(path, parentDirectory) {
+ var index = path.indexOf(parentDirectory);
+ if (index === 0) {
+ return ts.endsWith(parentDirectory, ts.directorySeparator)
+ ? path.substring(parentDirectory.length)
+ : path.substring(parentDirectory.length + 1);
+ }
+ return undefined;
+ }
+ }
+ }
+ function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) {
+ return {
+ description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)),
+ changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }],
+ kind: kind,
+ moduleSpecifier: moduleSpecifier
+ };
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ codefix.registerCodeFix({
+ errorCodes: [
+ ts.Diagnostics._0_is_declared_but_never_used.code,
+ ts.Diagnostics.Property_0_is_declared_but_never_used.code
+ ],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var start = context.span.start;
+ var token = ts.getTokenAtPosition(sourceFile, start);
+ if (token.kind === 20) {
+ token = ts.getTokenAtPosition(sourceFile, start + 1);
+ }
+ switch (token.kind) {
+ case 70:
+ switch (token.parent.kind) {
+ case 223:
+ switch (token.parent.parent.parent.kind) {
+ case 211:
+ var forStatement = token.parent.parent.parent;
+ var forInitializer = forStatement.initializer;
+ if (forInitializer.declarations.length === 1) {
+ return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
+ }
+ else {
+ return removeSingleItem(forInitializer.declarations, token);
+ }
+ case 213:
+ var forOfStatement = token.parent.parent.parent;
+ if (forOfStatement.initializer.kind === 224) {
+ var forOfInitializer = forOfStatement.initializer;
+ return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
+ }
+ break;
+ case 212:
+ return undefined;
+ case 256:
+ var catchClause = token.parent.parent;
+ var parameter = catchClause.variableDeclaration.getChildren()[0];
+ return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
+ default:
+ var variableStatement = token.parent.parent.parent;
+ if (variableStatement.declarationList.declarations.length === 1) {
+ return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
+ }
+ else {
+ var declarations = variableStatement.declarationList.declarations;
+ return removeSingleItem(declarations, token);
+ }
+ }
+ case 143:
+ var typeParameters = token.parent.parent.typeParameters;
+ if (typeParameters.length === 1) {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
+ }
+ else {
+ return removeSingleItem(typeParameters, token);
+ }
+ case 144:
+ var functionDeclaration = token.parent.parent;
+ if (functionDeclaration.parameters.length === 1) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else {
+ return removeSingleItem(functionDeclaration.parameters, token);
+ }
+ case 234:
+ var importEquals = findImportDeclaration(token);
+ return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
+ case 239:
+ var namedImports = token.parent.parent;
+ if (namedImports.elements.length === 1) {
+ var importSpec = findImportDeclaration(token);
+ return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
+ }
+ else {
+ return removeSingleItem(namedImports.elements, token);
+ }
+ case 236:
+ var importClause = token.parent;
+ if (!importClause.namedBindings) {
+ var importDecl = findImportDeclaration(importClause);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
+ }
+ case 237:
+ var namespaceImport = token.parent;
+ if (namespaceImport.name == token && !namespaceImport.parent.name) {
+ var importDecl = findImportDeclaration(namespaceImport);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ var start_4 = namespaceImport.parent.name.end;
+ return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4);
+ }
+ }
+ break;
+ case 147:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ case 237:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ if (ts.isDeclarationName(token)) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else if (ts.isLiteralComputedPropertyDeclarationName(token)) {
+ return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
+ }
+ else {
+ return undefined;
+ }
+ function findImportDeclaration(token) {
+ var importDecl = token;
+ while (importDecl.kind != 235 && importDecl.parent) {
+ importDecl = importDecl.parent;
+ }
+ return importDecl;
+ }
+ function createCodeFix(newText, start, length) {
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers),
+ changes: [{
+ fileName: sourceFile.fileName,
+ textChanges: [{ newText: newText, span: { start: start, length: length } }]
+ }]
+ }];
+ }
+ function removeSingleItem(elements, token) {
+ if (elements[0] === token.parent) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
+ }
+ else {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
+ }
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
ts.servicesVersion = "0.5";
function createNode(kind, pos, end, parent) {
var node = kind >= 141 ? new NodeObject(kind, pos, end) :
@@ -62067,11 +63214,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(291, nodes.pos, nodes.end, this);
+ var list = createNode(292, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
- var node = nodes_5[_i];
+ for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
+ var node = nodes_7[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -62090,7 +63237,7 @@ var ts;
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 290;
+ var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -62108,8 +63255,8 @@ var ts;
children.push(_this.createSyntaxList(nodes));
pos_3 = nodes.end;
};
- if (this.jsDocComments) {
- for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
+ if (this.jsDoc) {
+ for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
processNode(jsDocComment);
}
@@ -62329,6 +63476,19 @@ var ts;
SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
return ts.getPositionOfLineAndCharacter(this, line, character);
};
+ SourceFileObject.prototype.getLineEndOfPosition = function (pos) {
+ var line = this.getLineAndCharacterOfPosition(pos).line;
+ var lineStarts = this.getLineStarts();
+ var lastCharPos;
+ if (line + 1 >= lineStarts.length) {
+ lastCharPos = this.getEnd();
+ }
+ if (!lastCharPos) {
+ lastCharPos = lineStarts[line + 1] - 1;
+ }
+ var fullText = this.getFullText();
+ return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos;
+ };
SourceFileObject.prototype.getNamedDeclarations = function () {
if (!this.namedDeclarations) {
this.namedDeclarations = this.computeNamedDeclarations();
@@ -62350,9 +63510,9 @@ var ts;
}
function getDeclarationName(declaration) {
if (declaration.name) {
- var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
- if (result_6 !== undefined) {
- return result_6;
+ var result_7 = getTextOfIdentifierOrLiteral(declaration.name);
+ if (result_7 !== undefined) {
+ return result_7;
}
if (declaration.name.kind === 142) {
var expr = declaration.name.expression;
@@ -63179,7 +64339,9 @@ var ts;
sourceFile: sourceFile,
span: span,
program: program,
- newLineCharacter: newLineChar
+ newLineCharacter: newLineChar,
+ host: host,
+ cancellationToken: cancellationToken
};
var fixes = ts.codefix.getFixes(context);
if (fixes) {
@@ -63344,10 +64506,10 @@ var ts;
break;
default:
ts.forEachChild(node, walk);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- ts.forEachChild(jsDocComment, walk);
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ ts.forEachChild(jsDoc, walk);
}
}
}
@@ -63544,7 +64706,7 @@ var ts;
this.trace = function (s) { return host.trace(s); };
}
this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) {
- var globalCache = _this.project.getTypingOptions().enableAutoDiscovery
+ var globalCache = _this.project.getTypeAcquisition().enable
? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation
: undefined;
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host);
@@ -63576,15 +64738,15 @@ var ts;
var compilerOptions = this.getCompilationSettings();
var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName;
for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name_48 = names_2[_i];
- var resolution = newResolutions[name_48];
+ var name_49 = names_2[_i];
+ var resolution = newResolutions[name_49];
if (!resolution) {
- var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_48];
+ var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_49];
if (moduleResolutionIsValid(existingResolution)) {
resolution = existingResolution;
}
else {
- newResolutions[name_48] = resolution = loader(name_48, containingFile, compilerOptions, this);
+ newResolutions[name_49] = resolution = loader(name_49, containingFile, compilerOptions, this);
}
if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
this.filesWithChangedSetOfUnresolvedImports.push(path);
@@ -63746,8 +64908,8 @@ var ts;
}
return unique === 0;
}
- function typingOptionsChanged(opt1, opt2) {
- return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery ||
+ function typeAcquisitionChanged(opt1, opt2) {
+ return opt1.enable !== opt2.enable ||
!setIsEqualTo(opt1.include, opt2.include) ||
!setIsEqualTo(opt1.exclude, opt2.exclude);
}
@@ -63766,32 +64928,32 @@ var ts;
this.perProjectCache = ts.createMap();
}
TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) {
- var typingOptions = project.getTypingOptions();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ var typeAcquisition = project.getTypeAcquisition();
+ if (!typeAcquisition || !typeAcquisition.enable) {
return server.emptyArray;
}
var entry = this.perProjectCache[project.getProjectName()];
var result = entry ? entry.typings : server.emptyArray;
if (forceRefresh ||
!entry ||
- typingOptionsChanged(typingOptions, entry.typingOptions) ||
+ typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) ||
compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) ||
unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {
this.perProjectCache[project.getProjectName()] = {
compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
typings: result,
unresolvedImports: unresolvedImports,
poisoned: true
};
- this.installer.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports);
+ this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
}
return result;
};
- TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, unresolvedImports, newTypings) {
+ TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
this.perProjectCache[projectName] = {
compilerOptions: compilerOptions,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
typings: server.toSortedReadonlyArray(newTypings),
unresolvedImports: unresolvedImports,
poisoned: false
@@ -64289,7 +65451,8 @@ var ts;
}
server.createNoSemanticFeaturesWrapper = createNoSemanticFeaturesWrapper;
var Project = (function () {
- function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ this.projectName = projectName;
this.projectKind = projectKind;
this.projectService = projectService;
this.documentRegistry = documentRegistry;
@@ -64372,6 +65535,9 @@ var ts;
this.languageServiceEnabled = false;
this.projectService.onUpdateLanguageServiceStateForProject(this, false);
};
+ Project.prototype.getProjectName = function () {
+ return this.projectName;
+ };
Project.prototype.getSourceFile = function (path) {
if (!this.program) {
return undefined;
@@ -64529,9 +65695,9 @@ var ts;
}
var unresolvedImports;
if (file.resolvedModules) {
- for (var name_49 in file.resolvedModules) {
- if (!file.resolvedModules[name_49] && !ts.isExternalModuleNameRelative(name_49)) {
- var trimmed = name_49.trim();
+ for (var name_50 in file.resolvedModules) {
+ if (!file.resolvedModules[name_50] && !ts.isExternalModuleNameRelative(name_50)) {
+ var trimmed = name_50.trim();
var i = trimmed.indexOf("/");
if (i !== -1 && trimmed.charCodeAt(0) === 64) {
i = trimmed.indexOf("/", i + 1);
@@ -64753,15 +65919,10 @@ var ts;
var InferredProject = (function (_super) {
__extends(InferredProject, _super);
function InferredProject(projectService, documentRegistry, compilerOptions) {
- var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this;
+ var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this;
_this.directoriesWatchedForTsconfig = [];
- _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId);
- InferredProject.NextId++;
return _this;
}
- InferredProject.prototype.getProjectName = function () {
- return this.inferredProjectName;
- };
InferredProject.prototype.getProjectRootPath = function () {
if (this.projectService.useSingleInferredProject) {
return undefined;
@@ -64776,45 +65937,52 @@ var ts;
this.projectService.stopWatchingDirectory(directory);
}
};
- InferredProject.prototype.getTypingOptions = function () {
+ InferredProject.prototype.getTypeAcquisition = function () {
return {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ enable: allRootFilesAreJsOrDts(this),
include: [],
exclude: []
};
};
return InferredProject;
}(Project));
- InferredProject.NextId = 1;
+ InferredProject.newName = (function () {
+ var nextId = 1;
+ return function () {
+ var id = nextId;
+ nextId++;
+ return server.makeInferredProjectName(id);
+ };
+ })();
server.InferredProject = InferredProject;
var ConfiguredProject = (function (_super) {
__extends(ConfiguredProject, _super);
function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) {
- var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.configFileName = configFileName;
+ var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
_this.wildcardDirectories = wildcardDirectories;
_this.compileOnSaveEnabled = compileOnSaveEnabled;
_this.openRefCount = 0;
+ _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName));
return _this;
}
+ ConfiguredProject.prototype.getConfigFilePath = function () {
+ return this.getProjectName();
+ };
ConfiguredProject.prototype.getProjectRootPath = function () {
- return ts.getDirectoryPath(this.configFileName);
+ return ts.getDirectoryPath(this.getConfigFilePath());
};
ConfiguredProject.prototype.setProjectErrors = function (projectErrors) {
this.projectErrors = projectErrors;
};
- ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) {
- this.typingOptions = newTypingOptions;
- };
- ConfiguredProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
+ ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {
+ this.typeAcquisition = newTypeAcquisition;
};
- ConfiguredProject.prototype.getProjectName = function () {
- return this.configFileName;
+ ConfiguredProject.prototype.getTypeAcquisition = function () {
+ return this.typeAcquisition;
};
ConfiguredProject.prototype.watchConfigFile = function (callback) {
var _this = this;
- this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); });
+ this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); });
};
ConfiguredProject.prototype.watchTypeRoots = function (callback) {
var _this = this;
@@ -64832,7 +66000,7 @@ var ts;
if (this.directoryWatcher) {
return;
}
- var directoryToWatch = ts.getDirectoryPath(this.configFileName);
+ var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath());
this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch);
this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true);
};
@@ -64841,7 +66009,7 @@ var ts;
if (!this.wildcardDirectories) {
return;
}
- var configDirectoryPath = ts.getDirectoryPath(this.configFileName);
+ var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath());
this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) {
if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) {
var recursive = (flag & 1) !== 0;
@@ -64891,8 +66059,7 @@ var ts;
var ExternalProject = (function (_super) {
__extends(ExternalProject, _super);
function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) {
- var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.externalProjectName = externalProjectName;
+ var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
_this.compileOnSaveEnabled = compileOnSaveEnabled;
_this.projectFilePath = projectFilePath;
return _this;
@@ -64901,37 +66068,34 @@ var ts;
if (this.projectFilePath) {
return ts.getDirectoryPath(this.projectFilePath);
}
- return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName));
+ return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName()));
};
- ExternalProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
+ ExternalProject.prototype.getTypeAcquisition = function () {
+ return this.typeAcquisition;
};
ExternalProject.prototype.setProjectErrors = function (projectErrors) {
this.projectErrors = projectErrors;
};
- ExternalProject.prototype.setTypingOptions = function (newTypingOptions) {
- if (!newTypingOptions) {
- newTypingOptions = {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {
+ if (!newTypeAcquisition) {
+ newTypeAcquisition = {
+ enable: allRootFilesAreJsOrDts(this),
include: [],
exclude: []
};
}
else {
- if (newTypingOptions.enableAutoDiscovery === undefined) {
- newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this);
+ if (newTypeAcquisition.enable === undefined) {
+ newTypeAcquisition.enable = allRootFilesAreJsOrDts(this);
}
- if (!newTypingOptions.include) {
- newTypingOptions.include = [];
+ if (!newTypeAcquisition.include) {
+ newTypeAcquisition.include = [];
}
- if (!newTypingOptions.exclude) {
- newTypingOptions.exclude = [];
+ if (!newTypeAcquisition.exclude) {
+ newTypeAcquisition.exclude = [];
}
}
- this.typingOptions = newTypingOptions;
- };
- ExternalProject.prototype.getProjectName = function () {
- return this.externalProjectName;
+ this.typeAcquisition = newTypeAcquisition;
};
return ExternalProject;
}(Project));
@@ -65123,7 +66287,7 @@ var ts;
}
switch (response.kind) {
case server.ActionSet:
- this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.unresolvedImports, response.typings);
+ this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings);
break;
case server.ActionInvalidate:
this.typingsCache.deleteTypingsForProject(response.projectName);
@@ -65252,7 +66416,7 @@ var ts;
ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) {
var _this = this;
this.logger.info("Type root file " + fileName + " changed");
- this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () {
+ this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () {
project.updateTypes();
_this.updateConfiguredProject(project);
_this.refreshInferredProjects();
@@ -65264,11 +66428,11 @@ var ts;
return;
}
this.logger.info("Detected source file changes: " + fileName);
- this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });
+ this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });
};
ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) {
var _this = this;
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile);
var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));
var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));
@@ -65279,8 +66443,10 @@ var ts;
}
};
ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) {
- this.logger.info("Config file changed: " + project.configFileName);
- this.updateConfiguredProject(project);
+ var configFileName = project.getConfigFilePath();
+ this.logger.info("Config file changed: " + configFileName);
+ var configFileErrors = this.updateConfiguredProject(project);
+ this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName);
this.refreshInferredProjects();
};
ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) {
@@ -65466,7 +66632,13 @@ var ts;
}
};
ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) {
- return findProjectByName(configFileName, this.configuredProjects);
+ configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName));
+ for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) {
+ var proj = _a[_i];
+ if (proj.canonicalConfigFilePath === configFileName) {
+ return proj;
+ }
+ }
};
ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) {
return findProjectByName(projectFileName, this.externalProjects);
@@ -65496,7 +66668,7 @@ var ts;
compilerOptions: parsedCommandLine.options,
configHasFilesProperty: config["files"] !== undefined,
wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories),
- typingOptions: parsedCommandLine.typingOptions,
+ typeAcquisition: parsedCommandLine.typeAcquisition,
compileOnSave: parsedCommandLine.compileOnSave
};
return { success: true, projectOptions: projectOptions, configFileErrors: errors };
@@ -65519,10 +66691,10 @@ var ts;
}
return false;
};
- ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
+ ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) {
var compilerOptions = convertCompilerOptions(options);
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
+ this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined);
this.externalProjects.push(project);
return project;
};
@@ -65539,7 +66711,7 @@ var ts;
var _this = this;
var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);
var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors);
+ this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); });
if (!sizeLimitExceeded) {
this.watchConfigDirectoryForProject(project, projectOptions);
@@ -65555,7 +66727,7 @@ var ts;
project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
}
};
- ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) {
+ ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) {
var errors;
for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
var f = files_4[_i];
@@ -65571,7 +66743,7 @@ var ts;
}
}
project.setProjectErrors(ts.concatenate(configFileErrors, errors));
- project.setTypingOptions(typingOptions);
+ project.setTypeAcquisition(typeAcquisition);
project.updateGraph();
};
ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) {
@@ -65586,7 +66758,7 @@ var ts;
errors: project.getProjectErrors()
};
};
- ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) {
+ ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) {
var oldRootScriptInfos = project.getRootScriptInfos();
var newRootScriptInfos = [];
var newRootScriptInfoMap = server.createNormalizedPathMap();
@@ -65648,7 +66820,7 @@ var ts;
}
}
project.setCompilerOptions(newOptions);
- project.setTypingOptions(newTypingOptions);
+ project.setTypeAcquisition(newTypeAcquisition);
if (compileOnSave !== undefined) {
project.compileOnSaveEnabled = compileOnSave;
}
@@ -65656,12 +66828,12 @@ var ts;
project.updateGraph();
};
ProjectService.prototype.updateConfiguredProject = function (project) {
- if (!this.host.fileExists(project.configFileName)) {
+ if (!this.host.fileExists(project.getConfigFilePath())) {
this.logger.info("Config file deleted");
this.removeProject(project);
return;
}
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
if (!success) {
this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors);
return configFileErrors;
@@ -65669,7 +66841,7 @@ var ts;
if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) {
project.setCompilerOptions(projectOptions.compilerOptions);
if (!project.languageServiceEnabled) {
- return;
+ return configFileErrors;
}
project.disableLanguageService();
project.stopWatchingDirectory();
@@ -65679,8 +66851,9 @@ var ts;
project.enableLanguageService();
}
this.watchConfigDirectoryForProject(project, projectOptions);
- this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors);
+ this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors);
}
+ return configFileErrors;
};
ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) {
var _this = this;
@@ -65910,6 +67083,10 @@ var ts;
}
};
ProjectService.prototype.openExternalProject = function (proj) {
+ if (proj.typingOptions && !proj.typeAcquisition) {
+ var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions);
+ proj.typeAcquisition = typeAcquisition;
+ }
var tsConfigFiles;
var rootFiles = [];
for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) {
@@ -65931,7 +67108,7 @@ var ts;
var exisingConfigFiles;
if (externalProject) {
if (!tsConfigFiles) {
- this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined);
+ this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, undefined);
return;
}
this.closeExternalProject(proj.projectFileName, true);
@@ -65981,7 +67158,7 @@ var ts;
}
else {
delete this.externalProjectToConfiguredProjectMap[proj.projectFileName];
- this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions);
+ this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition);
}
this.refreshInferredProjects();
};
@@ -67059,9 +68236,9 @@ var ts;
if (simplifiedResult) {
return completions.entries.reduce(function (result, entry) {
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
- var name_50 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
+ var name_51 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined;
- result.push({ name: name_50, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
+ result.push({ name: name_51, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
}
return result;
}, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });
@@ -68324,6 +69501,7 @@ var ts;
os.tmpdir();
break;
case "linux":
+ case "android":
basePath = (os.homedir && os.homedir()) ||
process.env.HOME ||
((process.env.LOGNAME || process.env.USER) && "/home/" + (process.env.LOGNAME || process.env.USER)) ||
@@ -68486,9 +69664,9 @@ var ts;
NodeTypingsInstaller.prototype.onProjectClosed = function (p) {
this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" });
};
- NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typingOptions, unresolvedImports) {
+ NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typeAcquisition, unresolvedImports) {
var _this = this;
- var request = server.createInstallTypingsRequest(project, typingOptions, unresolvedImports);
+ var request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
if (this.logger.hasLevel(server.LogLevel.verbose)) {
if (this.logger.hasLevel(server.LogLevel.verbose)) {
this.logger.info("Scheduling throttled operation: " + JSON.stringify(request));
@@ -68511,7 +69689,8 @@ var ts;
telemetryEventName: "typingsInstalled",
payload: {
installedPackages: response.packagesToInstall.join(","),
- installSuccess: response.installSuccess
+ installSuccess: response.installSuccess,
+ typingsInstallerVersion: response.typingsInstallerVersion
}
};
var eventName = "telemetry";
@@ -68723,6 +69902,10 @@ var ts;
eventPort = v;
}
}
+ var localeStr = server.findArgument("--locale");
+ if (localeStr) {
+ ts.validateLocaleAndSetLanguage(localeStr, sys);
+ }
var useSingleInferredProject = server.hasArgument("--useSingleInferredProject");
var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition");
var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry);
@@ -69331,7 +70514,7 @@ var ts;
if (result.error) {
return {
options: {},
- typingOptions: {},
+ typeAcquisition: {},
files: [],
raw: {},
errors: [realizeDiagnostic(result.error, "\r\n")]
@@ -69341,7 +70524,7 @@ var ts;
var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName);
return {
options: configFile.options,
- typingOptions: configFile.typingOptions,
+ typeAcquisition: configFile.typeAcquisition,
files: configFile.fileNames,
raw: configFile.raw,
errors: realizeDiagnostics(configFile.errors, "\r\n")
@@ -69356,7 +70539,7 @@ var ts;
var getCanonicalFileName = ts.createGetCanonicalFileName(false);
return this.forwardJSONCall("discoverTypings()", function () {
var info = JSON.parse(discoverTypingsJson);
- return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports);
+ return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);
});
};
return CoreServicesShimObject;
diff --git a/node_modules/typescript/lib/tsserverlibrary.d.ts b/node_modules/typescript/lib/tsserverlibrary.d.ts
index 16d810866..3f46cb68b 100644
--- a/node_modules/typescript/lib/tsserverlibrary.d.ts
+++ b/node_modules/typescript/lib/tsserverlibrary.d.ts
@@ -318,7 +318,8 @@ declare namespace ts.server.protocol {
projectFileName: string;
rootFiles: ExternalFile[];
options: ExternalProjectCompilerOptions;
- typingOptions?: TypingOptions;
+ typingOptions?: TypeAcquisition;
+ typeAcquisition?: TypeAcquisition;
}
interface CompileOnSaveMixin {
compileOnSave?: boolean;
@@ -715,6 +716,7 @@ declare namespace ts.server.protocol {
interface TypingsInstalledTelemetryEventPayload {
installedPackages: string;
installSuccess: boolean;
+ typingsInstallerVersion: string;
}
interface NavBarResponse extends Response {
body?: NavigationBarItem[];
@@ -1148,23 +1150,25 @@ declare namespace ts {
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
- JSDocParameterTag = 280,
- JSDocReturnTag = 281,
- JSDocTypeTag = 282,
- JSDocTemplateTag = 283,
- JSDocTypedefTag = 284,
- JSDocPropertyTag = 285,
- JSDocTypeLiteral = 286,
- JSDocLiteralType = 287,
- JSDocNullKeyword = 288,
- JSDocUndefinedKeyword = 289,
- JSDocNeverKeyword = 290,
- SyntaxList = 291,
- NotEmittedStatement = 292,
- PartiallyEmittedExpression = 293,
- MergeDeclarationMarker = 294,
- EndOfDeclarationMarker = 295,
- Count = 296,
+ JSDocAugmentsTag = 280,
+ JSDocParameterTag = 281,
+ JSDocReturnTag = 282,
+ JSDocTypeTag = 283,
+ JSDocTemplateTag = 284,
+ JSDocTypedefTag = 285,
+ JSDocPropertyTag = 286,
+ JSDocTypeLiteral = 287,
+ JSDocLiteralType = 288,
+ JSDocNullKeyword = 289,
+ JSDocUndefinedKeyword = 290,
+ JSDocNeverKeyword = 291,
+ SyntaxList = 292,
+ NotEmittedStatement = 293,
+ PartiallyEmittedExpression = 294,
+ MergeDeclarationMarker = 295,
+ EndOfDeclarationMarker = 296,
+ RawExpression = 297,
+ Count = 298,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -1191,9 +1195,9 @@ declare namespace ts {
LastBinaryOperator = 69,
FirstNode = 141,
FirstJSDocNode = 262,
- LastJSDocNode = 287,
+ LastJSDocNode = 288,
FirstJSDocTagNode = 278,
- LastJSDocTagNode = 290,
+ LastJSDocTagNode = 291,
}
const enum NodeFlags {
None = 0,
@@ -1270,7 +1274,8 @@ declare namespace ts {
parent?: Node;
original?: Node;
startsOnNewLine?: boolean;
- jsDocComments?: JSDoc[];
+ jsDoc?: JSDoc[];
+ jsDocCache?: (JSDoc | JSDocTag)[];
symbol?: Symbol;
locals?: SymbolTable;
nextContainer?: Node;
@@ -1280,6 +1285,7 @@ declare namespace ts {
}
interface NodeArray<T extends Node> extends Array<T>, TextRange {
hasTrailingComma?: boolean;
+ transformFlags?: TransformFlags;
}
interface Token<TKind extends SyntaxKind> extends Node {
kind: TKind;
@@ -1322,14 +1328,14 @@ declare namespace ts {
right: Identifier;
}
type EntityName = Identifier | QualifiedName;
- type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
- type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
+ type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
+ type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
interface Declaration extends Node {
_declarationBrand: any;
name?: DeclarationName;
}
interface DeclarationStatement extends Declaration, Statement {
- name?: Identifier | LiteralExpression;
+ name?: Identifier | StringLiteral | NumericLiteral;
}
interface ComputedPropertyName extends Node {
kind: SyntaxKind.ComputedPropertyName;
@@ -1431,18 +1437,16 @@ declare namespace ts {
interface PropertyLikeDeclaration extends Declaration {
name: PropertyName;
}
- interface BindingPattern extends Node {
- elements: NodeArray<BindingElement | ArrayBindingElement>;
- }
- interface ObjectBindingPattern extends BindingPattern {
+ interface ObjectBindingPattern extends Node {
kind: SyntaxKind.ObjectBindingPattern;
elements: NodeArray<BindingElement>;
}
- type ArrayBindingElement = BindingElement | OmittedExpression;
- interface ArrayBindingPattern extends BindingPattern {
+ interface ArrayBindingPattern extends Node {
kind: SyntaxKind.ArrayBindingPattern;
elements: NodeArray<ArrayBindingElement>;
}
+ type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
+ type ArrayBindingElement = BindingElement | OmittedExpression;
interface FunctionLikeDeclaration extends SignatureDeclaration {
_functionLikeDeclarationBrand: any;
asteriskToken?: AsteriskToken;
@@ -1565,7 +1569,7 @@ declare namespace ts {
}
interface StringLiteral extends LiteralExpression {
kind: SyntaxKind.StringLiteral;
- textSourceNode?: Identifier | StringLiteral;
+ textSourceNode?: Identifier | StringLiteral | NumericLiteral;
}
interface Expression extends Node {
_expressionBrand: any;
@@ -1664,17 +1668,25 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
- interface AssignmentExpression extends BinaryExpression {
+ type AssignmentOperatorToken = Token<AssignmentOperator>;
+ interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
left: LeftHandSideExpression;
- operatorToken: Token<SyntaxKind.EqualsToken>;
+ operatorToken: TOperator;
}
- interface ObjectDestructuringAssignment extends AssignmentExpression {
+ interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ObjectLiteralExpression;
}
- interface ArrayDestructuringAssignment extends AssignmentExpression {
+ interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ArrayLiteralExpression;
}
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
+ type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
+ type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
+ type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
+ type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
+ type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
+ type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
+ type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -1867,6 +1879,10 @@ declare namespace ts {
interface EndOfDeclarationMarker extends Statement {
kind: SyntaxKind.EndOfDeclarationMarker;
}
+ interface RawExpression extends PrimaryExpression {
+ kind: SyntaxKind.RawExpression;
+ text: string;
+ }
interface MergeDeclarationMarker extends Statement {
kind: SyntaxKind.MergeDeclarationMarker;
}
@@ -1894,6 +1910,9 @@ declare namespace ts {
kind: SyntaxKind.ExpressionStatement;
expression: Expression;
}
+ interface PrologueDirective extends ExpressionStatement {
+ expression: StringLiteral;
+ }
interface IfStatement extends Statement {
kind: SyntaxKind.IfStatement;
expression: Expression;
@@ -2041,7 +2060,7 @@ declare namespace ts {
type ModuleName = Identifier | StringLiteral;
interface ModuleDeclaration extends DeclarationStatement {
kind: SyntaxKind.ModuleDeclaration;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral;
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
}
interface NamespaceDeclaration extends ModuleDeclaration {
@@ -2193,7 +2212,7 @@ declare namespace ts {
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
kind: SyntaxKind.JSDocRecordMember;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral | NumericLiteral;
type?: JSDocType;
}
interface JSDoc extends Node {
@@ -2209,6 +2228,10 @@ declare namespace ts {
interface JSDocUnknownTag extends JSDocTag {
kind: SyntaxKind.JSDocTag;
}
+ interface JSDocAugmentsTag extends JSDocTag {
+ kind: SyntaxKind.JSDocAugmentsTag;
+ typeExpression: JSDocTypeExpression;
+ }
interface JSDocTemplateTag extends JSDocTag {
kind: SyntaxKind.JSDocTemplateTag;
typeParameters: NodeArray<TypeParameterDeclaration>;
@@ -2332,7 +2355,6 @@ declare namespace ts {
moduleAugmentations: LiteralExpression[];
patternAmbientModules?: PatternAmbientModule[];
ambientModuleNames: string[];
- externalHelpersModuleName?: Identifier;
}
interface ScriptReferenceHost {
getCompilerOptions(): CompilerOptions;
@@ -2453,6 +2475,7 @@ declare namespace ts {
getJsxIntrinsicTagNames(): Symbol[];
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
+ tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol;
getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
getGlobalDiagnostics(): Diagnostic[];
@@ -2777,7 +2800,7 @@ declare namespace ts {
PossiblyFalsy = 7406,
Intrinsic = 16015,
Primitive = 8190,
- StringLike = 34,
+ StringLike = 262178,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
@@ -2896,7 +2919,6 @@ declare namespace ts {
mapper?: TypeMapper;
resolvedApparentType: Type;
resolvedIndexType: IndexType;
- resolvedIndexedAccessTypes: IndexedAccessType[];
isThisType?: boolean;
}
interface IndexType extends Type {
@@ -2904,7 +2926,7 @@ declare namespace ts {
}
interface IndexedAccessType extends Type {
objectType: Type;
- indexType: TypeParameter;
+ indexType: Type;
}
const enum SignatureKind {
Call = 0,
@@ -3071,8 +3093,9 @@ declare namespace ts {
watch?: boolean;
[option: string]: CompilerOptionsValue | undefined;
}
- interface TypingOptions {
+ interface TypeAcquisition {
enableAutoDiscovery?: boolean;
+ enable?: boolean;
include?: string[];
exclude?: string[];
[option: string]: string[] | boolean | undefined;
@@ -3082,7 +3105,7 @@ declare namespace ts {
projectRootPath: string;
safeListPath: string;
packageNameToTypingLocation: Map<string>;
- typingOptions: TypingOptions;
+ typeAcquisition: TypeAcquisition;
compilerOptions: CompilerOptions;
unresolvedImports: ReadonlyArray<string>;
}
@@ -3133,7 +3156,7 @@ declare namespace ts {
}
interface ParsedCommandLine {
options: CompilerOptions;
- typingOptions?: TypingOptions;
+ typeAcquisition?: TypeAcquisition;
fileNames: string[];
raw?: any;
errors: Diagnostic[];
@@ -3354,95 +3377,100 @@ declare namespace ts {
None = 0,
TypeScript = 1,
ContainsTypeScript = 2,
- Jsx = 4,
- ContainsJsx = 8,
- ESNext = 16,
- ContainsESNext = 32,
- ES2017 = 64,
- ContainsES2017 = 128,
- ES2016 = 256,
- ContainsES2016 = 512,
- ES2015 = 1024,
- ContainsES2015 = 2048,
- Generator = 4096,
- ContainsGenerator = 8192,
- DestructuringAssignment = 16384,
- ContainsDestructuringAssignment = 32768,
- ContainsDecorators = 65536,
- ContainsPropertyInitializer = 131072,
- ContainsLexicalThis = 262144,
- ContainsCapturedLexicalThis = 524288,
- ContainsLexicalThisInComputedPropertyName = 1048576,
- ContainsDefaultValueAssignments = 2097152,
- ContainsParameterPropertyAssignments = 4194304,
- ContainsSpreadExpression = 8388608,
- ContainsComputedPropertyName = 16777216,
- ContainsBlockScopedBinding = 33554432,
- ContainsBindingPattern = 67108864,
- ContainsYield = 134217728,
- ContainsHoistedDeclarationOrCompletion = 268435456,
+ ContainsJsx = 4,
+ ContainsESNext = 8,
+ ContainsES2017 = 16,
+ ContainsES2016 = 32,
+ ES2015 = 64,
+ ContainsES2015 = 128,
+ Generator = 256,
+ ContainsGenerator = 512,
+ DestructuringAssignment = 1024,
+ ContainsDestructuringAssignment = 2048,
+ ContainsDecorators = 4096,
+ ContainsPropertyInitializer = 8192,
+ ContainsLexicalThis = 16384,
+ ContainsCapturedLexicalThis = 32768,
+ ContainsLexicalThisInComputedPropertyName = 65536,
+ ContainsDefaultValueAssignments = 131072,
+ ContainsParameterPropertyAssignments = 262144,
+ ContainsSpread = 524288,
+ ContainsObjectSpread = 1048576,
+ ContainsRest = 524288,
+ ContainsObjectRest = 1048576,
+ ContainsComputedPropertyName = 2097152,
+ ContainsBlockScopedBinding = 4194304,
+ ContainsBindingPattern = 8388608,
+ ContainsYield = 16777216,
+ ContainsHoistedDeclarationOrCompletion = 33554432,
HasComputedFlags = 536870912,
AssertTypeScript = 3,
- AssertJsx = 12,
- AssertESNext = 48,
- AssertES2017 = 192,
- AssertES2016 = 768,
- AssertES2015 = 3072,
- AssertGenerator = 12288,
- AssertDestructuringAssignment = 49152,
- NodeExcludes = 536892757,
- ArrowFunctionExcludes = 979719509,
- FunctionExcludes = 980243797,
- ConstructorExcludes = 975983957,
- MethodOrAccessorExcludes = 975983957,
- ClassExcludes = 559895893,
- ModuleExcludes = 839734613,
+ AssertJsx = 4,
+ AssertESNext = 8,
+ AssertES2017 = 16,
+ AssertES2016 = 32,
+ AssertES2015 = 192,
+ AssertGenerator = 768,
+ AssertDestructuringAssignment = 3072,
+ NodeExcludes = 536872257,
+ ArrowFunctionExcludes = 601249089,
+ FunctionExcludes = 601281857,
+ ConstructorExcludes = 601015617,
+ MethodOrAccessorExcludes = 601015617,
+ ClassExcludes = 539358529,
+ ModuleExcludes = 574674241,
TypeExcludes = -3,
- ObjectLiteralExcludes = 554784085,
- ArrayLiteralOrCallOrNewExcludes = 545281365,
- VariableDeclarationListExcludes = 604001621,
- ParameterExcludes = 604001621,
- TypeScriptClassSyntaxMask = 4390912,
- ES2015FunctionSyntaxMask = 2621440,
+ ObjectLiteralExcludes = 540087617,
+ ArrayLiteralOrCallOrNewExcludes = 537396545,
+ VariableDeclarationListExcludes = 546309441,
+ ParameterExcludes = 536872257,
+ CatchClauseExcludes = 537920833,
+ BindingPatternExcludes = 537396545,
+ TypeScriptClassSyntaxMask = 274432,
+ ES2015FunctionSyntaxMask = 163840,
}
interface EmitNode {
+ annotatedNodes?: Node[];
flags?: EmitFlags;
commentRange?: TextRange;
sourceMapRange?: TextRange;
tokenSourceMapRanges?: Map<TextRange>;
- annotatedNodes?: Node[];
constantValue?: number;
+ externalHelpersModuleName?: Identifier;
+ helpers?: EmitHelper[];
}
const enum EmitFlags {
- EmitEmitHelpers = 1,
- EmitExportStar = 2,
- EmitSuperHelper = 4,
- EmitAdvancedSuperHelper = 8,
- UMDDefine = 16,
- SingleLine = 32,
- AdviseOnEmitNode = 64,
- NoSubstitution = 128,
- CapturesThis = 256,
- NoLeadingSourceMap = 512,
- NoTrailingSourceMap = 1024,
- NoSourceMap = 1536,
- NoNestedSourceMaps = 2048,
- NoTokenLeadingSourceMaps = 4096,
- NoTokenTrailingSourceMaps = 8192,
- NoTokenSourceMaps = 12288,
- NoLeadingComments = 16384,
- NoTrailingComments = 32768,
- NoComments = 49152,
- NoNestedComments = 65536,
- ExportName = 131072,
- LocalName = 262144,
- Indented = 524288,
- NoIndentation = 1048576,
- AsyncFunctionBody = 2097152,
- ReuseTempVariableScope = 4194304,
- CustomPrologue = 8388608,
- NoHoisting = 16777216,
- HasEndOfDeclarationMarker = 33554432,
+ SingleLine = 1,
+ AdviseOnEmitNode = 2,
+ NoSubstitution = 4,
+ CapturesThis = 8,
+ NoLeadingSourceMap = 16,
+ NoTrailingSourceMap = 32,
+ NoSourceMap = 48,
+ NoNestedSourceMaps = 64,
+ NoTokenLeadingSourceMaps = 128,
+ NoTokenTrailingSourceMaps = 256,
+ NoTokenSourceMaps = 384,
+ NoLeadingComments = 512,
+ NoTrailingComments = 1024,
+ NoComments = 1536,
+ NoNestedComments = 2048,
+ HelperName = 4096,
+ ExportName = 8192,
+ LocalName = 16384,
+ Indented = 32768,
+ NoIndentation = 65536,
+ AsyncFunctionBody = 131072,
+ ReuseTempVariableScope = 262144,
+ CustomPrologue = 524288,
+ NoHoisting = 1048576,
+ HasEndOfDeclarationMarker = 2097152,
+ }
+ interface EmitHelper {
+ readonly name: string;
+ readonly scoped: boolean;
+ readonly text: string;
+ readonly priority?: number;
}
const enum EmitContext {
SourceFile = 0,
@@ -3450,10 +3478,40 @@ declare namespace ts {
IdentifierName = 2,
Unspecified = 3,
}
- interface LexicalEnvironment {
+ interface EmitHost extends ScriptReferenceHost {
+ getSourceFiles(): SourceFile[];
+ isSourceFileFromExternalLibrary(file: SourceFile): boolean;
+ getCommonSourceDirectory(): string;
+ getCanonicalFileName(fileName: string): string;
+ getNewLine(): string;
+ isEmitBlocked(emitFileName: string): boolean;
+ writeFile: WriteFileCallback;
+ }
+ interface TransformationContext {
+ getCompilerOptions(): CompilerOptions;
+ getEmitResolver(): EmitResolver;
+ getEmitHost(): EmitHost;
startLexicalEnvironment(): void;
+ suspendLexicalEnvironment(): void;
+ resumeLexicalEnvironment(): void;
endLexicalEnvironment(): Statement[];
+ hoistFunctionDeclaration(node: FunctionDeclaration): void;
+ hoistVariableDeclaration(node: Identifier): void;
+ requestEmitHelper(helper: EmitHelper): void;
+ readEmitHelpers(): EmitHelper[] | undefined;
+ enableSubstitution(kind: SyntaxKind): void;
+ isSubstitutionEnabled(node: Node): boolean;
+ onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node;
+ enableEmitNotification(kind: SyntaxKind): void;
+ isEmitNotificationEnabled(node: Node): boolean;
+ onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void;
}
+ interface TransformationResult {
+ transformed: SourceFile[];
+ emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void;
+ emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void;
+ }
+ type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile;
interface TextSpan {
start: number;
length: number;
@@ -3486,6 +3544,9 @@ declare namespace ts.performance {
function disable(): void;
}
declare namespace ts {
+ const version = "2.2.0-dev.20161127";
+}
+declare namespace ts {
const enum Ternary {
False = 0,
Maybe = 1,
@@ -3532,6 +3593,7 @@ declare namespace ts {
function sum(array: any[], prop: string): number;
function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
function addRange<T>(to: T[] | undefined, from: T[] | undefined): T[] | undefined;
+ function stableSort<T>(array: T[], comparer?: (x: T, y: T) => Comparison): T[];
function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number): boolean;
function firstOrUndefined<T>(array: T[]): T;
function lastOrUndefined<T>(array: T[]): T;
@@ -3549,6 +3611,7 @@ declare namespace ts {
function forEachProperty<T, U>(map: Map<T>, callback: (value: T, key: string) => U): U;
function someProperties<T>(map: Map<T>, predicate?: (value: T, key: string) => boolean): boolean;
function copyProperties<T>(source: Map<T>, target: MapLike<T>): void;
+ function appendProperty<T>(map: Map<T>, key: string | number, value: T): Map<T>;
function assign<T1 extends MapLike<{}>, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3;
function assign<T1 extends MapLike<{}>, T2>(t: T1, arg1: T2): T1 & T2;
function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]): any;
@@ -3594,6 +3657,7 @@ declare namespace ts {
function isExternalModuleNameRelative(moduleName: string): boolean;
function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget;
function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions: CompilerOptions): ModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str: string): boolean;
function isRootedDiskPath(path: string): boolean;
function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string;
@@ -3671,6 +3735,7 @@ declare namespace ts {
function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void;
function fail(message?: string): void;
}
+ function orderedRemoveItem<T>(array: T[], item: T): boolean;
function orderedRemoveItemAt<T>(array: T[], index: number): void;
function unorderedRemoveItemAt<T>(array: T[], index: number): void;
function unorderedRemoveItem<T>(array: T[], item: T): void;
@@ -6330,7 +6395,7 @@ declare namespace ts {
key: string;
message: string;
};
- Type_0_is_not_constrained_to_keyof_1: {
+ Type_0_cannot_be_used_to_index_type_1: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -6720,7 +6785,13 @@ declare namespace ts {
key: string;
message: string;
};
- An_object_rest_element_must_be_an_identifier: {
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: {
+ code: number;
+ category: DiagnosticCategory;
+ key: string;
+ message: string;
+ };
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -7146,6 +7217,12 @@ declare namespace ts {
key: string;
message: string;
};
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: {
+ code: number;
+ category: DiagnosticCategory;
+ key: string;
+ message: string;
+ };
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: {
code: number;
category: DiagnosticCategory;
@@ -8430,7 +8507,7 @@ declare namespace ts {
key: string;
message: string;
};
- Unknown_typing_option_0: {
+ Unknown_type_acquisition_option_0: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -8442,7 +8519,7 @@ declare namespace ts {
key: string;
message: string;
};
- The_path_in_an_extends_options_must_be_relative_or_rooted: {
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: {
code: number;
category: DiagnosticCategory;
key: string;
@@ -8514,6 +8591,24 @@ declare namespace ts {
key: string;
message: string;
};
+ Import_0_from_1: {
+ code: number;
+ category: DiagnosticCategory;
+ key: string;
+ message: string;
+ };
+ Change_0_to_1: {
+ code: number;
+ category: DiagnosticCategory;
+ key: string;
+ message: string;
+ };
+ Add_0_to_existing_import_declaration_from_1: {
+ code: number;
+ category: DiagnosticCategory;
+ key: string;
+ message: string;
+ };
};
}
declare namespace ts {
@@ -8585,12 +8680,13 @@ declare namespace ts {
declare namespace ts {
const compileOnSaveCommandLineOption: CommandLineOption;
const optionDeclarations: CommandLineOption[];
- let typingOptionDeclarations: CommandLineOption[];
+ let typeAcquisitionDeclarations: CommandLineOption[];
interface OptionNameMap {
optionNameMap: Map<CommandLineOption>;
shortOptionNames: Map<string>;
}
const defaultInitCompilerOptions: CompilerOptions;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition;
function getOptionNameMap(): OptionNameMap;
function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic;
function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): string | number;
@@ -8613,8 +8709,8 @@ declare namespace ts {
options: CompilerOptions;
errors: Diagnostic[];
};
- function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
- options: TypingOptions;
+ function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
+ options: TypeAcquisition;
errors: Diagnostic[];
};
}
@@ -8626,7 +8722,7 @@ declare namespace ts.JsTyping {
readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[];
}
const nodeCoreModuleList: ReadonlyArray<string>;
- function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map<string>, typingOptions: TypingOptions, unresolvedImports: ReadonlyArray<string>): {
+ function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map<string>, typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray<string>): {
cachedTypingPaths: string[];
newTypingNames: string[];
filesToWatch: string[];
@@ -8672,7 +8768,7 @@ declare namespace ts.server {
const Perf: Perf;
type Types = Err | Info | Perf;
}
- function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
+ function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
namespace Errors {
function ThrowNoProject(): never;
function ThrowProjectLanguageServiceDisabled(): never;
@@ -8699,7 +8795,7 @@ declare namespace ts.server {
files?: string[];
wildcardDirectories?: Map<WatchDirectoryFlags>;
compilerOptions?: CompilerOptions;
- typingOptions?: TypingOptions;
+ typeAcquisition?: TypeAcquisition;
compileOnSave?: boolean;
}
function isInferredProjectName(name: string): boolean;
@@ -8725,6 +8821,7 @@ declare namespace ts.server {
declare namespace ts {
function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void;
function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean;
+ function moduleHasNonRelativeName(moduleName: string): boolean;
function getEffectiveTypeRoots(options: CompilerOptions, host: {
directoryExists?: (directoryName: string) => boolean;
getCurrentDirectory?: () => string;
@@ -8751,15 +8848,6 @@ declare namespace ts {
interface StringSymbolWriter extends SymbolWriter {
string(): string;
}
- interface EmitHost extends ScriptReferenceHost {
- getSourceFiles(): SourceFile[];
- isSourceFileFromExternalLibrary(file: SourceFile): boolean;
- getCommonSourceDirectory(): string;
- getCanonicalFileName(fileName: string): string;
- getNewLine(): string;
- isEmitBlocked(emitFileName: string): boolean;
- writeFile: WriteFileCallback;
- }
function getSingleLineStringWriter(): StringSymbolWriter;
function releaseStringWriter(writer: StringSymbolWriter): void;
function getFullWidth(node: Node): number;
@@ -8780,7 +8868,7 @@ declare namespace ts {
function getEndLinePosition(line: number, sourceFile: SourceFile): number;
function nodeIsMissing(node: Node): boolean;
function nodeIsPresent(node: Node): boolean;
- function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
+ function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number;
function isJSDocNode(node: Node): boolean;
function isJSDocTag(node: Node): boolean;
function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
@@ -8815,11 +8903,10 @@ declare namespace ts {
function isConst(node: Node): boolean;
function isLet(node: Node): boolean;
function isSuperCall(n: Node): n is SuperCall;
- function isPrologueDirective(node: Node): boolean;
+ function isPrologueDirective(node: Node): node is PrologueDirective;
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[];
- function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
- function getJsDocCommentsFromText(node: Node, text: string): CommentRange[];
+ function getJSDocCommentRanges(node: Node, text: string): CommentRange[];
let fullTripleSlashReferencePathRegEx: RegExp;
let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp;
let fullTripleSlashAMDReferencePathRegEx: RegExp;
@@ -8868,11 +8955,12 @@ declare namespace ts {
function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean;
function hasQuestionToken(node: Node): boolean;
function isJSDocConstructSignature(node: Node): boolean;
- function getJSDocComments(node: Node, checkParentVariableStatement: boolean): string[];
- function getJSDocTypeTag(node: Node): JSDocTypeTag;
+ function getCommentsFromJSDoc(node: Node): string[];
+ function getJSDocParameterTags(param: Node): JSDocParameterTag[];
+ function getJSDocType(node: Node): JSDocType;
+ function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag;
function getJSDocReturnTag(node: Node): JSDocReturnTag;
function getJSDocTemplateTag(node: Node): JSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag;
function hasRestParameter(s: SignatureDeclaration): boolean;
function hasDeclaredRestParameter(s: SignatureDeclaration): boolean;
function isRestParameter(node: ParameterDeclaration): boolean;
@@ -8901,11 +8989,11 @@ declare namespace ts {
function isKeyword(token: SyntaxKind): boolean;
function isTrivia(token: SyntaxKind): boolean;
function isAsyncFunctionLike(node: Node): boolean;
- function isStringOrNumericLiteral(kind: SyntaxKind): boolean;
+ function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral;
function hasDynamicName(declaration: Declaration): boolean;
function isDynamicName(name: DeclarationName): boolean;
function isWellKnownSymbolSyntactically(node: Expression): boolean;
- function getPropertyNameForPropertyNameNode(name: DeclarationName): string;
+ function getPropertyNameForPropertyNameNode(name: DeclarationName | ParameterDeclaration): string;
function getPropertyNameForKnownSymbolName(symbolName: string): string;
function isESSymbolIdentifier(node: Node): boolean;
function isPushOrUnshiftIdentifier(node: Identifier): boolean;
@@ -8928,7 +9016,7 @@ declare namespace ts {
function getExpressionAssociativity(expression: Expression): Associativity;
function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity;
function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7;
- function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count;
+ function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.RawExpression | SyntaxKind.Count;
function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7;
function createDiagnosticCollection(): DiagnosticCollection;
function escapeString(s: string): string;
@@ -9000,7 +9088,8 @@ declare namespace ts {
function isLogicalOperator(token: SyntaxKind): boolean;
function isAssignmentOperator(token: SyntaxKind): boolean;
function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined;
- function isAssignmentExpression(node: Node): node is AssignmentExpression;
+ function isAssignmentExpression(node: Node, excludeCompoundAssignment: true): node is AssignmentExpression<EqualsToken>;
+ function isAssignmentExpression(node: Node, excludeCompoundAssignment?: false): node is AssignmentExpression<AssignmentOperatorToken>;
function isDestructuringAssignment(node: Node): node is DestructuringAssignment;
function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean;
function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean;
@@ -9031,15 +9120,6 @@ declare namespace ts {
function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean;
function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean;
function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number;
- interface ExternalModuleInfo {
- externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[];
- exportSpecifiers: Map<ExportSpecifier[]>;
- exportedBindings: Map<Identifier[]>;
- exportedNames: Identifier[];
- exportEquals: ExportAssignment | undefined;
- hasExportStarsToExportValues: boolean;
- }
- function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver): ExternalModuleInfo;
function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean;
function getInitializedVariables(node: VariableDeclarationList): VariableDeclaration[];
function isMergedWithClass(node: Node): boolean;
@@ -9068,9 +9148,16 @@ declare namespace ts {
function isClassElement(node: Node): node is ClassElement;
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
function isTypeNode(node: Node): node is TypeNode;
+ function isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
+ function isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
function isBindingPattern(node: Node): node is BindingPattern;
+ function isAssignmentPattern(node: Node): node is AssignmentPattern;
function isBindingElement(node: Node): node is BindingElement;
function isArrayBindingElement(node: Node): node is ArrayBindingElement;
+ function isDeclarationBindingElement(bindingElement: BindingOrAssignmentElement): bindingElement is VariableDeclaration | ParameterDeclaration | BindingElement;
+ function isBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is BindingOrAssignmentPattern;
+ function isObjectBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ObjectBindingOrAssignmentPattern;
+ function isArrayBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ArrayBindingOrAssignmentPattern;
function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression;
function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression;
function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression;
@@ -9148,9 +9235,15 @@ declare namespace ts {
let unchangedTextChangeRange: TextChangeRange;
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
- function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
+ function isParameterPropertyDeclaration(node: Node): boolean;
function getCombinedModifierFlags(node: Node): ModifierFlags;
function getCombinedNodeFlags(node: Node): NodeFlags;
+ function validateLocaleAndSetLanguage(locale: string, sys: {
+ getExecutingFilePath(): string;
+ resolvePath(path: string): string;
+ fileExists(fileName: string): boolean;
+ readFile(fileName: string): string;
+ }, errors?: Diagnostic[]): void;
}
declare namespace ts {
function updateNode<T extends Node>(updated: T, original: T): T;
@@ -9159,7 +9252,7 @@ declare namespace ts {
function createSynthesizedNodeArray<T extends Node>(elements?: T[]): NodeArray<T>;
function getSynthesizedClone<T extends Node>(node: T): T;
function getMutableClone<T extends Node>(node: T): T;
- function createLiteral(textSource: StringLiteral | Identifier, location?: TextRange): StringLiteral;
+ function createLiteral(textSource: StringLiteral | NumericLiteral | Identifier, location?: TextRange): StringLiteral;
function createLiteral(value: string, location?: TextRange): StringLiteral;
function createLiteral(value: number, location?: TextRange): NumericLiteral;
function createLiteral(value: boolean, location?: TextRange): BooleanLiteral;
@@ -9176,7 +9269,7 @@ declare namespace ts {
function createComputedPropertyName(expression: Expression, location?: TextRange): ComputedPropertyName;
function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName;
function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): ParameterDeclaration;
- function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration;
+ function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration;
function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression, location?: TextRange): PropertyDeclaration;
function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression): PropertyDeclaration;
function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): MethodDeclaration;
@@ -9192,7 +9285,7 @@ declare namespace ts {
function createArrayBindingPattern(elements: ArrayBindingElement[], location?: TextRange): ArrayBindingPattern;
function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern;
function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression, location?: TextRange): BindingElement;
- function updateBindingElement(node: BindingElement, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement;
+ function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement;
function createArrayLiteral(elements?: Expression[], location?: TextRange, multiLine?: boolean): ArrayLiteralExpression;
function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression;
function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean): ObjectLiteralExpression;
@@ -9227,6 +9320,7 @@ declare namespace ts {
function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression;
function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression, location?: TextRange): BinaryExpression;
function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression;
+ function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression, location?: TextRange): ConditionalExpression;
function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression, location?: TextRange): ConditionalExpression;
function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression;
function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[], location?: TextRange): TemplateExpression;
@@ -9339,8 +9433,10 @@ declare namespace ts {
function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker;
function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression;
function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression;
+ function createRawExpression(text: string): RawExpression;
function createComma(left: Expression, right: Expression): Expression;
function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression;
+ function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression, location?: TextRange): DestructuringAssignment;
function createAssignment(left: Expression, right: Expression, location?: TextRange): BinaryExpression;
function createStrictEquality(left: Expression, right: Expression): BinaryExpression;
function createStrictInequality(left: Expression, right: Expression): BinaryExpression;
@@ -9351,6 +9447,8 @@ declare namespace ts {
function createLogicalOr(left: Expression, right: Expression): BinaryExpression;
function createLogicalNot(operand: Expression): PrefixUnaryExpression;
function createVoidZero(): VoidExpression;
+ type TypeOfTag = "undefined" | "number" | "boolean" | "string" | "symbol" | "object" | "function";
+ function createTypeCheck(value: Expression, tag: TypeOfTag): BinaryExpression;
function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression;
function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: Expression[], location?: TextRange): CallExpression;
function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression;
@@ -9363,16 +9461,7 @@ declare namespace ts {
function createLetStatement(name: Identifier, initializer: Expression, location?: TextRange): VariableStatement;
function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList;
function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList;
- function createHelperName(externalHelpersModuleName: Identifier | undefined, name: string): Identifier | PropertyAccessExpression;
- function createExtendsHelper(externalHelpersModuleName: Identifier | undefined, name: Identifier): CallExpression;
- function createAssignHelper(externalHelpersModuleName: Identifier | undefined, attributesSegments: Expression[]): CallExpression;
- function createParamHelper(externalHelpersModuleName: Identifier | undefined, expression: Expression, parameterOffset: number, location?: TextRange): CallExpression;
- function createMetadataHelper(externalHelpersModuleName: Identifier | undefined, metadataKey: string, metadataValue: Expression): CallExpression;
- function createDecorateHelper(externalHelpersModuleName: Identifier | undefined, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange): CallExpression;
- function createAwaiterHelper(externalHelpersModuleName: Identifier | undefined, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block): CallExpression;
- function createHasOwnProperty(target: LeftHandSideExpression, propertyName: Expression): CallExpression;
- function createAdvancedAsyncSuperHelper(): VariableStatement;
- function createSimpleAsyncSuperHelper(): VariableStatement;
+ function getHelperName(name: string): Identifier;
interface CallBinding {
target: LeftHandSideExpression;
thisArg: Expression;
@@ -9389,9 +9478,12 @@ declare namespace ts {
function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier;
function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression;
function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression;
+ function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block;
function addPrologueDirectives(target: Statement[], source: Statement[], ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult<Node>): number;
- function ensureUseStrict(node: SourceFile): SourceFile;
+ function startsWithUseStrict(statements: Statement[]): boolean;
+ function ensureUseStrict(statements: NodeArray<Statement>): NodeArray<Statement>;
function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression;
+ function parenthesizeForConditionalHead(condition: Expression): Expression;
function parenthesizeForNew(expression: Expression): LeftHandSideExpression;
function parenthesizeForAccess(expression: Expression): LeftHandSideExpression;
function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression;
@@ -9416,16 +9508,25 @@ declare namespace ts {
function startOnNewLine<T extends Node>(node: T): T;
function setOriginalNode<T extends Node>(node: T, original: Node): T;
function disposeEmitNodes(sourceFile: SourceFile): void;
+ function getOrCreateEmitNode(node: Node): EmitNode;
function getEmitFlags(node: Node): EmitFlags;
function setEmitFlags<T extends Node>(node: T, emitFlags: EmitFlags): T;
+ function getSourceMapRange(node: Node): TextRange;
function setSourceMapRange<T extends Node>(node: T, range: TextRange): T;
+ function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange;
function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: TextRange): T;
- function setCommentRange<T extends Node>(node: T, range: TextRange): T;
function getCommentRange(node: Node): TextRange;
- function getSourceMapRange(node: Node): TextRange;
- function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange;
+ function setCommentRange<T extends Node>(node: T, range: TextRange): T;
function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number;
function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression;
+ function getExternalHelpersModuleName(node: SourceFile): Identifier;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node: SourceFile, compilerOptions: CompilerOptions): Identifier;
+ function addEmitHelper<T extends Node>(node: T, helper: EmitHelper): T;
+ function addEmitHelpers<T extends Node>(node: T, helpers: EmitHelper[] | undefined): T;
+ function removeEmitHelper(node: Node, helper: EmitHelper): boolean;
+ function getEmitHelpers(node: Node): EmitHelper[] | undefined;
+ function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void;
+ function compareEmitHelpers(x: EmitHelper, y: EmitHelper): Comparison;
function setTextRange<T extends TextRange>(node: T, location: TextRange): T;
function setNodeFlags<T extends Node>(node: T, flags: NodeFlags): T;
function setMultiLine<T extends ObjectLiteralExpression | ArrayLiteralExpression | Block>(node: T, multiLine: boolean): T;
@@ -9433,12 +9534,27 @@ declare namespace ts {
function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier;
function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral;
function tryGetModuleNameFromFile(file: SourceFile, host: EmitHost, options: CompilerOptions): StringLiteral;
- function transformFunctionBody(node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult<Node>, currentSourceFile: SourceFile, context: TransformationContext, enableSubstitutionsForCapturedThis: () => void, convertObjectRest?: boolean): Block;
- function addCaptureThisForNodeIfNeeded(statements: Statement[], node: Node, enableSubstitutionsForCapturedThis: () => void): void;
- function captureThisForNode(statements: Statement[], node: Node, initializer: Expression | undefined, enableSubstitutionsForCapturedThis?: () => void, originalStatement?: Statement): void;
- function addDefaultValueAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, visitor: (node: Node) => VisitResult<Node>, convertObjectRest: boolean): void;
- function addRestParameterIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, inConstructorWithSynthesizedSuper: boolean): void;
- function convertForOf(node: ForOfStatement, convertedLoopBodyStatements: Statement[], visitor: (node: Node) => VisitResult<Node>, enableSubstitutionsForBlockScopedBindings: () => void, context: TransformationContext, convertObjectRest?: boolean): ForStatement | ForOfStatement;
+ function getInitializerOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Expression | undefined;
+ function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementTarget;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): PropertyName;
+ function getElementsOfBindingOrAssignmentPattern(name: BindingOrAssignmentPattern): BindingOrAssignmentElement[];
+ function convertToArrayAssignmentElement(element: BindingOrAssignmentElement): Expression;
+ function convertToObjectAssignmentElement(element: BindingOrAssignmentElement): ObjectLiteralElementLike;
+ function convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern;
+ function convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression;
+ function convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression;
+ function convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression;
+ interface ExternalModuleInfo {
+ externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[];
+ externalHelpersImportDeclaration: ImportDeclaration | undefined;
+ exportSpecifiers: Map<ExportSpecifier[]>;
+ exportedBindings: Map<Identifier[]>;
+ exportedNames: Identifier[];
+ exportEquals: ExportAssignment | undefined;
+ hasExportStarsToExportValues: boolean;
+ }
+ function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo;
}
declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
@@ -9474,12 +9590,18 @@ declare namespace ts {
}
declare namespace ts {
type VisitResult<T extends Node> = T | T[];
- function reduceEachChild<T>(node: Node, f: (memo: T, node: Node) => T, initial: T): T;
+ function reduceEachChild<T>(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: Node[]) => T): T;
function visitNode<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray<Node>) => T): T;
function visitNode<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, optional: boolean, lift: (node: NodeArray<Node>) => T, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): T;
function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: (node: Node) => VisitResult<Node>, test: (node: Node) => boolean, start: number, count: number, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): NodeArray<T>;
- function visitEachChild<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, context: LexicalEnvironment): T;
+ function visitLexicalEnvironment(statements: NodeArray<Statement>, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray<Statement>;
+ function visitParameterList(nodes: NodeArray<ParameterDeclaration>, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext): NodeArray<ParameterDeclaration>;
+ function visitFunctionBody(node: FunctionBody, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext): FunctionBody;
+ function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext): ConciseBody;
+ function visitEachChild<T extends Node>(node: T, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext): T;
+ function mergeLexicalEnvironment(statements: NodeArray<Statement>, declarations: Statement[]): NodeArray<Statement>;
+ function mergeLexicalEnvironment(statements: Statement[], declarations: Statement[]): Statement[];
function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody;
function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody;
function liftToBlock(nodes: Node[]): Statement;
@@ -9487,23 +9609,30 @@ declare namespace ts {
namespace Debug {
const failNotOptional: typeof noop;
const failBadSyntaxKind: (node: Node, message?: string) => void;
+ const assertEachNode: (nodes: Node[], test: (node: Node) => boolean, message?: string) => void;
const assertNode: (node: Node, test: (node: Node) => boolean, message?: string) => void;
+ const assertOptionalNode: (node: Node, test: (node: Node) => boolean, message?: string) => void;
+ const assertOptionalToken: (node: Node, kind: SyntaxKind, message?: string) => void;
+ const assertMissingNode: (node: Node, message?: string) => void;
}
}
declare namespace ts {
- function flattenDestructuringAssignment(context: TransformationContext, node: BinaryExpression, needsValue: boolean, recordTempVariable: (node: Identifier) => void, visitor?: (node: Node) => VisitResult<Node>, transformRest?: boolean): Expression;
- function flattenParameterDestructuring(node: ParameterDeclaration, value: Expression, visitor?: (node: Node) => VisitResult<Node>, transformRest?: boolean): VariableDeclaration[];
- function flattenVariableDestructuring(node: VariableDeclaration, value?: Expression, visitor?: (node: Node) => VisitResult<Node>, recordTempVariable?: (node: Identifier) => void, transformRest?: boolean): VariableDeclaration[];
- function flattenVariableDestructuringToExpression(node: VariableDeclaration, recordTempVariable: (name: Identifier) => void, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression, visitor?: (node: Node) => VisitResult<Node>): Expression;
+ const enum FlattenLevel {
+ All = 0,
+ ObjectRest = 1,
+ }
+ function flattenDestructuringAssignment(node: VariableDeclaration | DestructuringAssignment, visitor: ((node: Node) => VisitResult<Node>) | undefined, context: TransformationContext, level: FlattenLevel, needsValue?: boolean, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression): Expression;
+ function flattenDestructuringBinding(node: VariableDeclaration | ParameterDeclaration, visitor: (node: Node) => VisitResult<Node>, context: TransformationContext, level: FlattenLevel, rval?: Expression, hoistTempVariables?: boolean, skipInitializer?: boolean): VariableDeclaration[];
}
declare namespace ts {
function transformTypeScript(context: TransformationContext): (node: SourceFile) => SourceFile;
}
declare namespace ts {
- function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile;
+ function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile;
+ function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]): CallExpression;
}
declare namespace ts {
- function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile;
+ function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile;
}
declare namespace ts {
function transformES2017(context: TransformationContext): (node: SourceFile) => SourceFile;
@@ -9530,25 +9659,6 @@ declare namespace ts {
function transformES2015Module(context: TransformationContext): (node: SourceFile) => SourceFile;
}
declare namespace ts {
- interface TransformationResult {
- transformed: SourceFile[];
- emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void;
- emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void;
- }
- interface TransformationContext extends LexicalEnvironment {
- getCompilerOptions(): CompilerOptions;
- getEmitResolver(): EmitResolver;
- getEmitHost(): EmitHost;
- hoistFunctionDeclaration(node: FunctionDeclaration): void;
- hoistVariableDeclaration(node: Identifier): void;
- enableSubstitution(kind: SyntaxKind): void;
- isSubstitutionEnabled(node: Node): boolean;
- onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node;
- enableEmitNotification(kind: SyntaxKind): void;
- isEmitNotificationEnabled(node: Node): boolean;
- onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void;
- }
- type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile;
function getTransformers(compilerOptions: CompilerOptions): Transformer[];
function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult;
}
@@ -9584,7 +9694,6 @@ declare namespace ts {
function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult;
}
declare namespace ts {
- const version = "2.2.0-dev.20161115";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string;
@@ -9649,6 +9758,7 @@ declare namespace ts {
nameTable: Map<number>;
getNamedDeclarations(): Map<Declaration[]>;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
+ getLineEndOfPosition(pos: number): number;
getLineStarts(): number[];
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
@@ -10779,6 +10889,8 @@ declare namespace ts {
span: TextSpan;
program: Program;
newLineCharacter: string;
+ host: LanguageServiceHost;
+ cancellationToken: CancellationToken;
}
namespace codefix {
function registerCodeFix(action: CodeFix): void;
@@ -10788,6 +10900,10 @@ declare namespace ts {
}
declare namespace ts.codefix {
}
+declare namespace ts.codefix {
+}
+declare namespace ts.codefix {
+}
declare namespace ts {
const servicesVersion = "0.5";
interface DisplayPartsSymbolWriter extends SymbolWriter {
@@ -10882,7 +10998,7 @@ declare namespace ts.server {
}
declare namespace ts.server {
interface ITypingsInstaller {
- enqueueInstallTypingsRequest(p: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>): void;
+ enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>): void;
attach(projectService: ProjectService): void;
onProjectClosed(p: Project): void;
readonly globalTypingsCacheLocation: string;
@@ -10893,7 +11009,7 @@ declare namespace ts.server {
private readonly perProjectCache;
constructor(installer: ITypingsInstaller);
getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray<string>, forceRefresh: boolean): SortedReadonlyArray<string>;
- updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray<string>, newTypings: string[]): void;
+ updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, newTypings: string[]): void;
deleteTypingsForProject(projectName: string): void;
onProjectClosed(project: Project): void;
}
@@ -10941,6 +11057,7 @@ declare namespace ts.server {
}
function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService;
abstract class Project {
+ private readonly projectName;
readonly projectKind: ProjectKind;
readonly projectService: ProjectService;
private documentRegistry;
@@ -10966,16 +11083,16 @@ declare namespace ts.server {
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap;
- constructor(projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean);
+ constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean);
getProjectErrors(): Diagnostic[];
getLanguageService(ensureSynchronized?: boolean): LanguageService;
getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[];
getProjectVersion(): string;
enableLanguageService(): void;
disableLanguageService(): void;
- abstract getProjectName(): string;
+ getProjectName(): string;
abstract getProjectRootPath(): string | undefined;
- abstract getTypingOptions(): TypingOptions;
+ abstract getTypeAcquisition(): TypeAcquisition;
getSourceFile(path: Path): SourceFile;
updateTypes(): void;
close(): void;
@@ -11009,31 +11126,29 @@ declare namespace ts.server {
private removeRootFileIfNecessary(info);
}
class InferredProject extends Project {
- private static NextId;
- private readonly inferredProjectName;
+ private static newName;
directoriesWatchedForTsconfig: string[];
constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions);
- getProjectName(): string;
getProjectRootPath(): string;
close(): void;
- getTypingOptions(): TypingOptions;
+ getTypeAcquisition(): TypeAcquisition;
}
class ConfiguredProject extends Project {
- readonly configFileName: NormalizedPath;
private wildcardDirectories;
compileOnSaveEnabled: boolean;
- private typingOptions;
+ private typeAcquisition;
private projectFileWatcher;
private directoryWatcher;
private directoriesWatchedForWildcards;
private typeRootsWatchers;
+ readonly canonicalConfigFilePath: NormalizedPath;
openRefCount: number;
constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map<WatchDirectoryFlags>, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean);
+ getConfigFilePath(): string;
getProjectRootPath(): string;
setProjectErrors(projectErrors: Diagnostic[]): void;
- setTypingOptions(newTypingOptions: TypingOptions): void;
- getTypingOptions(): TypingOptions;
- getProjectName(): NormalizedPath;
+ setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void;
+ getTypeAcquisition(): TypeAcquisition;
watchConfigFile(callback: (project: ConfiguredProject) => void): void;
watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void;
watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void;
@@ -11045,16 +11160,14 @@ declare namespace ts.server {
getEffectiveTypeRoots(): string[];
}
class ExternalProject extends Project {
- readonly externalProjectName: string;
compileOnSaveEnabled: boolean;
private readonly projectFilePath;
- private typingOptions;
+ private typeAcquisition;
constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string);
getProjectRootPath(): string;
- getTypingOptions(): TypingOptions;
+ getTypeAcquisition(): TypeAcquisition;
setProjectErrors(projectErrors: Diagnostic[]): void;
- setTypingOptions(newTypingOptions: TypingOptions): void;
- getProjectName(): string;
+ setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void;
}
}
declare namespace ts.server {
@@ -11122,7 +11235,7 @@ declare namespace ts.server {
private readonly throttledOperations;
private readonly hostConfiguration;
private changedFiles;
- private toCanonicalFileName;
+ readonly toCanonicalFileName: (f: string) => string;
lastDeletedFile: ScriptInfo;
constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler);
getChangedFiles_TestOnly(): ScriptInfo[];
@@ -11156,13 +11269,13 @@ declare namespace ts.server {
private findExternalProjectByProjectName(projectFileName);
private convertConfigFileContentToProjectOptions(configFilename);
private exceededTotalSizeLimitForNonTsFiles<T>(options, fileNames, propertyReader);
- private createAndAddExternalProject(projectFileName, files, options, typingOptions);
+ private createAndAddExternalProject(projectFileName, files, options, typeAcquisition);
private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile);
private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?);
private watchConfigDirectoryForProject(project, options);
- private addFilesToProjectAndUpdateGraph<T>(project, files, propertyReader, clientFileName, typingOptions, configFileErrors);
+ private addFilesToProjectAndUpdateGraph<T>(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors);
private openConfigFile(configFileName, clientFileName?);
- private updateNonInferredProject<T>(project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors);
+ private updateNonInferredProject<T>(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors);
private updateConfiguredProject(project);
createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject;
getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo;
diff --git a/node_modules/typescript/lib/tsserverlibrary.js b/node_modules/typescript/lib/tsserverlibrary.js
index 04f56d015..4ed37099e 100644
--- a/node_modules/typescript/lib/tsserverlibrary.js
+++ b/node_modules/typescript/lib/tsserverlibrary.js
@@ -137,6 +137,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+(function (ts) {
var createObject = Object.create;
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
@@ -606,7 +609,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -621,6 +624,14 @@ var ts;
return to;
}
ts.addRange = addRange;
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; })
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
+ .map(function (i) { return array[i]; });
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -775,6 +786,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -1227,6 +1247,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
@@ -1777,6 +1805,16 @@ var ts;
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
function orderedRemoveItemAt(array, index) {
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
@@ -2811,7 +2849,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -2876,7 +2914,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2947,6 +2986,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -3161,9 +3201,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -3175,6 +3215,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
var ts;
@@ -5176,12 +5219,16 @@ var ts;
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
];
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -5205,6 +5252,18 @@ var ts;
sourceMap: false,
};
var optionNameMapCache;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -5484,14 +5543,15 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -5518,7 +5578,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -5526,7 +5586,7 @@ var ts;
};
function tryExtendsName(extendedConfig) {
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -5589,7 +5649,7 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -5624,12 +5684,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -5637,9 +5697,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -5858,9 +5919,9 @@ var ts;
"constants", "process", "v8", "timers", "console"
];
var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
@@ -5874,8 +5935,8 @@ var ts;
var filesToWatch = [];
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -6057,12 +6118,12 @@ var ts;
return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName;
}
}
- function createInstallTypingsRequest(project, typingOptions, unresolvedImports, cachePath) {
+ function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) {
return {
projectName: project.getProjectName(),
fileNames: project.getFileNames(true),
compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
unresolvedImports: unresolvedImports,
projectRootPath: getProjectRootPath(project),
cachePath: cachePath,
@@ -6249,6 +6310,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -6982,28 +7044,28 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
if (nodeIsMissing(node)) {
return node.pos;
}
if (isJSDocNode(node)) {
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
}
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
+ if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
+ return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 291 && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ if (node.kind === 292 && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 262 && node.kind <= 287;
+ return node.kind >= 262 && node.kind <= 288;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 278 && node.kind <= 290;
+ return node.kind >= 278 && node.kind <= 291;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -7180,7 +7242,7 @@ var ts;
case 8:
return name.text;
case 142:
- if (isStringOrNumericLiteral(name.expression.kind)) {
+ if (isStringOrNumericLiteral(name.expression)) {
return name.expression.text;
}
}
@@ -7302,7 +7364,8 @@ var ts;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 207 && node.expression.kind === 9;
+ return node.kind === 207
+ && node.expression.kind === 9;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -7313,25 +7376,20 @@ var ts;
return ts.getLeadingCommentRanges(text, node.pos);
}
ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
- }
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
+ function getJSDocCommentRanges(node, text) {
var commentRanges = (node.kind === 144 ||
node.kind === 143 ||
node.kind === 184 ||
node.kind === 185) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
+ return ts.filter(commentRanges, function (comment) {
return text.charCodeAt(comment.pos + 1) === 42 &&
text.charCodeAt(comment.pos + 2) === 42 &&
text.charCodeAt(comment.pos + 3) !== 47;
- }
+ });
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.getJSDocCommentRanges = getJSDocCommentRanges;
ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
@@ -7857,6 +7915,7 @@ var ts;
case 145:
case 252:
case 251:
+ case 259:
return true;
case 199:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
@@ -8011,152 +8070,118 @@ var ts;
node.parameters[0].type.kind === 276;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ function getCommentsFromJSDoc(node) {
+ return ts.map(getJSDocs(node), function (doc) { return doc.comment; });
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
- }
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
- }
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ ts.getCommentsFromJSDoc = getCommentsFromJSDoc;
+ function getJSDocTags(node, kind) {
+ var docs = getJSDocs(node);
+ if (docs) {
var result = [];
for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
+ if (doc.kind === 281) {
+ if (doc.kind === kind) {
+ result.push(doc);
+ }
+ }
+ else {
+ result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));
}
}
return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- var result = undefined;
- if (checkParentVariableStatement) {
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 205;
+ }
+ }
+ function getFirstJSDocTag(node, kind) {
+ return node && ts.firstOrUndefined(getJSDocTags(node, kind));
+ }
+ function getJSDocs(node) {
+ var cache = node.jsDocCache;
+ if (!cache) {
+ getJSDocsWorker(node);
+ node.jsDocCache = cache;
+ }
+ return cache;
+ function getJSDocsWorker(node) {
+ var parent = node.parent;
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&
+ parent.initializer === node &&
+ parent.parent.parent.kind === 205;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 205;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ parent.parent.kind === 205;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? parent.parent :
undefined;
if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 230 &&
- node.parent && node.parent.kind === 230) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(variableStatementNode);
}
- var parent_4 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 192 &&
- parent_4.operatorToken.kind === 57 &&
- parent_4.parent.kind === 207;
+ var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&
+ parent.kind === 192 &&
+ parent.operatorToken.kind === 57 &&
+ parent.parent.kind === 207;
if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(parent.parent);
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
+ var isModuleDeclaration = node.kind === 230 &&
+ parent && parent.kind === 230;
+ var isPropertyAssignmentExpression = parent && parent.kind === 257;
+ if (isModuleDeclaration || isPropertyAssignmentExpression) {
+ getJSDocsWorker(parent);
}
if (node.kind === 144) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
- }
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
+ cache = ts.concatenate(cache, getJSDocParameterTags(node));
}
- else {
- return getDocs(node.jsDocComments);
+ if (isVariableLike(node) && node.initializer) {
+ cache = ts.concatenate(cache, node.initializer.jsDoc);
}
+ cache = ts.concatenate(cache, node.jsDoc);
}
- return result;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
+ function getJSDocParameterTags(param) {
+ if (!isParameter(param)) {
+ return undefined;
+ }
var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
+ var tags = getJSDocTags(func, 281);
if (!param.name) {
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70) {
var name_8 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 && tag.parameterName.text === name_8; });
- if (paramTags) {
- return paramTags;
- }
+ return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; });
}
else {
return undefined;
}
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 282, false);
+ ts.getJSDocParameterTags = getJSDocParameterTags;
+ function getJSDocType(node) {
+ var tag = getFirstJSDocTag(node, 283);
+ if (!tag && node.kind === 144) {
+ var paramTags = getJSDocParameterTags(node);
+ if (paramTags) {
+ tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });
+ }
+ }
+ return tag && tag.typeExpression && tag.typeExpression.type;
+ }
+ ts.getJSDocType = getJSDocType;
+ function getJSDocAugmentsTag(node) {
+ return getFirstJSDocTag(node, 280);
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
+ ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 281, true);
+ return getFirstJSDocTag(node, 282);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 283, false);
+ return getFirstJSDocTag(node, 284);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 70) {
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 280) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
- }
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
function hasRestParameter(s) {
return isRestParameter(ts.lastOrUndefined(s.parameters));
}
@@ -8167,13 +8192,10 @@ var ts;
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
if (node && (node.flags & 2097152)) {
- if (node.type && node.type.kind === 275) {
+ if (node.type && node.type.kind === 275 ||
+ ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) {
return true;
}
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 275;
- }
}
return isDeclaredRestParam(node);
}
@@ -8396,8 +8418,10 @@ var ts;
return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node);
}
ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 || kind === 8;
+ function isStringOrNumericLiteral(node) {
+ var kind = node.kind;
+ return kind === 9
+ || kind === 8;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
function hasDynamicName(declaration) {
@@ -8406,7 +8430,7 @@ var ts;
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
return name.kind === 142 &&
- !isStringOrNumericLiteral(name.expression.kind) &&
+ !isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
@@ -8612,6 +8636,7 @@ var ts;
case 194:
case 183:
case 198:
+ case 297:
return 19;
case 181:
case 177:
@@ -9373,19 +9398,19 @@ var ts;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isAssignmentExpression(node) {
+ function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node)
- && isAssignmentOperator(node.operatorToken.kind)
+ && (excludeCompoundAssignment
+ ? node.operatorToken.kind === 57
+ : isAssignmentOperator(node.operatorToken.kind))
&& isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 57) {
- var kind = node.left.kind;
- return kind === 176
- || kind === 175;
- }
+ if (isAssignmentExpression(node, true)) {
+ var kind = node.left.kind;
+ return kind === 176
+ || kind === 175;
}
return false;
}
@@ -9696,122 +9721,6 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportedBindings = ts.createMap();
- var uniqueExports = ts.createMap();
- var hasExportDefault = false;
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 235:
- externalImports.push(node);
- break;
- case 234:
- if (node.moduleReference.kind === 245) {
- externalImports.push(node);
- }
- break;
- case 241:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- else {
- externalImports.push(node);
- }
- }
- else {
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- if (!uniqueExports[specifier.name.text]) {
- var name_10 = specifier.propertyName || specifier.name;
- ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);
- var decl = resolver.getReferencedImportDeclaration(name_10)
- || resolver.getReferencedValueDeclaration(name_10);
- if (decl) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
- }
- uniqueExports[specifier.name.text] = specifier.name;
- }
- }
- }
- break;
- case 240:
- if (node.isExportEquals && !exportEquals) {
- exportEquals = node;
- }
- break;
- case 205:
- if (hasModifier(node, 1)) {
- for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
- var decl = _e[_d];
- collectExportedVariableInfo(decl, uniqueExports);
- }
- }
- break;
- case 225:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_11 = node.name;
- if (!uniqueExports[name_11.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_11);
- uniqueExports[name_11.text] = name_11;
- }
- }
- }
- break;
- case 226:
- if (hasModifier(node, 1)) {
- if (hasModifier(node, 512)) {
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- var name_12 = node.name;
- if (!uniqueExports[name_12.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_12);
- uniqueExports[name_12.text] = name_12;
- }
- }
- }
- break;
- }
- }
- var exportedNames;
- for (var key in uniqueExports) {
- exportedNames = ts.append(exportedNames, uniqueExports[key]);
- }
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
- }
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function collectExportedVariableInfo(decl, uniqueExports) {
- if (isBindingPattern(decl.name)) {
- for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!isOmittedExpression(element)) {
- collectExportedVariableInfo(element, uniqueExports);
- }
- }
- }
- else if (!isGeneratedIdentifier(decl.name)) {
- if (!uniqueExports[decl.name.text]) {
- uniqueExports[decl.name.text] = decl.name;
- }
- }
- }
function isDeclarationNameOfEnumOrNamespace(node) {
var parseNode = getParseTreeNode(node);
if (parseNode) {
@@ -9982,6 +9891,14 @@ var ts;
return isTypeNodeKind(node.kind);
}
ts.isTypeNode = isTypeNode;
+ function isArrayBindingPattern(node) {
+ return node.kind === 173;
+ }
+ ts.isArrayBindingPattern = isArrayBindingPattern;
+ function isObjectBindingPattern(node) {
+ return node.kind === 172;
+ }
+ ts.isObjectBindingPattern = isObjectBindingPattern;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
@@ -9991,6 +9908,12 @@ var ts;
return false;
}
ts.isBindingPattern = isBindingPattern;
+ function isAssignmentPattern(node) {
+ var kind = node.kind;
+ return kind === 175
+ || kind === 176;
+ }
+ ts.isAssignmentPattern = isAssignmentPattern;
function isBindingElement(node) {
return node.kind === 174;
}
@@ -10001,6 +9924,39 @@ var ts;
|| kind === 198;
}
ts.isArrayBindingElement = isArrayBindingElement;
+ function isDeclarationBindingElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 223:
+ case 144:
+ case 174:
+ return true;
+ }
+ return false;
+ }
+ ts.isDeclarationBindingElement = isDeclarationBindingElement;
+ function isBindingOrAssignmentPattern(node) {
+ return isObjectBindingOrAssignmentPattern(node)
+ || isArrayBindingOrAssignmentPattern(node);
+ }
+ ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
+ function isObjectBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 172:
+ case 176:
+ return true;
+ }
+ return false;
+ }
+ ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
+ function isArrayBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return true;
+ }
+ return false;
+ }
+ ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
function isArrayLiteralExpression(node) {
return node.kind === 175;
}
@@ -10067,7 +10023,8 @@ var ts;
|| kind === 98
|| kind === 100
|| kind === 96
- || kind === 201;
+ || kind === 201
+ || kind === 297;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
@@ -10095,6 +10052,7 @@ var ts;
|| kind === 196
|| kind === 200
|| kind === 198
+ || kind === 297
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -10108,11 +10066,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 293;
+ return node.kind === 294;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 292;
+ return node.kind === 293;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -10224,7 +10182,7 @@ var ts;
|| kind === 228
|| kind === 143
|| kind === 223
- || kind === 284;
+ || kind === 285;
}
function isDeclarationStatementKind(kind) {
return kind === 225
@@ -10259,9 +10217,9 @@ var ts;
|| kind === 205
|| kind === 210
|| kind === 217
- || kind === 292
- || kind === 295
- || kind === 294;
+ || kind === 293
+ || kind === 296
+ || kind === 295;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -10549,6 +10507,53 @@ var ts;
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
+ function validateLocaleAndSetLanguage(locale, sys, errors) {
+ var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
+ if (!matchResult) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
+ }
+ return;
+ }
+ var language = matchResult[1];
+ var territory = matchResult[3];
+ if (!trySetLanguageAndTerritory(language, territory, errors)) {
+ trySetLanguageAndTerritory(language, undefined, errors);
+ }
+ function trySetLanguageAndTerritory(language, territory, errors) {
+ var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
+ var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
+ var filePath = ts.combinePaths(containingDirectoryPath, language);
+ if (territory) {
+ filePath = filePath + "-" + territory;
+ }
+ filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
+ if (!sys.fileExists(filePath)) {
+ return false;
+ }
+ var fileContents = "";
+ try {
+ fileContents = sys.readFile(filePath);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
+ }
+ return false;
+ }
+ try {
+ ts.localizedDiagnosticMessages = JSON.parse(fileContents);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -10749,9 +10754,9 @@ var ts;
return node;
}
ts.createParameter = createParameter;
- function updateParameter(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
+ function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node);
}
return node;
}
@@ -10884,9 +10889,9 @@ var ts;
return node;
}
ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);
}
return node;
}
@@ -10926,7 +10931,7 @@ var ts;
function createPropertyAccess(expression, name, location, flags) {
var node = createNode(177, location, flags);
node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576;
+ (node.emitNode || (node.emitNode = {})).flags |= 65536;
node.name = typeof name === "string" ? createIdentifier(name) : name;
return node;
}
@@ -11147,13 +11152,21 @@ var ts;
return node;
}
ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(193, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
+ function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {
+ var node = createNode(193, whenFalse ? location : colonTokenOrLocation);
+ node.condition = parenthesizeForConditionalHead(condition);
+ if (whenFalse) {
+ node.questionToken = questionTokenOrWhenTrue;
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ node.colonToken = colonTokenOrLocation;
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);
+ }
+ else {
+ node.questionToken = createToken(54);
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);
+ node.colonToken = createToken(55);
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ }
return node;
}
ts.createConditional = createConditional;
@@ -11963,35 +11976,33 @@ var ts;
updated.imports = node.imports;
if (node.moduleAugmentations !== undefined)
updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
return updateNode(updated, node);
}
return node;
}
ts.updateSourceFileNode = updateSourceFileNode;
function createNotEmittedStatement(original) {
- var node = createNode(292, original);
+ var node = createNode(293, original);
node.original = original;
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createNode(295);
+ var node = createNode(296);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createNode(294);
+ var node = createNode(295);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(293, location || original);
+ var node = createNode(294, location || original);
node.expression = expression;
node.original = original;
return node;
@@ -12004,6 +12015,12 @@ var ts;
return node;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ function createRawExpression(text) {
+ var node = createNode(297);
+ node.text = text;
+ return node;
+ }
+ ts.createRawExpression = createRawExpression;
function createComma(left, right) {
return createBinary(left, 25, right);
}
@@ -12052,13 +12069,19 @@ var ts;
return createVoid(createLiteral(0));
}
ts.createVoidZero = createVoidZero;
+ function createTypeCheck(value, tag) {
+ return tag === "undefined"
+ ? createStrictEquality(value, createVoidZero())
+ : createStrictEquality(createTypeOf(value), createLiteral(tag));
+ }
+ ts.createTypeCheck = createTypeCheck;
function createMemberAccessForPropertyName(target, memberName, location) {
if (ts.isComputedPropertyName(memberName)) {
return createElementAccess(target, memberName.expression, location);
}
else {
var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048;
+ (expression.emitNode || (expression.emitNode = {})).flags |= 64;
return expression;
}
}
@@ -12100,7 +12123,10 @@ var ts;
}
function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
if (ts.isQualifiedName(jsxFactory)) {
- return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536));
+ var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);
+ var right = createSynthesizedNode(70);
+ right.text = jsxFactory.right.text;
+ return createPropertyAccess(left, right);
}
else {
return createReactNamespace(jsxFactory.text, parent);
@@ -12154,114 +12180,10 @@ var ts;
return createVariableDeclarationList(declarations, location, 2);
}
ts.createConstDeclarationList = createConstDeclarationList;
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"), undefined, [
- name,
- createIdentifier("_super")
- ]);
- }
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"), undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"), undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"), undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, undefined, true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
- }
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), undefined, argumentsArray, location);
+ function getHelperName(name) {
+ return setEmitFlags(createIdentifier(name), 4096 | 2);
}
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(undefined, createToken(38), undefined, undefined, [], undefined, body);
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"), undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
- }
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"), undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"), undefined, [prototype]);
- }
- function createGeti(target) {
- return createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- return createArrowFunction(undefined, undefined, [
- createParameter(undefined, undefined, undefined, "name"),
- createParameter(undefined, undefined, undefined, "value")
- ], undefined, createToken(35), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- var createCache = createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("cache", undefined, createObjectCreate(createNull()))
- ]));
- var getter = createGetAccessor(undefined, undefined, "value", [], undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"), undefined, [createIdentifier("name")]))
- ]));
- var setter = createSetAccessor(undefined, undefined, "value", [createParameter(undefined, undefined, undefined, "v")], createBlock([
- createStatement(createCall(createIdentifier("seti"), undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(undefined, undefined, [createParameter(undefined, undefined, undefined, "name")], undefined, createToken(35), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createCall(createParen(createFunctionExpression(undefined, undefined, undefined, undefined, [
- createParameter(undefined, undefined, undefined, "geti"),
- createParameter(undefined, undefined, undefined, "seti")
- ], undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))), undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(undefined, createConstDeclarationList([
- createVariableDeclaration("_super", undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ ts.getHelperName = getHelperName;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
@@ -12407,19 +12329,19 @@ var ts;
return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method));
}
function getLocalName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 262144);
+ return getName(node, allowComments, allowSourceMaps, 16384);
}
ts.getLocalName = getLocalName;
function isLocalName(node) {
- return (getEmitFlags(node) & 262144) !== 0;
+ return (getEmitFlags(node) & 16384) !== 0;
}
ts.isLocalName = isLocalName;
function getExportName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 131072);
+ return getName(node, allowComments, allowSourceMaps, 8192);
}
ts.getExportName = getExportName;
function isExportName(node) {
- return (getEmitFlags(node) & 131072) !== 0;
+ return (getEmitFlags(node) & 8192) !== 0;
}
ts.isExportName = isExportName;
function getDeclarationName(node, allowComments, allowSourceMaps) {
@@ -12428,15 +12350,15 @@ var ts;
ts.getDeclarationName = getDeclarationName;
function getName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
- var name_13 = getMutableClone(node.name);
+ var name_10 = getMutableClone(node.name);
emitFlags |= getEmitFlags(node.name);
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
- setEmitFlags(name_13, emitFlags);
- return name_13;
+ setEmitFlags(name_10, emitFlags);
+ return name_10;
}
return getGeneratedNameForNode(node);
}
@@ -12451,14 +12373,18 @@ var ts;
var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name);
var emitFlags;
if (!allowSourceMaps)
- emitFlags |= 1536;
+ emitFlags |= 48;
if (!allowComments)
- emitFlags |= 49152;
+ emitFlags |= 1536;
if (emitFlags)
setEmitFlags(qualifiedName, emitFlags);
return qualifiedName;
}
ts.getNamespaceMemberName = getNamespaceMemberName;
+ function convertToFunctionBody(node, multiLine) {
+ return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine);
+ }
+ ts.convertToFunctionBody = convertToFunctionBody;
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
@@ -12485,7 +12411,7 @@ var ts;
}
while (statementOffset < numStatements) {
var statement = source[statementOffset];
- if (getEmitFlags(statement) & 8388608) {
+ if (getEmitFlags(statement) & 524288) {
target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
}
else {
@@ -12496,10 +12422,17 @@ var ts;
return statementOffset;
}
ts.addPrologueDirectives = addPrologueDirectives;
- function ensureUseStrict(node) {
+ function startsWithUseStrict(statements) {
+ var firstStatement = ts.firstOrUndefined(statements);
+ return firstStatement !== undefined
+ && ts.isPrologueDirective(firstStatement)
+ && isUseStrictPrologue(firstStatement);
+ }
+ ts.startsWithUseStrict = startsWithUseStrict;
+ function ensureUseStrict(statements) {
var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
if (ts.isPrologueDirective(statement)) {
if (isUseStrictPrologue(statement)) {
foundUseStrict = true;
@@ -12511,11 +12444,11 @@ var ts;
}
}
if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- return updateSourceFileNode(node, statements.concat(node.statements));
+ return createNodeArray([
+ startOnNewLine(createStatement(createLiteral("use strict")))
+ ].concat(statements), statements);
}
- return node;
+ return statements;
}
ts.ensureUseStrict = ensureUseStrict;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
@@ -12590,6 +12523,21 @@ var ts;
}
return 0;
}
+ function parenthesizeForConditionalHead(condition) {
+ var conditionalPrecedence = ts.getOperatorPrecedence(193, 54);
+ var emittedCondition = skipPartiallyEmittedExpressions(condition);
+ var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
+ if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {
+ return createParen(condition);
+ }
+ return condition;
+ }
+ ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;
+ function parenthesizeSubexpressionOfConditionalExpression(e) {
+ return e.kind === 192 && e.operatorToken.kind === 25
+ ? createParen(e)
+ : e;
+ }
function parenthesizeForNew(expression) {
var emittedExpression = skipPartiallyEmittedExpressions(expression);
switch (emittedExpression.kind) {
@@ -12695,7 +12643,7 @@ var ts;
case 177:
node = node.expression;
continue;
- case 293:
+ case 294:
node = node.expression;
continue;
}
@@ -12743,7 +12691,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 293) {
+ while (node.kind === 294) {
node = node.expression;
}
return node;
@@ -12765,8 +12713,8 @@ var ts;
}
ts.setOriginalNode = setOriginalNode;
function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;
+ if (!destEmitNode)
destEmitNode = {};
if (flags)
destEmitNode.flags = flags;
@@ -12776,6 +12724,10 @@ var ts;
destEmitNode.sourceMapRange = sourceMapRange;
if (tokenSourceMapRanges)
destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ if (constantValue !== undefined)
+ destEmitNode.constantValue = constantValue;
+ if (helpers)
+ destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);
return destEmitNode;
}
function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
@@ -12809,6 +12761,7 @@ var ts;
}
return node.emitNode;
}
+ ts.getOrCreateEmitNode = getOrCreateEmitNode;
function getEmitFlags(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.flags;
@@ -12819,11 +12772,22 @@ var ts;
return node;
}
ts.setEmitFlags = setEmitFlags;
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
+ }
+ ts.getSourceMapRange = getSourceMapRange;
function setSourceMapRange(node, range) {
getOrCreateEmitNode(node).sourceMapRange = range;
return node;
}
ts.setSourceMapRange = setSourceMapRange;
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ }
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
function setTokenSourceMapRange(node, token, range) {
var emitNode = getOrCreateEmitNode(node);
var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap());
@@ -12831,27 +12795,16 @@ var ts;
return node;
}
ts.setTokenSourceMapRange = setTokenSourceMapRange;
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
function getCommentRange(node) {
var emitNode = node.emitNode;
return (emitNode && emitNode.commentRange) || node;
}
ts.getCommentRange = getCommentRange;
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
+ return node;
}
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ ts.setCommentRange = setCommentRange;
function getConstantValue(node) {
var emitNode = node.emitNode;
return emitNode && emitNode.constantValue;
@@ -12863,6 +12816,103 @@ var ts;
return node;
}
ts.setConstantValue = setConstantValue;
+ function getExternalHelpersModuleName(node) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return emitNode && emitNode.externalHelpersModuleName;
+ }
+ ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {
+ if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
+ var externalHelpersModuleName = getExternalHelpersModuleName(node);
+ if (externalHelpersModuleName) {
+ return externalHelpersModuleName;
+ }
+ var helpers = getEmitHelpers(node);
+ if (helpers) {
+ for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
+ var helper = helpers_1[_i];
+ if (!helper.scoped) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = getOrCreateEmitNode(parseNode);
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));
+ }
+ }
+ }
+ }
+ }
+ ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
+ function addEmitHelper(node, helper) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ return node;
+ }
+ ts.addEmitHelper = addEmitHelper;
+ function addEmitHelpers(node, helpers) {
+ if (ts.some(helpers)) {
+ var emitNode = getOrCreateEmitNode(node);
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!ts.contains(emitNode.helpers, helper)) {
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ }
+ }
+ }
+ return node;
+ }
+ ts.addEmitHelpers = addEmitHelpers;
+ function removeEmitHelper(node, helper) {
+ var emitNode = node.emitNode;
+ if (emitNode) {
+ var helpers = emitNode.helpers;
+ if (helpers) {
+ return ts.orderedRemoveItem(helpers, helper);
+ }
+ }
+ return false;
+ }
+ ts.removeEmitHelper = removeEmitHelper;
+ function getEmitHelpers(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.helpers;
+ }
+ ts.getEmitHelpers = getEmitHelpers;
+ function moveEmitHelpers(source, target, predicate) {
+ var sourceEmitNode = source.emitNode;
+ var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
+ if (!ts.some(sourceEmitHelpers))
+ return;
+ var targetEmitNode = getOrCreateEmitNode(target);
+ var helpersRemoved = 0;
+ for (var i = 0; i < sourceEmitHelpers.length; i++) {
+ var helper = sourceEmitHelpers[i];
+ if (predicate(helper)) {
+ helpersRemoved++;
+ if (!ts.contains(targetEmitNode.helpers, helper)) {
+ targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);
+ }
+ }
+ else if (helpersRemoved > 0) {
+ sourceEmitHelpers[i - helpersRemoved] = helper;
+ }
+ }
+ if (helpersRemoved > 0) {
+ sourceEmitHelpers.length -= helpersRemoved;
+ }
+ }
+ ts.moveEmitHelpers = moveEmitHelpers;
+ function compareEmitHelpers(x, y) {
+ if (x === y)
+ return 0;
+ if (x.priority === y.priority)
+ return 0;
+ if (x.priority === undefined)
+ return 1;
+ if (y.priority === undefined)
+ return -1;
+ return ts.compareValues(x.priority, y.priority);
+ }
+ ts.compareEmitHelpers = compareEmitHelpers;
function setTextRange(node, location) {
if (location) {
node.pos = location.pos;
@@ -12889,8 +12939,8 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_14 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_14) ? name_14 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_11 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
if (node.kind === 235 && node.importClause) {
return getGeneratedNameForNode(node);
@@ -12933,221 +12983,291 @@ var ts;
function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) {
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
- function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
- var multiLine = false;
- var singleLine = false;
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- context.startLexicalEnvironment();
- if (ts.isBlock(body)) {
- statementOffset = addPrologueDirectives(statements, body.statements, false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
- addRestParameterIfNeeded(statements, node, false);
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
+ function getInitializerOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.initializer;
}
- else {
- ts.Debug.assert(node.kind === 185);
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = createReturn(expression, body);
- setEmitFlags(returnStatement, 12288 | 1024 | 32768);
- statements.push(returnStatement);
- closeBraceLocation = body;
+ if (ts.isPropertyAssignment(bindingElement)) {
+ return ts.isAssignmentExpression(bindingElement.initializer, true)
+ ? bindingElement.initializer.right
+ : undefined;
}
- var lexicalEnvironment = context.endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
+ if (ts.isShorthandPropertyAssignment(bindingElement)) {
+ return bindingElement.objectAssignmentInitializer;
}
- var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- setEmitFlags(block, 32);
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return bindingElement.right;
}
- if (closeBraceLocation) {
- setTokenSourceMapRange(block, 17, closeBraceLocation);
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
}
- setOriginalNode(block, node.body);
- return block;
}
- ts.transformFunctionBody = transformFunctionBody;
- function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
- if (node.transformFlags & 524288 && node.kind !== 185) {
- captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
+ ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
+ function getTargetOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ return bindingElement.name;
+ }
+ if (ts.isObjectLiteralElementLike(bindingElement)) {
+ switch (bindingElement.kind) {
+ case 257:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
+ case 258:
+ return bindingElement.name;
+ case 259:
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return undefined;
}
+ if (ts.isAssignmentExpression(bindingElement, true)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.left);
+ }
+ if (ts.isSpreadExpression(bindingElement)) {
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ return bindingElement;
}
- ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
- function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration("_this", undefined, initializer)
- ]), originalStatement);
- setEmitFlags(captureThisStatement, 49152 | 8388608);
- setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
+ ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 144:
+ case 174:
+ return bindingElement.dotDotDotToken;
+ case 196:
+ case 259:
+ return bindingElement;
+ }
+ return undefined;
}
- ts.captureThisForNode = captureThisForNode;
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 2097152) !== 0;
+ ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 174:
+ if (bindingElement.propertyName) {
+ var propertyName = bindingElement.propertyName;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 257:
+ if (bindingElement.name) {
+ var propertyName = bindingElement.name;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 259:
+ return bindingElement.name;
+ }
+ var target = getTargetOfBindingOrAssignmentElement(bindingElement);
+ if (target && ts.isPropertyName(target)) {
+ return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)
+ ? target.expression
+ : target;
+ }
+ ts.Debug.fail("Invalid property name for binding element.");
}
- function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
+ function getElementsOfBindingOrAssignmentPattern(name) {
+ switch (name.kind) {
+ case 172:
+ case 173:
+ case 175:
+ return name.elements;
+ case 176:
+ return name.properties;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_15 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- if (dotDotDotToken) {
- continue;
+ }
+ ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
+ function convertToArrayAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpread(element.name, element), element);
}
- if (ts.isBindingPattern(name_15)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_15, initializer, visitor, convertObjectRest);
+ var expression = convertToAssignmentElementTarget(element.name);
+ return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;
+ }
+ ts.Debug.assertNode(element, ts.isExpression);
+ return element;
+ }
+ ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;
+ function convertToObjectAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpreadAssignment(element.name, element), element);
}
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_15, initializer, visitor);
+ if (element.propertyName) {
+ var expression = convertToAssignmentElementTarget(element.name);
+ return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);
}
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);
}
+ ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);
+ return element;
}
- ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
- var temp = getGeneratedNameForNode(parameter);
- if (name.elements.length > 0) {
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608));
+ ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
+ function convertToAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173:
+ case 175:
+ return convertToArrayAssignmentPattern(node);
+ case 172:
+ case 176:
+ return convertToObjectAssignmentPattern(node);
}
- else if (initializer) {
- statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608));
+ }
+ ts.convertToAssignmentPattern = convertToAssignmentPattern;
+ function convertToObjectAssignmentPattern(node) {
+ if (ts.isObjectBindingPattern(node)) {
+ return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);
}
+ ts.Debug.assertNode(node, ts.isObjectLiteralExpression);
+ return node;
}
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
- createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536), setEmitFlags(initializer, 1536 | getEmitFlags(initializer)), parameter))
- ], parameter), 32 | 1024 | 12288), undefined, parameter);
- statement.startsOnNewLine = true;
- setEmitFlags(statement, 12288 | 1024 | 8388608);
- statements.push(statement);
+ ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;
+ function convertToArrayAssignmentPattern(node) {
+ if (ts.isArrayBindingPattern(node)) {
+ return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);
+ }
+ ts.Debug.assertNode(node, ts.isArrayLiteralExpression);
+ return node;
}
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;
+ function convertToAssignmentElementTarget(node) {
+ if (ts.isBindingPattern(node)) {
+ return convertToAssignmentPattern(node);
+ }
+ ts.Debug.assertNode(node, ts.isExpression);
+ return node;
}
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;
+ function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var exportedNames;
+ var hasExportDefault = false;
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);
+ var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));
+ if (externalHelpersImportDeclaration) {
+ externalImports.push(externalHelpersImportDeclaration);
}
- var declarationName = getMutableClone(parameter.name);
- setEmitFlags(declarationName, 1536);
- var expressionName = getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = createLoopVariable();
- statements.push(setEmitFlags(createVariableStatement(undefined, createVariableDeclarationList([
- createVariableDeclaration(declarationName, undefined, createArrayLiteral([]))
- ]), parameter), 8388608));
- var forStatement = createFor(createVariableDeclarationList([
- createVariableDeclaration(temp, undefined, createLiteral(restIndex))
- ], parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"), parameter), createPostfixIncrement(temp, parameter), createBlock([
- startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)), parameter))
- ]));
- setEmitFlags(forStatement, 8388608);
- startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
- function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- var counter = convertObjectRest ? undefined : createLoopVariable();
- var rhsReference = expression.kind === 70
- ? createUniqueName(expression.text)
- : createTempVariable(undefined);
- var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor, undefined, convertObjectRest);
- var declarationList = createVariableDeclarationList(declarations, initializer);
- setOriginalNode(declarationList, initializer);
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(createVariableStatement(undefined, declarationList));
- }
- else {
- statements.push(createVariableStatement(undefined, setOriginalNode(createVariableDeclarationList([
- createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(undefined), undefined, createElementAccess(rhsReference, counter))
- ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 235:
+ externalImports.push(node);
+ break;
+ case 234:
+ if (node.moduleReference.kind === 245) {
+ externalImports.push(node);
+ }
+ break;
+ case 241:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ externalImports.push(node);
+ }
+ }
+ else {
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ if (!uniqueExports[specifier.name.text]) {
+ var name_12 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_12.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_12)
+ || resolver.getReferencedValueDeclaration(name_12);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = true;
+ exportedNames = ts.append(exportedNames, specifier.name);
+ }
+ }
+ }
+ break;
+ case 240:
+ if (node.isExportEquals && !exportEquals) {
+ exportEquals = node;
+ }
+ break;
+ case 205:
+ if (ts.hasModifier(node, 1)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
+ }
+ }
+ break;
+ case 225:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_13 = node.name;
+ if (!uniqueExports[name_13.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13);
+ uniqueExports[name_13.text] = true;
+ exportedNames = ts.append(exportedNames, name_13);
+ }
+ }
+ }
+ break;
+ case 226:
+ if (ts.hasModifier(node, 1)) {
+ if (ts.hasModifier(node, 512)) {
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ var name_14 = node.name;
+ if (!uniqueExports[name_14.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14);
+ uniqueExports[name_14.text] = true;
+ exportedNames = ts.append(exportedNames, name_14);
+ }
+ }
+ }
+ break;
}
}
- else {
- var assignment = createAssignment(initializer, elementAccess);
- if (ts.isDestructuringAssignment(assignment)) {
- statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment, false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
- }
- else {
- assignment.end = initializer.end;
- statements.push(createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
+ }
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
+ }
}
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
- }
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = true;
+ exportedNames = ts.append(exportedNames, decl.name);
}
}
- setEmitFlags(expression, 1536 | getEmitFlags(expression));
- var body = createBlock(createNodeArray(statements, statementsLocation), bodyLocation);
- setEmitFlags(body, 1536 | 12288);
- var forStatement;
- if (convertObjectRest) {
- forStatement = createForOf(createVariableDeclarationList([
- createVariableDeclaration(rhsReference, undefined, undefined, node.expression)
- ], node.expression), node.expression, body, node);
- }
- else {
- forStatement = createFor(setEmitFlags(createVariableDeclarationList([
- createVariableDeclaration(counter, undefined, createLiteral(0), ts.moveRangePos(node.expression, -1)),
- createVariableDeclaration(rhsReference, undefined, expression, node.expression)
- ], node.expression), 16777216), createLessThan(counter, createPropertyAccess(rhsReference, "length"), node.expression), createPostfixIncrement(counter, node.expression), body, node);
- }
- setEmitFlags(forStatement, 8192);
- return forStatement;
+ return exportedNames;
}
- ts.convertForOf = convertForOf;
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -13545,29 +13665,31 @@ var ts;
visitNode(cbNode, node.type);
case 278:
return visitNodes(cbNodes, node.tags);
- case 280:
+ case 281:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 281:
- return visitNode(cbNode, node.typeExpression);
case 282:
return visitNode(cbNode, node.typeExpression);
case 283:
- return visitNodes(cbNodes, node.typeParameters);
+ return visitNode(cbNode, node.typeExpression);
+ case 280:
+ return visitNode(cbNode, node.typeExpression);
case 284:
+ return visitNodes(cbNodes, node.typeParameters);
+ case 285:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 286:
+ case 287:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 285:
+ case 286:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 293:
+ case 294:
return visitNode(cbNode, node.expression);
- case 287:
+ case 288:
return visitNode(cbNode, node.literal);
}
}
@@ -13691,7 +13813,7 @@ var ts;
return sourceFile;
}
function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ var comments = ts.getJSDocCommentRanges(node, sourceFile.text);
if (comments) {
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var comment = comments_2[_i];
@@ -13699,10 +13821,10 @@ var ts;
if (!jsDoc) {
continue;
}
- if (!node.jsDocComments) {
- node.jsDocComments = [];
+ if (!node.jsDoc) {
+ node.jsDoc = [];
}
- node.jsDocComments.push(jsDoc);
+ node.jsDoc.push(jsDoc);
}
}
return node;
@@ -13717,12 +13839,12 @@ var ts;
var saveParent = parent;
parent = n;
forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
+ if (n.jsDoc) {
+ for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ jsDoc.parent = n;
+ parent = jsDoc;
+ forEachChild(jsDoc, visitNode);
}
}
parent = saveParent;
@@ -16899,8 +17021,8 @@ var ts;
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
}
if (decorators || modifiers) {
- var name_16 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_16, undefined);
+ var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined);
}
ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
@@ -17547,7 +17669,7 @@ var ts;
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(287);
+ var result = createNode(288);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -17727,6 +17849,9 @@ var ts;
var tag;
if (tagName) {
switch (tagName.text) {
+ case "augments":
+ tag = parseAugmentsTag(atToken, tagName);
+ break;
case "param":
tag = parseParamTag(atToken, tagName);
break;
@@ -17866,7 +17991,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(280, atToken.pos);
+ var result = createNode(281, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -17877,20 +18002,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 281; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(281, atToken.pos);
+ var result = createNode(282, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 282; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(282, atToken.pos);
+ var result = createNode(283, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -17905,17 +18030,25 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(285, atToken.pos);
+ var result = createNode(286, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
return finishNode(result);
}
+ function parseAugmentsTag(atToken, tagName) {
+ var typeExpression = tryParseTypeExpression();
+ var result = createNode(280, atToken.pos);
+ result.atToken = atToken;
+ result.tagName = tagName;
+ result.typeExpression = typeExpression;
+ return finishNode(result);
+ }
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(284, atToken.pos);
+ var typedefTag = createNode(285, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(0);
@@ -17932,8 +18065,8 @@ var ts;
if (typeExpression.type.kind === 272) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70) {
- var name_17 = jsDocTypeReference.name;
- if (name_17.text === "Object") {
+ var name_16 = jsDocTypeReference.name;
+ if (name_16.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -17947,7 +18080,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(286, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(287, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -18032,19 +18165,19 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 283; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 284; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
var typeParameters = createNodeArray();
while (true) {
- var name_18 = parseJSDocIdentifierName();
+ var name_17 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_18) {
+ if (!name_17) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(143, name_18.pos);
- typeParameter.name = name_18;
+ var typeParameter = createNode(143, name_17.pos);
+ typeParameter.name = name_17;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25) {
@@ -18055,7 +18188,7 @@ var ts;
break;
}
}
- var result = createNode(283, atToken.pos);
+ var result = createNode(284, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -18135,8 +18268,8 @@ var ts;
ts.Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
forEachChild(jsDocComment, visitNode, visitArray);
}
@@ -18520,7 +18653,7 @@ var ts;
}
if (node.name.kind === 142) {
var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
@@ -18565,7 +18698,7 @@ var ts;
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 284:
+ case 285:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
if (parentNode && parentNode.kind === 205) {
@@ -18640,7 +18773,7 @@ var ts;
}
}
else {
- var isJSDocTypedefInJSDocNamespace = node.kind === 284 &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 285 &&
node.name &&
node.name.kind === 70 &&
node.name.isInJSDocNamespace;
@@ -18745,12 +18878,35 @@ var ts;
subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);
}
}
+ function bindEach(nodes) {
+ if (nodes === undefined) {
+ return;
+ }
+ if (skipTransformFlagAggregation) {
+ ts.forEach(nodes, bind);
+ }
+ else {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
+ var node = nodes_2[_i];
+ bind(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
+ }
+ }
+ function bindEachChild(node) {
+ ts.forEachChild(node, bind, bindEach);
+ }
function bindChildrenWorker(node) {
- if (ts.isInJavaScriptFile(node) && node.jsDocComments) {
- ts.forEach(node.jsDocComments, bind);
+ if (ts.isInJavaScriptFile(node) && node.jsDoc) {
+ ts.forEach(node.jsDoc, bind);
}
if (checkUnreachable(node)) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
return;
}
switch (node.kind) {
@@ -18815,7 +18971,7 @@ var ts;
bindCallExpressionFlow(node);
break;
default:
- ts.forEachChild(node, bind);
+ bindEachChild(node);
break;
}
}
@@ -19118,7 +19274,7 @@ var ts;
}
return undefined;
}
- function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
+ function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
var flowLabel = node.kind === 215 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
@@ -19131,11 +19287,11 @@ var ts;
var activeLabel = findActiveLabel(node.label.text);
if (activeLabel) {
activeLabel.referenced = true;
- bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
+ bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
}
}
else {
- bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
+ bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
}
}
function bindTryStatement(node) {
@@ -19186,6 +19342,8 @@ var ts;
currentFlow = finishFlowLabel(postSwitchLabel);
}
function bindCaseBlock(node) {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
var clauses = node.clauses;
var fallthroughFlow = unreachableFlow;
for (var i = 0; i < clauses.length; i++) {
@@ -19205,13 +19363,15 @@ var ts;
errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);
}
}
+ clauses.transformFlags = subtreeTransformFlags | 536870912;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
}
function bindCaseClause(node) {
var saveCurrentFlow = currentFlow;
currentFlow = preSwitchCaseFlow;
bind(node.expression);
currentFlow = saveCurrentFlow;
- ts.forEach(node.statements, bind);
+ bindEach(node.statements);
}
function pushActiveLabel(name, breakTarget, continueTarget) {
var activeLabel = {
@@ -19297,19 +19457,19 @@ var ts;
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
- ts.forEachChild(node, bind);
+ bindEachChild(node);
currentFalseTarget = currentTrueTarget;
currentTrueTarget = saveTrueTarget;
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 || node.operator === 43) {
bindAssignmentTargetFlow(node.operand);
}
@@ -19327,7 +19487,7 @@ var ts;
}
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
if (operator === 57 && node.left.kind === 178) {
@@ -19340,7 +19500,7 @@ var ts;
}
}
function bindDeleteExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.expression.kind === 177) {
bindAssignmentTargetFlow(node.expression);
}
@@ -19373,7 +19533,7 @@ var ts;
}
}
function bindVariableDeclarationFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) {
bindInitializedVariableFlow(node);
}
@@ -19384,12 +19544,12 @@ var ts;
expr = expr.expression;
}
if (expr.kind === 184 || expr.kind === 185) {
- ts.forEach(node.typeArguments, bind);
- ts.forEach(node.arguments, bind);
+ bindEach(node.typeArguments);
+ bindEach(node.arguments);
bind(node.expression);
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
}
if (node.expression.kind === 177) {
var propertyAccess = node.expression;
@@ -19405,7 +19565,7 @@ var ts;
case 229:
case 176:
case 161:
- case 286:
+ case 287:
case 270:
return 1;
case 227:
@@ -19474,7 +19634,7 @@ var ts;
case 176:
case 227:
case 270:
- case 286:
+ case 287:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
case 158:
case 159:
@@ -19768,8 +19928,8 @@ var ts;
}
function updateStrictModeStatementList(statements) {
if (!inStrictMode) {
- for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
- var statement = statements_1[_i];
+ for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
+ var statement = statements_2[_i];
if (!ts.isPrologueDirective(statement)) {
return;
}
@@ -19789,7 +19949,7 @@ var ts;
case 70:
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 284) {
+ while (parentNode && parentNode.kind !== 285) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288, 793064);
@@ -19859,7 +20019,7 @@ var ts;
case 146:
case 271:
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0);
- case 285:
+ case 286:
return bindJSDocProperty(node);
case 257:
case 258:
@@ -19903,7 +20063,7 @@ var ts;
return bindFunctionOrConstructorType(node);
case 161:
case 170:
- case 286:
+ case 287:
case 270:
return bindAnonymousDeclaration(node, 2048, "__type");
case 176:
@@ -19922,7 +20082,7 @@ var ts;
return bindClassLikeDeclaration(node);
case 227:
return bindBlockScopedDeclaration(node, 64, 792968);
- case 284:
+ case 285:
if (!node.fullName || node.fullName.kind === 70) {
return bindBlockScopedDeclaration(node, 524288, 793064);
}
@@ -19996,12 +20156,12 @@ var ts;
return;
}
else {
- var parent_5 = node.parent;
- if (!ts.isExternalModule(parent_5)) {
+ var parent_4 = node.parent;
+ if (!ts.isExternalModule(parent_4)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_5.isDeclarationFile) {
+ if (!parent_4.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -20287,12 +20447,12 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608
+ if (subtreeFlags & 524288
|| isSuperOrSuperProperty(expression, expressionKind)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
@@ -20311,28 +20471,28 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~545281365;
+ return transformFlags & ~537396545;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
if (operatorTokenKind === 57 && leftKind === 176) {
- transformFlags |= 48 | 3072 | 49152;
+ transformFlags |= 8 | 192 | 3072;
}
else if (operatorTokenKind === 57 && leftKind === 175) {
- transformFlags |= 3072 | 49152;
+ transformFlags |= 192 | 3072;
}
else if (operatorTokenKind === 39
|| operatorTokenKind === 61) {
- transformFlags |= 768;
+ transformFlags |= 32;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20342,21 +20502,21 @@ var ts;
var dotDotDotToken = node.dotDotDotToken;
if (node.questionToken
|| node.type
- || subtreeFlags & 65536
+ || subtreeFlags & 4096
|| ts.isThisIdentifier(name)) {
transformFlags |= 3;
}
if (modifierFlags & 92) {
- transformFlags |= 3 | 4194304;
+ transformFlags |= 3 | 262144;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 67108864 || initializer || dotDotDotToken) {
- transformFlags |= 3072 | 2097152;
+ if (subtreeFlags & 8388608 || initializer || dotDotDotToken) {
+ transformFlags |= 192 | 131072;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~536872257;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20367,11 +20527,11 @@ var ts;
|| expressionKind === 182) {
transformFlags |= 3;
}
- if (expressionTransformFlags & 16384) {
- transformFlags |= 16384;
+ if (expressionTransformFlags & 1024) {
+ transformFlags |= 1024;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -20380,35 +20540,35 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 3072;
- if ((subtreeFlags & 4390912)
+ transformFlags = subtreeFlags | 192;
+ if ((subtreeFlags & 274432)
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeClassExpression(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
- if (subtreeFlags & 4390912
+ var transformFlags = subtreeFlags | 192;
+ if (subtreeFlags & 274432
|| node.typeParameters) {
transformFlags |= 3;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~559895893;
+ return transformFlags & ~539358529;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 107:
transformFlags |= 3;
@@ -20418,23 +20578,23 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~537920833;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.typeArguments) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20442,11 +20602,14 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeMethod(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (node.decorators
|| ts.hasModifier(node, 2270)
|| node.typeParameters
@@ -20454,14 +20617,17 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20471,16 +20637,19 @@ var ts;
|| !node.body) {
transformFlags |= 3;
}
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
+ }
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~975983957;
+ return transformFlags & ~601015617;
}
function computePropertyDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags | 3;
if (node.initializer) {
- transformFlags |= 131072;
+ transformFlags |= 8192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -20490,27 +20659,27 @@ var ts;
transformFlags = 3;
}
else {
- transformFlags = subtreeFlags | 268435456;
+ transformFlags = subtreeFlags | 33554432;
if (modifierFlags & 2270
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (modifierFlags & 256) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20520,63 +20689,60 @@ var ts;
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 2621440) {
- transformFlags |= 3072;
+ if (subtreeFlags & 163840) {
+ transformFlags |= 192;
}
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- transformFlags |= 12288;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ transformFlags |= 768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~980243797;
+ return transformFlags & ~601281857;
}
function computeArrowFunction(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 3072;
+ var transformFlags = subtreeFlags | 192;
if (ts.hasModifier(node, 2270)
|| node.typeParameters
|| node.type) {
transformFlags |= 3;
}
if (ts.hasModifier(node, 256)) {
- transformFlags |= 192;
+ transformFlags |= 16;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
- if (subtreeFlags & 262144) {
- transformFlags |= 524288;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 32768;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~979719509;
+ return transformFlags & ~601249089;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
if (expressionKind === 96) {
- transformFlags |= 262144;
+ transformFlags |= 16384;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var nameKind = node.name.kind;
- if (nameKind === 172) {
- transformFlags |= 48 | 3072 | 67108864;
- }
- else if (nameKind === 173) {
- transformFlags |= 3072 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
if (node.type) {
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -20587,21 +20753,21 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- if (declarationListTransformFlags & 67108864) {
- transformFlags |= 3072;
+ if (declarationListTransformFlags & 8388608) {
+ transformFlags |= 192;
}
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (subtreeFlags & 33554432
+ if (subtreeFlags & 4194304
&& ts.isIterationStatement(node, true)) {
- transformFlags |= 3072;
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -20609,15 +20775,15 @@ var ts;
transformFlags |= 3;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.transformFlags & 16384) {
- transformFlags |= 3072;
+ if (node.expression.transformFlags & 1024) {
+ transformFlags |= 192;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~536892757;
+ return transformFlags & ~536872257;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3;
@@ -20626,26 +20792,26 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~839734613;
+ return transformFlags & ~574674241;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 268435456;
- if (subtreeFlags & 67108864) {
- transformFlags |= 3072;
+ var transformFlags = subtreeFlags | 33554432;
+ if (subtreeFlags & 8388608) {
+ transformFlags |= 192;
}
if (node.flags & 3) {
- transformFlags |= 3072 | 33554432;
+ transformFlags |= 192 | 4194304;
}
node.transformFlags = transformFlags | 536870912;
- return transformFlags & ~604001621;
+ return transformFlags & ~546309441;
}
function computeOther(node, kind, subtreeFlags) {
var transformFlags = subtreeFlags;
- var excludeFlags = 536892757;
+ var excludeFlags = 536872257;
switch (kind) {
case 119:
case 189:
- transformFlags |= 192;
+ transformFlags |= 16;
break;
case 113:
case 111:
@@ -20669,10 +20835,10 @@ var ts;
case 250:
case 251:
case 252:
- transformFlags |= 12;
+ transformFlags |= 4;
break;
case 213:
- transformFlags |= 48;
+ transformFlags |= 8;
case 12:
case 13:
case 14:
@@ -20681,10 +20847,10 @@ var ts;
case 181:
case 258:
case 114:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 195:
- transformFlags |= 3072 | 134217728;
+ transformFlags |= 192 | 16777216;
break;
case 118:
case 132:
@@ -20721,73 +20887,79 @@ var ts;
excludeFlags = -3;
break;
case 142:
- transformFlags |= 16777216;
- if (subtreeFlags & 262144) {
- transformFlags |= 1048576;
+ transformFlags |= 2097152;
+ if (subtreeFlags & 16384) {
+ transformFlags |= 65536;
}
break;
case 196:
+ transformFlags |= 192 | 524288;
+ break;
case 259:
- transformFlags |= 8388608;
+ transformFlags |= 8 | 1048576;
break;
- case 174:
- if (node.dotDotDotToken) {
- transformFlags |= 8388608;
- }
case 96:
- transformFlags |= 3072;
+ transformFlags |= 192;
break;
case 98:
- transformFlags |= 262144;
+ transformFlags |= 16384;
break;
case 172:
- case 173:
- if (subtreeFlags & 8388608) {
- transformFlags |= 48 | 67108864;
+ transformFlags |= 192 | 8388608;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 8 | 1048576;
}
- else {
- transformFlags |= 3072 | 67108864;
+ excludeFlags = 537396545;
+ break;
+ case 173:
+ transformFlags |= 192 | 8388608;
+ excludeFlags = 537396545;
+ break;
+ case 174:
+ transformFlags |= 192;
+ if (node.dotDotDotToken) {
+ transformFlags |= 524288;
}
break;
case 145:
- transformFlags |= 3 | 65536;
+ transformFlags |= 3 | 4096;
break;
case 176:
- excludeFlags = 554784085;
- if (subtreeFlags & 16777216) {
- transformFlags |= 3072;
+ excludeFlags = 540087617;
+ if (subtreeFlags & 2097152) {
+ transformFlags |= 192;
}
- if (subtreeFlags & 1048576) {
- transformFlags |= 262144;
+ if (subtreeFlags & 65536) {
+ transformFlags |= 16384;
}
- if (subtreeFlags & 8388608) {
- transformFlags |= 48;
+ if (subtreeFlags & 1048576) {
+ transformFlags |= 8;
}
break;
case 175:
case 180:
- excludeFlags = 545281365;
- if (subtreeFlags & 8388608) {
- transformFlags |= 3072;
+ excludeFlags = 537396545;
+ if (subtreeFlags & 524288) {
+ transformFlags |= 192;
}
break;
case 209:
case 210:
case 211:
case 212:
- if (subtreeFlags & 33554432) {
- transformFlags |= 3072;
+ if (subtreeFlags & 4194304) {
+ transformFlags |= 192;
}
break;
case 261:
- if (subtreeFlags & 524288) {
- transformFlags |= 3072;
+ if (subtreeFlags & 32768) {
+ transformFlags |= 192;
}
break;
case 216:
case 214:
case 215:
- transformFlags |= 268435456;
+ transformFlags |= 33554432;
break;
}
node.transformFlags = transformFlags | 536870912;
@@ -20801,27 +20973,27 @@ var ts;
case 179:
case 180:
case 175:
- return 545281365;
+ return 537396545;
case 230:
- return 839734613;
+ return 574674241;
case 144:
- return 604001621;
+ return 536872257;
case 185:
- return 979719509;
+ return 601249089;
case 184:
case 225:
- return 980243797;
+ return 601281857;
case 224:
- return 604001621;
+ return 546309441;
case 226:
case 197:
- return 559895893;
+ return 539358529;
case 150:
- return 975983957;
+ return 601015617;
case 149:
case 151:
case 152:
- return 975983957;
+ return 601015617;
case 118:
case 132:
case 129:
@@ -20839,9 +21011,14 @@ var ts;
case 228:
return -3;
case 176:
- return 554784085;
+ return 540087617;
+ case 256:
+ return 537920833;
+ case 172:
+ case 173:
+ return 537396545;
default:
- return 536892757;
+ return 536872257;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -20933,6 +21110,7 @@ var ts;
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
isOptionalParameter: isOptionalParameter,
+ tryGetMemberInModuleExports: tryGetMemberInModuleExports,
tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
return tryFindAmbientModule(moduleName, false);
}
@@ -20942,6 +21120,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var indexedAccessTypes = ts.createMap();
var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 | 67108864, "unknown");
var resolvingSymbol = createSymbol(67108864, "__resolving__");
@@ -20961,7 +21140,6 @@ var ts;
var voidType = createIntrinsicType(1024, "void");
var neverType = createIntrinsicType(8192, "never");
var silentNeverType = createIntrinsicType(8192, "never");
- var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type");
emptyTypeLiteralSymbol.members = ts.createMap();
@@ -21511,6 +21689,7 @@ var ts;
if (!errorLocation ||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
!checkAndReportErrorForExtendingInterface(errorLocation) &&
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg));
}
@@ -21587,6 +21766,16 @@ var ts;
return undefined;
}
}
+ function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
+ if (meaning === 1920) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
+ if (symbol) {
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);
+ return true;
+ }
+ }
+ return false;
+ }
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
if (meaning & (107455 & ~1024)) {
var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined));
@@ -21692,28 +21881,28 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_19 = specifier.propertyName || specifier.name;
- if (name_19.text) {
+ var name_18 = specifier.propertyName || specifier.name;
+ if (name_18.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_19.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_19.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text);
}
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_19.text);
- if (!symbolFromModule && allowSyntheticDefaultImports && name_19.text === "default") {
+ var symbolFromModule = getExportOfModule(targetSymbol, name_18.text);
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_19, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_19));
+ error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18));
}
return symbol;
}
@@ -21938,6 +22127,12 @@ var ts;
function getExportsOfModuleAsArray(moduleSymbol) {
return symbolsToArray(getExportsOfModule(moduleSymbol));
}
+ function tryGetMemberInModuleExports(memberName, moduleSymbol) {
+ var symbolTable = getExportsOfModule(moduleSymbol);
+ if (symbolTable) {
+ return symbolTable[memberName];
+ }
+ }
function getExportsOfSymbol(symbol) {
return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
@@ -22453,9 +22648,9 @@ var ts;
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2));
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
- var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_6) {
- walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false);
+ var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_5) {
+ walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false);
}
}
if (accessibleSymbolChain) {
@@ -22588,12 +22783,12 @@ var ts;
var length_1 = outerTypeParameters.length;
while (i < length_1) {
var start = i;
- var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_7, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);
writePunctuation(writer, 22);
}
}
@@ -23017,12 +23212,12 @@ var ts;
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_8 = getDeclarationContainer(node);
+ var parent_7 = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 234 && parent_8.kind !== 261 && ts.isInAmbientContext(parent_8))) {
- return isGlobalSourceFile(parent_8);
+ !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) {
+ return isGlobalSourceFile(parent_7);
}
- return isDeclarationVisible(parent_8);
+ return isDeclarationVisible(parent_7);
case 147:
case 146:
case 151:
@@ -23178,15 +23373,15 @@ var ts;
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression);
}
function getRestType(source, properties, symbol) {
ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now.");
var members = ts.createMap();
var names = ts.createMap();
for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var name_20 = properties_2[_i];
- names[ts.getTextOfPropertyName(name_20)] = true;
+ var name_19 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_19)] = true;
}
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
var prop = _b[_a];
@@ -23224,26 +23419,26 @@ var ts;
var literalMembers = [];
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 198 && !element.dotDotDotToken) {
+ if (!element.dotDotDotToken) {
literalMembers.push(element.propertyName || element.name);
}
}
type = getRestType(parentType, literalMembers, declaration.symbol);
}
else {
- var name_21 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_21)) {
+ var name_20 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_20)) {
return anyType;
}
if (declaration.initializer) {
getContextualType(declaration.initializer);
}
- var text = ts.getTextOfPropertyName(name_21);
+ var text = ts.getTextOfPropertyName(name_20);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) ||
getIndexTypeOfType(parentType, 0);
if (!type) {
- error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_21));
+ error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20));
return unknownType;
}
}
@@ -23277,29 +23472,9 @@ var ts;
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
- if (jsDocType) {
- return getTypeFromTypeNode(jsDocType);
- }
- }
- function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var typeTag = ts.getJSDocTypeTag(declaration);
- if (typeTag && typeTag.typeExpression) {
- return typeTag.typeExpression.type;
- }
- if (declaration.kind === 223 &&
- declaration.parent.kind === 224 &&
- declaration.parent.parent.kind === 205) {
- var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
- if (annotation && annotation.typeExpression) {
- return annotation.typeExpression.type;
- }
- }
- else if (declaration.kind === 144) {
- var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type;
- }
+ var jsdocType = ts.getJSDocType(declaration);
+ if (jsdocType) {
+ return getTypeFromTypeNode(jsdocType);
}
return undefined;
}
@@ -23322,7 +23497,8 @@ var ts;
}
}
if (declaration.parent.parent.kind === 212) {
- return stringType;
+ var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
+ return indexType.flags & (16384 | 262144) ? indexType : stringType;
}
if (declaration.parent.parent.kind === 213) {
return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType;
@@ -23333,7 +23509,8 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
+ if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) &&
+ declaration.kind === 223 && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) {
if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -23472,7 +23649,7 @@ var ts;
if (declaration.kind === 240) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 2097152 && declaration.kind === 285 && declaration.typeExpression) {
+ if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
if (!pushTypeResolution(symbol, 0)) {
@@ -23482,9 +23659,9 @@ var ts;
if (declaration.kind === 192 ||
declaration.kind === 177 && declaration.parent.kind === 192) {
if (declaration.flags & 2097152) {
- var typeTag = ts.getJSDocTypeTag(declaration.parent);
- if (typeTag && typeTag.typeExpression) {
- return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
+ var jsdocType = ts.getJSDocType(declaration.parent);
+ if (jsdocType) {
+ return links.type = getTypeFromTypeNode(jsdocType);
}
}
var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ?
@@ -23785,6 +23962,13 @@ var ts;
}
baseType = getReturnTypeOfSignature(constructors[0]);
}
+ var valueDecl = type.symbol.valueDeclaration;
+ if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {
+ var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);
+ if (augTag) {
+ baseType = getTypeFromTypeNode(augTag.typeExpression.type);
+ }
+ }
if (baseType === unknownType) {
return;
}
@@ -23793,7 +23977,7 @@ var ts;
return;
}
if (type === baseType || hasBaseType(baseType, type)) {
- error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
+ error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
return;
}
if (type.resolvedBaseTypes === emptyArray) {
@@ -23895,7 +24079,7 @@ var ts;
if (!pushTypeResolution(symbol, 2)) {
return unknownType;
}
- var declaration = ts.getDeclarationOfKind(symbol, 284);
+ var declaration = ts.getDeclarationOfKind(symbol, 285);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -24382,6 +24566,7 @@ var ts;
var members = ts.createMap();
var stringIndexInfo;
var numberIndexInfo;
+ setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var typeParameter = getTypeParameterFromMappedType(type);
var constraintType = getConstraintTypeFromMappedType(type);
var templateType = getTemplateTypeFromMappedType(type);
@@ -24426,6 +24611,9 @@ var ts;
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
unknownType);
}
+ function getErasedTemplateTypeFromMappedType(type) {
+ return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
+ }
function isGenericMappedType(type) {
if (getObjectFlags(type) & 32) {
var constraintType = getConstraintTypeFromMappedType(type);
@@ -24513,14 +24701,18 @@ var ts;
}
return type.resolvedApparentType;
}
+ function getApparentTypeOfIndexedAccess(type) {
+ return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;
+ }
function getApparentType(type) {
- var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : type;
- return t.flags & 34 ? globalStringType :
+ var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :
+ type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :
+ type;
+ return t.flags & 262178 ? globalStringType :
t.flags & 340 ? globalNumberType :
t.flags & 136 ? globalBooleanType :
t.flags & 512 ? getGlobalESSymbolType() :
- t.flags & 262144 ? stringOrNumberType :
- t;
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -24693,13 +24885,16 @@ var ts;
if (node.type && node.type.kind === 273) {
return true;
}
- var paramTag = ts.getCorrespondingJSDocParameterTag(node);
- if (paramTag) {
- if (paramTag.isBracketed) {
- return true;
- }
- if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 273;
+ var paramTags = ts.getJSDocParameterTags(node);
+ if (paramTags) {
+ for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {
+ var paramTag = paramTags_1[_i];
+ if (paramTag.isBracketed) {
+ return true;
+ }
+ if (paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 273;
+ }
}
}
}
@@ -25534,10 +25729,14 @@ var ts;
}
function getIndexType(type) {
return type.flags & 16384 ? getIndexTypeForTypeParameter(type) :
- type.flags & 1 || getIndexInfoOfType(type, 0) ? stringOrNumberType :
- getIndexInfoOfType(type, 1) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :
+ type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType :
getLiteralTypeFromPropertyNames(type);
}
+ function getIndexTypeOrString(type) {
+ var indexType = getIndexType(type);
+ return indexType !== neverType ? indexType : stringType;
+ }
function getTypeFromTypeOperatorNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -25551,10 +25750,6 @@ var ts;
type.indexType = indexType;
return type;
}
- function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
- var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
- return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
- }
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
var propName = indexType.flags & (32 | 64 | 256) ?
@@ -25577,7 +25772,7 @@ var ts;
return getTypeOfSymbol(prop);
}
}
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 | 340 | 512)) {
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 340 | 512)) {
if (isTypeAny(objectType)) {
return anyType;
}
@@ -25617,20 +25812,38 @@ var ts;
}
return unknownType;
}
+ function getIndexedAccessForMappedType(type, indexType, accessNode) {
+ var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined;
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
+ return unknownType;
+ }
+ var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);
+ var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
+ return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken);
+ }
function getIndexedAccessType(objectType, indexType, accessNode) {
- if (indexType.flags & 16384) {
- if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
- error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
- return unknownType;
+ if (indexType.flags & 16384 ||
+ objectType.flags & 16384 && indexType.flags & 262144 ||
+ isGenericMappedType(objectType)) {
+ if (accessNode) {
+ if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
+ error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
+ return unknownType;
+ }
+ }
+ if (isGenericMappedType(objectType)) {
+ return getIndexedAccessForMappedType(objectType, indexType, accessNode);
}
- return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ var id = objectType.id + "," + indexType.id;
+ return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
}
- var apparentType = getApparentType(objectType);
+ var apparentObjectType = getApparentType(objectType);
if (indexType.flags & 65536 && !(indexType.flags & 8190)) {
var propTypes = [];
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, false);
+ var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false);
if (propType === unknownType) {
return unknownType;
}
@@ -25638,7 +25851,7 @@ var ts;
}
return getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentType, indexType, accessNode, true);
+ return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -25655,6 +25868,7 @@ var ts;
type.aliasSymbol = getAliasSymbolForTypeNode(node);
type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
links.resolvedType = type;
+ getConstraintTypeFromMappedType(type);
}
return links.resolvedType;
}
@@ -25823,18 +26037,18 @@ var ts;
return nullType;
case 129:
return neverType;
- case 288:
- return nullType;
case 289:
- return undefinedType;
+ return nullType;
case 290:
+ return undefinedType;
+ case 291:
return neverType;
case 167:
case 98:
return getTypeFromThisTypeNode(node);
case 171:
return getTypeFromLiteralTypeNode(node);
- case 287:
+ case 288:
return getTypeFromLiteralTypeNode(node.literal);
case 157:
case 272:
@@ -25867,7 +26081,7 @@ var ts;
case 158:
case 159:
case 161:
- case 286:
+ case 287:
case 274:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 168:
@@ -26028,6 +26242,28 @@ var ts;
return result;
}
function instantiateMappedType(type, mapper) {
+ var constraintType = getConstraintTypeFromMappedType(type);
+ if (constraintType.flags & 262144) {
+ var typeParameter_1 = constraintType.type;
+ var mappedTypeParameter = mapper(typeParameter_1);
+ if (typeParameter_1 !== mappedTypeParameter) {
+ return mapType(mappedTypeParameter, function (t) {
+ if (isMappableType(t)) {
+ var replacementMapper = createUnaryTypeMapper(typeParameter_1, t);
+ var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);
+ combinedMapper.mappedTypes = mapper.mappedTypes;
+ return instantiateMappedObjectType(type, combinedMapper);
+ }
+ return t;
+ });
+ }
+ }
+ return instantiateMappedObjectType(type, mapper);
+ }
+ function isMappableType(type) {
+ return type.flags & (16384 | 32768 | 131072 | 524288);
+ }
+ function instantiateMappedObjectType(type, mapper) {
var result = createObjectType(32 | 64, type.symbol);
result.declaration = type.declaration;
result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
@@ -26386,7 +26622,7 @@ var ts;
return false;
if (target.flags & 1 || source.flags & 8192)
return true;
- if (source.flags & 34 && target.flags & 2)
+ if (source.flags & 262178 && target.flags & 2)
return true;
if (source.flags & 340 && target.flags & 4)
return true;
@@ -26510,11 +26746,6 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1;
- if (source.flags & 262144) {
- if (maybeTypeOfKind(target, 2) && maybeTypeOfKind(target, 4)) {
- return -1;
- }
- }
if (getObjectFlags(source) & 128 && source.flags & 1048576) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
@@ -26554,10 +26785,21 @@ var ts;
}
}
if (target.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(target);
- if (constraint && constraint.flags & 262144) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
- return result;
+ if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
+ if (!source.declaration.questionToken) {
+ var templateType = getTemplateTypeFromMappedType(source);
+ var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
+ if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
}
}
}
@@ -26574,16 +26816,32 @@ var ts;
}
}
}
+ else if (target.flags & 524288) {
+ if (source.flags & 524288 && source.indexType === target.indexType) {
+ if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384) {
- var constraint = getConstraintOfTypeParameter(source);
- if (!constraint || constraint.flags & 1) {
- constraint = emptyObjectType;
- }
- constraint = getTypeWithThisArgument(constraint, source);
- var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
- errorInfo = saveErrorInfo;
- return result;
+ if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
+ var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
+ var templateType = getTemplateTypeFromMappedType(target);
+ if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
+ return result;
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(source);
+ if (!constraint || constraint.flags & 1) {
+ constraint = emptyObjectType;
+ }
+ constraint = getTypeWithThisArgument(constraint, source);
+ var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
+ if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
+ }
}
}
else {
@@ -26592,22 +26850,12 @@ var ts;
return result;
}
}
- if (isGenericMappedType(target)) {
- if (isGenericMappedType(source)) {
- if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) &&
- (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) {
- return result;
- }
- }
- }
- else {
- var apparentSource = getApparentType(source);
- if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
- var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
- if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
- errorInfo = saveErrorInfo;
- return result;
- }
+ var apparentSource = getApparentType(source);
+ if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) {
+ var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190);
+ if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
}
}
}
@@ -26814,6 +27062,9 @@ var ts;
if (expandingFlags === 3) {
result = 1;
}
+ else if (isGenericMappedType(source) || isGenericMappedType(target)) {
+ result = mappedTypeRelatedTo(source, target, reportErrors);
+ }
else {
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
@@ -26841,6 +27092,33 @@ var ts;
}
return result;
}
+ function mappedTypeRelatedTo(source, target, reportErrors) {
+ if (isGenericMappedType(target)) {
+ if (isGenericMappedType(source)) {
+ var result_2;
+ if (relation === identityRelation) {
+ var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;
+ var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;
+ if (readonlyMatches && optionalMatches) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ else {
+ if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ }
+ }
+ else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {
+ return -1;
+ }
+ return 0;
+ }
function propertiesRelatedTo(source, target, reportErrors) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target);
@@ -27316,7 +27594,7 @@ var ts;
return type;
}
var types = [type];
- if (flags & 34)
+ if (flags & 262178)
types.push(emptyStringType);
if (flags & 340)
types.push(zeroType);
@@ -27651,19 +27929,6 @@ var ts;
}
}
else {
- if (getObjectFlags(target) & 32) {
- var constraintType = getConstraintTypeFromMappedType(target);
- if (getObjectFlags(source) & 32) {
- inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
- return;
- }
- if (constraintType.flags & 16384) {
- inferFromTypes(getIndexType(source), constraintType);
- inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
- return;
- }
- }
source = getApparentType(source);
if (source.flags & 32768) {
if (isInProcess(source, target)) {
@@ -27684,14 +27949,30 @@ var ts;
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
- inferFromProperties(source, target);
- inferFromSignatures(source, target, 0);
- inferFromSignatures(source, target, 1);
- inferFromIndexTypes(source, target);
+ inferFromObjectTypes(source, target);
depth--;
}
}
}
+ function inferFromObjectTypes(source, target) {
+ if (getObjectFlags(target) & 32) {
+ var constraintType = getConstraintTypeFromMappedType(target);
+ if (getObjectFlags(source) & 32) {
+ inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ if (constraintType.flags & 16384) {
+ inferFromTypes(getIndexType(source), constraintType);
+ inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ }
+ inferFromProperties(source, target);
+ inferFromSignatures(source, target, 0);
+ inferFromSignatures(source, target, 1);
+ inferFromIndexTypes(source, target);
+ }
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
@@ -28026,7 +28307,7 @@ var ts;
}
function getTypeWithDefault(type, defaultExpression) {
if (defaultExpression) {
- var defaultType = checkExpression(defaultExpression);
+ var defaultType = getTypeOfExpression(defaultExpression);
return getUnionType([getTypeWithFacts(type, 131072), defaultType]);
}
return type;
@@ -28049,7 +28330,7 @@ var ts;
function getAssignedTypeOfBinaryExpression(node) {
return node.parent.kind === 175 || node.parent.kind === 257 ?
getTypeWithDefault(getAssignedType(node), node.right) :
- checkExpression(node.right);
+ getTypeOfExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
@@ -28097,7 +28378,7 @@ var ts;
}
function getTypeOfInitializer(node) {
var links = getNodeLinks(node);
- return links.resolvedType || checkExpression(node);
+ return links.resolvedType || getTypeOfExpression(node);
}
function getInitialTypeOfVariableDeclaration(node) {
if (node.initializer) {
@@ -28150,7 +28431,7 @@ var ts;
}
function getTypeOfSwitchClause(clause) {
if (clause.kind === 253) {
- var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
+ var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@@ -28230,7 +28511,7 @@ var ts;
return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
}
function addEvolvingArrayElementType(evolvingArrayType, node) {
- var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
}
function createFinalArrayType(elementType) {
@@ -28278,7 +28559,7 @@ var ts;
parent.parent.operatorToken.kind === 57 &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
- isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 | 2048);
+ isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 | 2048);
return isLengthPushOrUnshift || isElementAssignment;
}
function maybeTypePredicateCall(node) {
@@ -28416,7 +28697,7 @@ var ts;
}
}
else {
- var indexType = checkExpression(node.left.argumentExpression);
+ var indexType = getTypeOfExpression(node.left.argumentExpression);
if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 | 2048)) {
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
}
@@ -28597,7 +28878,7 @@ var ts;
if (operator === 32 || operator === 34) {
assumeTrue = !assumeTrue;
}
- var valueType = checkExpression(value);
+ var valueType = getTypeOfExpression(value);
if (valueType.flags & 6144) {
if (!strictNullChecks) {
return type;
@@ -28669,7 +28950,7 @@ var ts;
}
return type;
}
- var rightType = checkExpression(expr.right);
+ var rightType = getTypeOfExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
@@ -28697,16 +28978,16 @@ var ts;
}
}
if (targetType) {
- return getNarrowedType(type, targetType, assumeTrue);
+ return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);
}
return type;
}
- function getNarrowedType(type, candidate, assumeTrue) {
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
if (!assumeTrue) {
- return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); });
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
}
if (type.flags & 65536) {
- var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); });
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
if (!(assignableType.flags & 8192)) {
return assignableType;
}
@@ -28733,7 +29014,7 @@ var ts;
var predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, predicateArgument)) {
return declaredType;
@@ -28746,7 +29027,7 @@ var ts;
var accessExpression = invokedExpression;
var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, possibleReference)) {
return declaredType;
@@ -28782,7 +29063,7 @@ var ts;
location = location.parent;
}
if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {
- var type = checkExpression(location);
+ var type = getTypeOfExpression(location);
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
return type;
}
@@ -29117,9 +29398,9 @@ var ts;
return anyType;
}
function getTypeForThisExpressionFromJSDoc(node) {
- var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274) {
- var jsDocFunctionType = typeTag.typeExpression.type;
+ var jsdocType = ts.getJSDocType(node);
+ if (jsdocType && jsdocType.kind === 274) {
+ var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
@@ -29304,11 +29585,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_22 = declaration.propertyName || declaration.name;
+ var name_21 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_22)) {
- var text = ts.getTextOfPropertyName(name_22);
+ !ts.isBindingPattern(name_21)) {
+ var text = ts.getTextOfPropertyName(name_21);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -29387,13 +29668,13 @@ var ts;
return undefined;
}
if (node === binaryExpression.right) {
- return checkExpression(binaryExpression.left);
+ return getTypeOfExpression(binaryExpression.left);
}
}
else if (operator === 53) {
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
- type = checkExpression(binaryExpression.left);
+ type = getTypeOfExpression(binaryExpression.left);
}
return type;
}
@@ -29699,7 +29980,7 @@ var ts;
var links = getNodeLinks(node.expression);
if (!links.resolvedType) {
links.resolvedType = checkExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 34 | 512)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 | 262178 | 512)) {
error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
@@ -29708,10 +29989,10 @@ var ts;
}
return links.resolvedType;
}
- function getObjectLiteralIndexInfo(node, properties, kind) {
+ function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {
var propTypes = [];
for (var i = 0; i < properties.length; i++) {
- if (kind === 0 || isNumericName(node.properties[i].name)) {
+ if (kind === 0 || isNumericName(propertyNodes[i + offset].name)) {
propTypes.push(getTypeOfSymbol(properties[i]));
}
}
@@ -29732,8 +30013,9 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var memberDecl = _a[_i];
+ var offset = 0;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
var member = memberDecl.symbol;
if (memberDecl.kind === 257 ||
memberDecl.kind === 258 ||
@@ -29794,6 +30076,7 @@ var ts;
return unknownType;
}
spread = getSpreadType(spread, type, false);
+ offset = i + 1;
continue;
}
else {
@@ -29814,8 +30097,8 @@ var ts;
propertiesArray.push(member);
}
if (contextualTypeHasPattern) {
- for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) {
- var prop = _c[_b];
+ for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {
+ var prop = _a[_i];
if (!propertiesTable[prop.name]) {
if (!(prop.flags & 536870912)) {
error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
@@ -29835,8 +30118,8 @@ var ts;
}
return createObjectLiteralType();
function createObjectLiteralType() {
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1) : undefined;
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined;
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576;
result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064);
@@ -30378,7 +30661,7 @@ var ts;
if (node.kind === 212 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
- hasNumericPropertyNames(checkExpression(node.expression))) {
+ hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
return true;
}
child = node;
@@ -30471,19 +30754,19 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_9 = signature.declaration && signature.declaration.parent;
+ var parent_8 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_9 === lastParent) {
+ if (lastParent && parent_8 === lastParent) {
index++;
}
else {
- lastParent = parent_9;
+ lastParent = parent_8;
index = cutoffIndex;
}
}
else {
index = cutoffIndex = result.length;
- lastParent = parent_9;
+ lastParent = parent_8;
}
lastSymbol = symbol;
if (signature.hasLiteralTypes) {
@@ -31451,7 +31734,7 @@ var ts;
if (!node.possiblyExhaustive) {
return false;
}
- var type = checkExpression(node.expression);
+ var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
return false;
}
@@ -31787,10 +32070,10 @@ var ts;
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 | 340 | 512)) {
+ if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) {
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -31799,20 +32082,20 @@ var ts;
var properties = node.properties;
for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {
if (property.kind === 257 || property.kind === 258) {
- var name_23 = property.name;
- if (name_23.kind === 142) {
- checkComputedPropertyName(name_23);
+ var name_22 = property.name;
+ if (name_22.kind === 142) {
+ checkComputedPropertyName(name_22);
}
- if (isComputedNonLiteralName(name_23)) {
+ if (isComputedNonLiteralName(name_22)) {
return undefined;
}
- var text = ts.getTextOfPropertyName(name_23);
+ var text = ts.getTextOfPropertyName(name_22);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -31827,13 +32110,18 @@ var ts;
}
}
else {
- error(name_23, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_23));
+ error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22));
}
}
else if (property.kind === 259) {
- if (property.expression.kind !== 70) {
- error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier);
+ var nonRestNames = [];
+ if (allProperties) {
+ for (var i = 0; i < allProperties.length - 1; i++) {
+ nonRestNames.push(allProperties[i].name);
+ }
}
+ var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
+ return checkDestructuringAssignment(property.expression, type);
}
else {
error(property, ts.Diagnostics.Property_assignment_expected);
@@ -31918,7 +32206,10 @@ var ts;
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ var error = target.parent.kind === 259 ?
+ ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
+ ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
+ if (checkReferenceExpression(target, error)) {
checkTypeAssignableTo(sourceType, targetType, target, undefined);
}
return sourceType;
@@ -32055,7 +32346,7 @@ var ts;
resultType = numberType;
}
else {
- if (isTypeOfKind(leftType, 34) || isTypeOfKind(rightType, 34)) {
+ if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) {
resultType = stringType;
}
else if (isTypeAny(leftType) || isTypeAny(rightType)) {
@@ -32078,6 +32369,8 @@ var ts;
case 29:
case 30:
if (checkForDisallowedESSymbolOperand(operator)) {
+ leftType = getBaseTypeOfLiteralType(leftType);
+ rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -32251,7 +32544,7 @@ var ts;
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
return ts.getCombinedNodeFlags(declaration) & 2 ||
- ts.getCombinedModifierFlags(declaration) & 64 ||
+ ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) ||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
}
function isLiteralContextualType(contextualType) {
@@ -32263,7 +32556,7 @@ var ts;
}
contextualType = apparentType;
}
- return maybeTypeOfKind(contextualType, 480);
+ return maybeTypeOfKind(contextualType, (480 | 262144));
}
return false;
}
@@ -32300,6 +32593,16 @@ var ts;
}
return type;
}
+ function getTypeOfExpression(node) {
+ if (node.kind === 179 && node.expression.kind !== 96) {
+ var funcType = checkNonNullExpression(node.expression);
+ var signature = getSingleCallSignature(funcType);
+ if (signature && !signature.typeParameters) {
+ return getReturnTypeOfSignature(signature);
+ }
+ }
+ return checkExpression(node);
+ }
function checkExpression(node, contextualMapper) {
var type;
if (node.kind === 141) {
@@ -32480,9 +32783,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_24 = _a[_i].name;
- if (ts.isBindingPattern(name_24) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, parameterName, typePredicate.parameterName)) {
+ var name_23 = _a[_i].name;
+ if (ts.isBindingPattern(name_23) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -32502,9 +32805,9 @@ var ts;
case 158:
case 149:
case 148:
- var parent_10 = node.parent;
- if (node === parent_10.type) {
- return parent_10;
+ var parent_9 = node.parent;
+ if (node === parent_9.type) {
+ return parent_9;
}
}
}
@@ -32514,15 +32817,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_25 = element.name;
- if (name_25.kind === 70 &&
- name_25.text === predicateVariableName) {
+ var name_24 = element.name;
+ if (name_24.kind === 70 &&
+ name_24.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_25.kind === 173 ||
- name_25.kind === 172) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_25, predicateVariableNode, predicateVariableName)) {
+ else if (name_24.kind === 173 ||
+ name_24.kind === 172) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -32753,8 +33056,8 @@ var ts;
if (superCallShouldBeFirst) {
var statements = node.body.statements;
var superCallStatement = void 0;
- for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
- var statement = statements_2[_i];
+ for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
+ var statement = statements_3[_i];
if (statement.kind === 207 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
@@ -32897,7 +33200,7 @@ var ts;
var type = getTypeFromMappedTypeNode(node);
var constraintType = getConstraintTypeFromMappedType(type);
var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
- checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint);
+ checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
}
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node);
@@ -33141,10 +33444,10 @@ var ts;
case 229:
return 2097152 | 1048576;
case 234:
- var result_2 = 0;
+ var result_3 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
- return result_2;
+ ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });
+ return result_3;
default:
return 1048576;
}
@@ -33683,8 +33986,8 @@ var ts;
container.kind === 230 ||
container.kind === 261);
if (!namesShareScope) {
- var name_26 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_26, name_26);
+ var name_25 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25);
}
}
}
@@ -33755,13 +34058,13 @@ var ts;
if (node.propertyName && node.propertyName.kind === 142) {
checkComputedPropertyName(node.propertyName);
}
- var parent_11 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_11);
- var name_27 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_27));
+ var parent_10 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_10);
+ var name_26 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26));
markPropertyAsReferenced(property);
- if (parent_11.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property);
+ if (parent_10.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);
}
}
if (ts.isBindingPattern(node.name)) {
@@ -33922,6 +34225,7 @@ var ts;
}
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
+ var rightType = checkNonNullExpression(node.expression);
if (node.initializer.kind === 224) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
@@ -33935,15 +34239,14 @@ var ts;
if (varExpr.kind === 175 || varExpr.kind === 176) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
- else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34)) {
+ else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
- var rightType = checkNonNullExpression(node.expression);
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) {
error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
checkSourceElement(node.statement);
@@ -34068,12 +34371,12 @@ var ts;
var arrayType = arrayOrStringType;
if (arrayOrStringType.flags & 65536) {
var arrayTypes = arrayOrStringType.types;
- var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34); });
+ var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); });
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, true);
}
}
- else if (arrayOrStringType.flags & 34) {
+ else if (arrayOrStringType.flags & 262178) {
arrayType = neverType;
}
var hasStringConstituent = arrayOrStringType !== arrayType;
@@ -34098,7 +34401,7 @@ var ts;
}
var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType;
if (hasStringConstituent) {
- if (arrayElementType.flags & 34) {
+ if (arrayElementType.flags & 262178) {
return stringType;
}
return getUnionType([arrayElementType, stringType], true);
@@ -34782,7 +35085,7 @@ var ts;
return undefined;
}
}
- enumType_1 = checkExpression(expression);
+ enumType_1 = getTypeOfExpression(expression);
if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) {
return undefined;
}
@@ -34977,9 +35280,9 @@ var ts;
break;
case 174:
case 223:
- var name_28 = node.name;
- if (ts.isBindingPattern(name_28)) {
- for (var _b = 0, _c = name_28.elements; _b < _c.length; _b++) {
+ var name_27 = node.name;
+ if (ts.isBindingPattern(name_27)) {
+ for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) {
var el = _c[_b];
checkModuleAugmentationElement(el, isGlobalAugmentation);
}
@@ -35717,7 +36020,7 @@ var ts;
}
}
case 96:
- var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
+ var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case 167:
return getTypeFromTypeNode(node).symbol;
@@ -35739,7 +36042,7 @@ var ts;
}
case 8:
if (node.parent.kind === 178 && node.parent.argumentExpression === node) {
- var objectType = checkExpression(node.parent.expression);
+ var objectType = getTypeOfExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
var apparentType = getApparentType(objectType);
@@ -35770,7 +36073,7 @@ var ts;
return getTypeFromTypeNode(node);
}
if (ts.isPartOfExpression(node)) {
- return getTypeOfExpression(node);
+ return getRegularTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
@@ -35808,7 +36111,7 @@ var ts;
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 192) {
- var iteratedType = checkExpression(expr.parent.right);
+ var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
if (expr.parent.kind === 257) {
@@ -35824,11 +36127,11 @@ var ts;
var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);
}
- function getTypeOfExpression(expr) {
+ function getRegularTypeOfExpression(expr) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
- return getRegularTypeOfLiteralType(checkExpression(expr));
+ return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
function getParentTypeOfClassElement(node) {
var classSymbol = getSymbolOfNode(node.parent);
@@ -35851,9 +36154,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456) {
var symbols_3 = [];
- var name_29 = symbol.name;
+ var name_28 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_29);
+ var symbol = getPropertyOfType(t, name_28);
if (symbol) {
symbols_3.push(symbol);
}
@@ -35906,7 +36209,7 @@ var ts;
}
function isNameOfModuleOrEnumDeclaration(node) {
var parent = node.parent;
- return ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
+ return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
}
function getReferencedExportContainer(node, prefixLocals) {
node = ts.getParseTreeNode(node, ts.isIdentifier);
@@ -36114,7 +36417,7 @@ var ts;
else if (isTypeOfKind(type, 340)) {
return ts.TypeReferenceSerializationKind.NumberLikeType;
}
- else if (isTypeOfKind(type, 34)) {
+ else if (isTypeOfKind(type, 262178)) {
return ts.TypeReferenceSerializationKind.StringLikeType;
}
else if (isTupleType(type)) {
@@ -36145,7 +36448,7 @@ var ts;
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
}
function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {
- var type = getWidenedType(getTypeOfExpression(expr));
+ var type = getWidenedType(getRegularTypeOfExpression(expr));
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
}
function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {
@@ -36164,9 +36467,9 @@ var ts;
}
var location = reference;
if (startInDeclarationContainer) {
- var parent_12 = reference.parent;
- if (ts.isDeclaration(parent_12) && reference === parent_12.name) {
- location = getDeclarationContainer(parent_12);
+ var parent_11 = reference.parent;
+ if (ts.isDeclaration(parent_11) && reference === parent_11.name) {
+ location = getDeclarationContainer(parent_11);
}
}
return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined);
@@ -36279,9 +36582,9 @@ var ts;
}
var current = symbol;
while (true) {
- var parent_13 = getParentOfSymbol(current);
- if (parent_13) {
- current = parent_13;
+ var parent_12 = getParentOfSymbol(current);
+ if (parent_12) {
+ current = parent_12;
}
else {
break;
@@ -36958,9 +37261,9 @@ var ts;
if (prop.kind === 259) {
continue;
}
- var name_30 = prop.name;
- if (name_30.kind === 142) {
- checkGrammarComputedPropertyName(name_30);
+ var name_29 = prop.name;
+ if (name_29.kind === 142) {
+ checkGrammarComputedPropertyName(name_29);
}
if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) {
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -36976,8 +37279,8 @@ var ts;
var currentKind = void 0;
if (prop.kind === 257 || prop.kind === 258) {
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_30.kind === 8) {
- checkGrammarNumericLiteral(name_30);
+ if (name_29.kind === 8) {
+ checkGrammarNumericLiteral(name_29);
}
currentKind = Property;
}
@@ -36993,7 +37296,7 @@ var ts;
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_30);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29);
if (effectiveName === undefined) {
continue;
}
@@ -37003,18 +37306,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_30, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_30));
+ grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -37027,12 +37330,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_31 = jsxAttr.name;
- if (!seen[name_31.text]) {
- seen[name_31.text] = true;
+ var name_30 = jsxAttr.name;
+ if (!seen[name_30.text]) {
+ seen[name_30.text] = true;
}
else {
- return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 252 && !initializer.expression) {
@@ -37480,10 +37783,15 @@ var ts;
function reduceNode(node, f, initial) {
return node ? f(initial, node) : initial;
}
- function reduceEachChild(node, f, initial) {
+ function reduceNodeArray(nodes, f, initial) {
+ return nodes ? f(initial, nodes) : initial;
+ }
+ function reduceEachChild(node, initial, cbNode, cbNodeArray) {
if (node === undefined) {
return initial;
}
+ var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
+ var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
if ((kind > 0 && kind <= 140)) {
return initial;
@@ -37497,108 +37805,108 @@ var ts;
case 206:
case 198:
case 222:
- case 292:
+ case 293:
break;
case 142:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 144:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 145:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 147:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 149:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 150:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 151:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 152:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 172:
case 173:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 174:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 175:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 176:
- result = ts.reduceLeft(node.properties, f, result);
+ result = reduceNodes(node.properties, cbNodes, result);
break;
case 177:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 178:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.argumentExpression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.argumentExpression, cbNode, result);
break;
case 179:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 180:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 181:
- result = reduceNode(node.tag, f, result);
- result = reduceNode(node.template, f, result);
+ result = reduceNode(node.tag, cbNode, result);
+ result = reduceNode(node.template, cbNode, result);
break;
case 184:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 185:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 183:
case 186:
@@ -37608,205 +37916,205 @@ var ts;
case 195:
case 196:
case 201:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 190:
case 191:
- result = reduceNode(node.operand, f, result);
+ result = reduceNode(node.operand, cbNode, result);
break;
case 192:
- result = reduceNode(node.left, f, result);
- result = reduceNode(node.right, f, result);
+ result = reduceNode(node.left, cbNode, result);
+ result = reduceNode(node.right, cbNode, result);
break;
case 193:
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.whenTrue, f, result);
- result = reduceNode(node.whenFalse, f, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.whenTrue, cbNode, result);
+ result = reduceNode(node.whenFalse, cbNode, result);
break;
case 194:
- result = reduceNode(node.head, f, result);
- result = ts.reduceLeft(node.templateSpans, f, result);
+ result = reduceNode(node.head, cbNode, result);
+ result = reduceNodes(node.templateSpans, cbNodes, result);
break;
case 197:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 199:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
break;
case 202:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.literal, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.literal, cbNode, result);
break;
case 204:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 205:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.declarationList, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.declarationList, cbNode, result);
break;
case 207:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 208:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.thenStatement, f, result);
- result = reduceNode(node.elseStatement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.thenStatement, cbNode, result);
+ result = reduceNode(node.elseStatement, cbNode, result);
break;
case 209:
- result = reduceNode(node.statement, f, result);
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.statement, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 210:
case 217:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 211:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.incrementor, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.incrementor, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 212:
case 213:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 216:
case 220:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 218:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.caseBlock, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.caseBlock, cbNode, result);
break;
case 219:
- result = reduceNode(node.label, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.label, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 221:
- result = reduceNode(node.tryBlock, f, result);
- result = reduceNode(node.catchClause, f, result);
- result = reduceNode(node.finallyBlock, f, result);
+ result = reduceNode(node.tryBlock, cbNode, result);
+ result = reduceNode(node.catchClause, cbNode, result);
+ result = reduceNode(node.finallyBlock, cbNode, result);
break;
case 223:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 224:
- result = ts.reduceLeft(node.declarations, f, result);
+ result = reduceNodes(node.declarations, cbNodes, result);
break;
case 225:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 226:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 232:
- result = ts.reduceLeft(node.clauses, f, result);
+ result = reduceNodes(node.clauses, cbNodes, result);
break;
case 235:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.importClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.importClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 236:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 237:
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 238:
case 242:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 239:
case 243:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 240:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.expression, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 241:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.exportClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.exportClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 246:
- result = reduceNode(node.openingElement, f, result);
- result = ts.reduceLeft(node.children, f, result);
- result = reduceNode(node.closingElement, f, result);
+ result = reduceNode(node.openingElement, cbNode, result);
+ result = ts.reduceLeft(node.children, cbNode, result);
+ result = reduceNode(node.closingElement, cbNode, result);
break;
case 247:
case 248:
- result = reduceNode(node.tagName, f, result);
- result = ts.reduceLeft(node.attributes, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
+ result = reduceNodes(node.attributes, cbNodes, result);
break;
case 249:
- result = reduceNode(node.tagName, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
break;
case 250:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 251:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 252:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 253:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
case 254:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 255:
- result = ts.reduceLeft(node.types, f, result);
+ result = reduceNodes(node.types, cbNodes, result);
break;
case 256:
- result = reduceNode(node.variableDeclaration, f, result);
- result = reduceNode(node.block, f, result);
+ result = reduceNode(node.variableDeclaration, cbNode, result);
+ result = reduceNode(node.block, cbNode, result);
break;
case 257:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 258:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.objectAssignmentInitializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
case 259:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 261:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
- case 293:
- result = reduceNode(node.expression, f, result);
+ case 294:
+ result = reduceNode(node.expression, cbNode, result);
break;
default:
var edgeTraversalPath = nodeEdgeTraversalMap[kind];
@@ -37816,8 +38124,8 @@ var ts;
var value = node[edge.name];
if (value !== undefined) {
result = ts.isArray(value)
- ? ts.reduceLeft(value, f, result)
- : f(result, value);
+ ? reduceNodes(value, cbNodes, result)
+ : cbNode(result, value);
}
}
}
@@ -37827,8 +38135,8 @@ var ts;
}
ts.reduceEachChild = reduceEachChild;
function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {
- if (node === undefined) {
- return undefined;
+ if (node === undefined || visitor === undefined) {
+ return node;
}
aggregateTransformFlags(node);
var visited = visitor(node);
@@ -37905,6 +38213,35 @@ var ts;
return updated || nodes;
}
ts.visitNodes = visitNodes;
+ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
+ context.startLexicalEnvironment();
+ statements = visitNodes(statements, visitor, ts.isStatement, start);
+ if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
+ statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements);
+ }
+ var declarations = context.endLexicalEnvironment();
+ return ts.createNodeArray(ts.concatenate(statements, declarations), statements);
+ }
+ ts.visitLexicalEnvironment = visitLexicalEnvironment;
+ function visitParameterList(nodes, visitor, context) {
+ context.startLexicalEnvironment();
+ var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);
+ context.suspendLexicalEnvironment();
+ return updated;
+ }
+ ts.visitParameterList = visitParameterList;
+ function visitFunctionBody(node, visitor, context) {
+ context.resumeLexicalEnvironment();
+ var updated = visitNode(node, visitor, ts.isConciseBody);
+ var declarations = context.endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(updated);
+ var statements = mergeLexicalEnvironment(block.statements, declarations);
+ return ts.updateBlock(block, statements);
+ }
+ return updated;
+ }
+ ts.visitFunctionBody = visitFunctionBody;
function visitEachChild(node, visitor, context) {
if (node === undefined) {
return undefined;
@@ -37925,23 +38262,23 @@ var ts;
case 142:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
case 144:
- return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 147:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true));
case 149:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 150:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 151:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 152:
- return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 172:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 173:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 174:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
+ return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true));
case 175:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
case 176:
@@ -37959,9 +38296,9 @@ var ts;
case 183:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 184:
- return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 185:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, true), context.endLexicalEnvironment()));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 186:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 187:
@@ -38029,7 +38366,7 @@ var ts;
case 224:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 225:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, true), context.endLexicalEnvironment()));
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context));
case 226:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
case 232:
@@ -38081,9 +38418,8 @@ var ts;
case 259:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
case 261:
- context.startLexicalEnvironment();
- return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
- case 293:
+ return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
+ case 294:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -38111,6 +38447,15 @@ var ts;
}
}
ts.visitEachChild = visitEachChild;
+ function mergeLexicalEnvironment(statements, declarations) {
+ if (!ts.some(declarations)) {
+ return statements;
+ }
+ return ts.isNodeArray(statements)
+ ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)
+ : ts.addRange(statements, declarations);
+ }
+ ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function mergeFunctionBodyLexicalEnvironment(body, declarations) {
if (body && declarations !== undefined && declarations.length > 0) {
if (ts.isBlock(body)) {
@@ -38141,22 +38486,37 @@ var ts;
if (node === undefined) {
return 0;
}
- else if (node.transformFlags & 536870912) {
+ if (node.transformFlags & 536870912) {
return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);
}
- else {
- var subtreeFlags = aggregateTransformFlagsForSubtree(node);
- return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ var subtreeFlags = aggregateTransformFlagsForSubtree(node);
+ return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ }
+ function aggregateTransformFlagsForNodeArray(nodes) {
+ if (nodes === undefined) {
+ return 0;
}
+ var subtreeFlags = 0;
+ var nodeArrayFlags = 0;
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
+ var node = nodes_3[_i];
+ subtreeFlags |= aggregateTransformFlagsForNode(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912;
+ return subtreeFlags;
}
function aggregateTransformFlagsForSubtree(node) {
if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) {
return 0;
}
- return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0);
+ return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
+ }
+ function aggregateTransformFlagsForChildNode(transformFlags, node) {
+ return transformFlags | aggregateTransformFlagsForNode(node);
}
- function aggregateTransformFlagsForChildNode(transformFlags, child) {
- return transformFlags | aggregateTransformFlagsForNode(child);
+ function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
+ return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
var Debug;
(function (Debug) {
@@ -38166,9 +38526,21 @@ var ts;
Debug.failBadSyntaxKind = Debug.shouldAssert(1)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
: ts.noop;
+ Debug.assertEachNode = Debug.shouldAssert(1)
+ ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
Debug.assertNode = Debug.shouldAssert(1)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
: ts.noop;
+ Debug.assertOptionalNode = Debug.shouldAssert(1)
+ ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
+ Debug.assertOptionalToken = Debug.shouldAssert(1)
+ ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); }
+ : ts.noop;
+ Debug.assertMissingNode = Debug.shouldAssert(1)
+ ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); }
+ : ts.noop;
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -38187,440 +38559,316 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
- if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
- var right = node.right;
- if (ts.isDestructuringAssignment(right)) {
- return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor);
- }
- else {
- return node.right;
- }
- }
+ function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
var location = node;
- var value = node.right;
- var expressions = [];
- if (needsValue) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment, visitor);
+ var value;
+ if (ts.isDestructuringAssignment(node)) {
+ value = node.right;
+ while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
+ if (ts.isDestructuringAssignment(value)) {
+ location = node = value;
+ value = node.right;
+ }
+ else {
+ return value;
+ }
+ }
}
- else if (ts.nodeIsSynthesized(node)) {
- location = value;
+ var expressions;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: true,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,
+ createArrayBindingOrAssignmentElement: makeAssignmentElement,
+ visitor: visitor
+ };
+ if (value) {
+ value = ts.visitNode(value, visitor, ts.isExpression);
+ if (needsValue) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ }
+ else if (ts.nodeIsSynthesized(node)) {
+ location = value;
+ }
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- if (needsValue) {
+ flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));
+ if (value && needsValue) {
+ if (!ts.some(expressions)) {
+ return value;
+ }
expressions.push(value);
}
- var expression = ts.inlineExpressions(expressions);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location) {
- var expression = ts.createAssignment(name, value, location);
- ts.setEmitFlags(expression, 2048);
+ return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();
+ function emitExpression(expression) {
+ ts.setEmitFlags(expression, 64);
ts.aggregateTransformFlags(expression);
- expressions.push(expression);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitAssignment(name, value, location);
- return name;
+ expressions = ts.append(expressions, expression);
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectLiteral(elements), value, location);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(target, value, location)
+ : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);
+ expression.original = original;
+ emitExpression(expression);
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
- function flattenParameterDestructuring(node, value, visitor, transformRest) {
+ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
+ var pendingExpressions;
+ var pendingDeclarations = [];
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location) {
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- ts.setEmitFlags(declaration, 2048);
- ts.aggregateTransformFlags(declaration);
- declarations.push(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(undefined);
- emitAssignment(name, value, location);
- return name;
- }
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location);
- }
- }
- ts.flattenParameterDestructuring = flattenParameterDestructuring;
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
- var declarations = [];
- var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location, original) {
- if (pendingAssignments) {
- pendingAssignments.push(value);
- value = ts.inlineExpressions(pendingAssignments);
- pendingAssignments = undefined;
- }
- var declaration = ts.createVariableDeclaration(name, undefined, value, location);
- declaration.original = original;
- ts.setEmitFlags(declaration, 2048);
- declarations.push(declaration);
- ts.aggregateTransformFlags(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- if (recordTempVariable) {
- var assignment = ts.createAssignment(name, value, location);
- if (pendingAssignments) {
- pendingAssignments.push(assignment);
- }
- else {
- pendingAssignments = [assignment];
- }
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: hoistTempVariables,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,
+ createArrayBindingOrAssignmentElement: makeBindingElement,
+ visitor: visitor
+ };
+ flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
+ if (pendingExpressions) {
+ var temp = ts.createTempVariable(undefined);
+ if (hoistTempVariables) {
+ var value = ts.inlineExpressions(pendingExpressions);
+ pendingExpressions = undefined;
+ emitBindingOrAssignment(temp, value, undefined, undefined);
}
else {
- emitAssignment(name, value, location, undefined);
+ context.hoistVariableDeclaration(temp);
+ var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);
+ pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));
+ ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
+ pendingDeclaration.value = temp;
}
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
- }
- }
- ts.flattenVariableDestructuring = flattenVariableDestructuring;
- function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
- var pendingAssignments = [];
- flattenDestructuring(node, undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, false, visitor);
- var expression = ts.inlineExpressions(pendingAssignments);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location, original) {
- var expression = createAssignmentCallback
- ? createAssignmentCallback(name.kind === 70 ? name : emitTempVariableAssignment(name, location), value, location)
- : ts.createAssignment(name, value, location);
- emitPendingAssignment(expression, original);
}
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(ts.createAssignment(name, value, location), undefined);
- return name;
+ for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
+ var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;
+ var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);
+ variable.original = original;
+ if (ts.isIdentifier(name_31)) {
+ ts.setEmitFlags(variable, 64);
+ }
+ ts.aggregateTransformFlags(variable);
+ declarations.push(variable);
}
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectLiteral(elements), value, location, original);
+ return declarations;
+ function emitExpression(value) {
+ pendingExpressions = ts.append(pendingExpressions, value);
}
- function emitPendingAssignment(expression, original) {
- expression.original = original;
- ts.setEmitFlags(expression, 2048);
- pendingAssignments.push(expression);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, ts.isBindingName);
+ if (pendingExpressions) {
+ value = ts.inlineExpressions(ts.append(pendingExpressions, value));
+ pendingExpressions = undefined;
+ }
+ pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
}
}
- ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
- if (value && visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
- }
- if (ts.isBinaryExpression(root)) {
- emitDestructuringAssignment(root.left, value, location);
- }
- else {
- emitBindingElement(root, value);
- }
- function emitDestructuringAssignment(bindingTarget, value, location) {
- var target;
- if (ts.isShorthandPropertyAssignment(bindingTarget)) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression)
- : bindingTarget.objectAssignmentInitializer;
- if (initializer) {
- value = createDefaultValueCheck(value, initializer, location);
- }
- target = bindingTarget.name;
- }
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
- : bindingTarget.right;
- value = createDefaultValueCheck(value, initializer, location);
- target = bindingTarget.left;
- }
- else {
- target = bindingTarget;
+ ts.flattenDestructuringBinding = flattenDestructuringBinding;
+ function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
+ if (!skipInitializer) {
+ var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
+ if (initializer) {
+ value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;
}
- if (target.kind === 176) {
- emitObjectLiteralAssignment(target, value, location);
- }
- else if (target.kind === 175) {
- emitArrayLiteralAssignment(target, value, location);
- }
- else {
- var name_32 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_32, target);
- ts.setCommentRange(name_32, target);
- emitAssignment(name_32, value, location, undefined);
+ else if (!value) {
+ value = ts.createVoidZero();
}
}
- function emitObjectLiteralAssignment(target, value, location) {
- var properties = target.properties;
- if (properties.length !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var bindingElements = [];
- for (var i = 0; i < properties.length; i++) {
- var p = properties[i];
- if (p.kind === 257 || p.kind === 258) {
- if (!transformRest ||
- p.transformFlags & 8388608 ||
- (p.kind === 257 && p.initializer.transformFlags & 8388608)) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.name;
- var bindingTarget = p.kind === 258 ? p : p.initializer || propName;
- emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
- }
- else {
- bindingElements.push(p);
- }
- }
- else if (i === properties.length - 1 &&
- p.kind === 259 &&
- p.expression.kind === 70) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.expression;
- var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
- emitDestructuringAssignment(propName, restCall, p);
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
+ var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
+ if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
+ flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitArrayLiteralAssignment(target, value, location) {
- if (transformRest) {
- emitESNextArrayLiteralAssignment(target, value, location);
- }
- else {
- emitES2015ArrayLiteralAssignment(target, value, location);
- }
+ else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
+ flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitESNextArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- var expressions = [];
- var spreadContainingExpressions = [];
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind === 198) {
- continue;
- }
- if (e.transformFlags & 8388608 && i < numElements - 1) {
- var tmp = ts.createTempVariable(recordTempVariable);
- spreadContainingExpressions.push([e, tmp]);
- expressions.push(tmp);
+ else {
+ flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);
+ }
+ }
+ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var computedTempVariables;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
+ if (flattenContext.level >= 1
+ && !(element.transformFlags & (524288 | 1048576))
+ && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 | 1048576))
+ && !ts.isComputedPropertyName(propertyName)) {
+ bindingElements = ts.append(bindingElements, element);
}
else {
- expressions.push(e);
- }
- }
- emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
- for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
- var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
- emitDestructuringAssignment(e, tmp, e);
- }
- }
- function emitES2015ArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- }
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind !== 198) {
- if (e.kind !== 196) {
- emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- else if (i === numElements - 1) {
- emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e);
+ var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
+ if (ts.isComputedPropertyName(propertyName)) {
+ computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
}
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- }
- function createRestCall(value, elements, getPropertyName, location) {
- var propertyNames = [];
- for (var i = 0; i < elements.length - 1; i++) {
- if (ts.isOmittedExpression(elements[i])) {
- continue;
+ else if (i === numElements - 1) {
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- var str = ts.createSynthesizedNode(9);
- str.pos = location.pos;
- str.end = location.end;
- str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
- propertyNames.push(str);
+ var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
- return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
}
- function emitBindingElement(target, value) {
- var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (transformRest) {
- value = value || initializer;
- }
- else if (initializer) {
- value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
- }
- else if (!value) {
- value = ts.createVoidZero();
- }
- var name = target.name;
- if (!ts.isBindingPattern(name)) {
- emitAssignment(name, value, target, target);
- }
- else {
- var numElements = name.elements.length;
- if (numElements !== 1) {
- value = ensureIdentifier(value, numElements !== 0, target, emitTempVariableAssignment);
- }
- if (name.kind === 173) {
- emitArrayBindingElement(name, value);
- }
- else {
- emitObjectBindingElement(target, value);
- }
- }
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function emitArrayBindingElement(name, value) {
- if (transformRest) {
- emitESNextArrayBindingElement(name, value);
- }
- else {
- emitES2015ArrayBindingElement(name, value);
- }
- }
- function emitES2015ArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (!element.dotDotDotToken) {
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
- }
+ }
+ function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) {
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
}
- function emitESNextArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- var spreadContainingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (element.transformFlags & 8388608 && i < numElements - 1) {
- spreadContainingElements.push(element);
- bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
+ var bindingElements;
+ var restContainingElements;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (flattenContext.level >= 1) {
+ if (element.transformFlags & 1048576) {
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ }
+ restContainingElements = ts.append(restContainingElements, [temp, element]);
+ bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
}
else {
- bindingElements.push(element);
+ bindingElements = ts.append(bindingElements, element);
}
}
- emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
- for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
- var element = spreadContainingElements_1[_i];
- emitBindingElement(element, ts.getGeneratedNameForNode(element));
+ else if (ts.isOmittedExpression(element)) {
+ continue;
}
- }
- function emitObjectBindingElement(target, value) {
- var name = target.name;
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (i === numElements - 1 && element.dotDotDotToken) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
- emitBindingElement(element, restCall);
- }
- else if (transformRest && !(element.transformFlags & 8388608)) {
- bindingElements.push(element);
- }
- else {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
+ else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var rhsValue = ts.createElementAccess(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
+ else if (i === numElements - 1) {
+ var rhsValue = ts.createArraySlice(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
}
- function createDefaultValueCheck(value, defaultValue, location) {
- value = ensureIdentifier(value, true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54), defaultValue, ts.createToken(55), value);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function createDestructuringPropertyAccess(expression, propertyName) {
- if (ts.isComputedPropertyName(propertyName)) {
- return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, false, propertyName, emitTempVariableAssignment));
- }
- else if (ts.isLiteralExpression(propertyName)) {
- var clone_2 = ts.getSynthesizedClone(propertyName);
- clone_2.text = ts.unescapeIdentifier(clone_2.text);
- return ts.createElementAccess(expression, clone_2);
- }
- else {
- if (ts.isGeneratedIdentifier(propertyName)) {
- var clone_3 = ts.getSynthesizedClone(propertyName);
- clone_3.text = ts.unescapeIdentifier(clone_3.text);
- return ts.createPropertyAccess(expression, clone_3);
- }
- else {
- return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)));
- }
+ if (restContainingElements) {
+ for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
+ var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
+ flattenBindingOrAssignmentElement(flattenContext, element, id, element);
}
}
}
- function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) {
+ function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
+ value = ensureIdentifier(flattenContext, value, true, location);
+ return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value);
+ }
+ function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, false, propertyName);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else if (ts.isStringOrNumericLiteral(propertyName)) {
+ var argumentExpression = ts.getSynthesizedClone(propertyName);
+ argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else {
+ var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));
+ return ts.createPropertyAccess(value, name_32);
+ }
+ }
+ function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
return value;
}
else {
- if (visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ flattenContext.emitExpression(ts.createAssignment(temp, value, location));
}
- return emitTempVariableAssignment(value, location);
+ else {
+ flattenContext.emitBindingOrAssignment(temp, value, location, undefined);
+ }
+ return temp;
}
}
+ function makeArrayBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
+ return ts.createArrayBindingPattern(elements);
+ }
+ function makeArrayAssignmentPattern(elements) {
+ return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));
+ }
+ function makeObjectBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isBindingElement);
+ return ts.createObjectBindingPattern(elements);
+ }
+ function makeObjectAssignmentPattern(elements) {
+ return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));
+ }
+ function makeBindingElement(name) {
+ return ts.createBindingElement(undefined, undefined, name);
+ }
+ function makeAssignmentElement(name) {
+ return name;
+ }
+ var restHelper = {
+ name: "typescript:rest",
+ scoped: false,
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ };
+ function createRestCall(context, value, elements, computedTempVariables, location) {
+ context.requestEmitHelper(restHelper);
+ var propertyNames = [];
+ var computedTempVariableOffset = 0;
+ for (var i = 0; i < elements.length - 1; i++) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
+ if (propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var temp = computedTempVariables[computedTempVariableOffset];
+ computedTempVariableOffset++;
+ propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral(""))));
+ }
+ else {
+ propertyNames.push(ts.createLiteral(propertyName));
+ }
+ }
+ }
+ return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);
+ }
})(ts || (ts = {}));
var ts;
(function (ts) {
var USE_NEW_TYPE_METADATA_FORMAT = false;
function transformTypeScript(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -38636,7 +38884,6 @@ var ts;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentExternalHelpersModuleName;
var enabledSubstitutions;
var classAliases;
var applicableSubstitutions;
@@ -38645,7 +38892,11 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ currentSourceFile = node;
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function saveStateAndInvoke(node, f) {
var savedCurrentScope = currentScope;
@@ -38658,14 +38909,29 @@ var ts;
currentScope = savedCurrentScope;
return visited;
}
+ function onBeforeVisitNode(node) {
+ switch (node.kind) {
+ case 261:
+ case 232:
+ case 231:
+ case 204:
+ currentScope = node;
+ currentScopeFirstDeclarationsOfName = undefined;
+ break;
+ case 226:
+ case 225:
+ if (ts.hasModifier(node, 2)) {
+ break;
+ }
+ recordEmittedDeclarationInScope(node);
+ break;
+ }
+ }
function visitor(node) {
return saveStateAndInvoke(node, visitorWorker);
}
function visitorWorker(node) {
- if (node.kind === 261) {
- return visitSourceFile(node);
- }
- else if (node.transformFlags & 1) {
+ if (node.transformFlags & 1) {
return visitTypeScript(node);
}
else if (node.transformFlags & 2) {
@@ -38833,53 +39099,9 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- switch (node.kind) {
- case 261:
- case 232:
- case 231:
- case 204:
- currentScope = node;
- currentScopeFirstDeclarationsOfName = undefined;
- break;
- case 226:
- case 225:
- if (ts.hasModifier(node, 2)) {
- break;
- }
- recordEmittedDeclarationInScope(node);
- break;
- }
- }
function visitSourceFile(node) {
- currentSourceFile = node;
- if (compilerOptions.alwaysStrict &&
- !(ts.isExternalModule(node) && (compilerOptions.target >= 2 || compilerOptions.module === ts.ModuleKind.ES2015))) {
- node = ts.ensureUseStrict(node);
- }
- if (node.flags & 64512
- && compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
- var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText);
- var externalHelpersModuleImport = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- externalHelpersModuleImport.parent = node;
- externalHelpersModuleImport.flags &= ~8;
- statements.push(externalHelpersModuleImport);
- currentExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- currentExternalHelpersModuleName = undefined;
- node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
- node.externalHelpersModuleName = externalHelpersModuleName;
- }
- else {
- node = ts.visitEachChild(node, sourceElementVisitor, context);
- }
- ts.setEmitFlags(node, 1 | ts.getEmitFlags(node));
- return node;
+ var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);
+ return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));
}
function shouldEmitDecorateCallForClass(node) {
if (node.decorators && node.decorators.length > 0) {
@@ -38925,7 +39147,7 @@ var ts;
}
if (statements.length > 1) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432);
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -38933,7 +39155,7 @@ var ts;
var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node);
var emitFlags = ts.getEmitFlags(node);
if (hasStaticProperties) {
- emitFlags |= 1024;
+ emitFlags |= 32;
}
ts.setOriginalNode(classDeclaration, node);
ts.setEmitFlags(classDeclaration, emitFlags);
@@ -38964,7 +39186,7 @@ var ts;
enableSubstitutionForClassAliases();
classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp);
}
- ts.setEmitFlags(classExpression, 524288 | ts.getEmitFlags(classExpression));
+ ts.setEmitFlags(classExpression, 32768 | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
@@ -38983,7 +39205,7 @@ var ts;
}
function transformConstructor(node, hasExtendsClause) {
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 4194304;
+ var hasParameterPropertyAssignments = node.transformFlags & 262144;
var constructor = ts.getFirstConstructorWithBody(node);
if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) {
return ts.visitEachChild(constructor, visitor, context);
@@ -38993,14 +39215,13 @@ var ts;
return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor));
}
function transformConstructorParameters(constructor) {
- return constructor
- ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
- : [];
+ return ts.visitParameterList(constructor && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
if (constructor) {
indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);
var propertyAssignments = getParametersWithPropertyAssignments(constructor);
@@ -39015,7 +39236,7 @@ var ts;
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
}
ts.addRange(statements, endLexicalEnvironment());
- return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined), true);
+ return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true);
}
function addPrologueDirectivesAndInitialSuperCall(ctor, result) {
if (ctor.body) {
@@ -39044,9 +39265,9 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name));
var name = node.name;
var propertyName = ts.getMutableClone(name);
- ts.setEmitFlags(propertyName, 49152 | 1536);
+ ts.setEmitFlags(propertyName, 1536 | 48);
var localName = ts.getMutableClone(name);
- ts.setEmitFlags(localName, 49152);
+ ts.setEmitFlags(localName, 1536);
return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1)));
}
function getInitializedProperties(node, isStatic) {
@@ -39219,8 +39440,8 @@ var ts;
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
- ts.setEmitFlags(helper, 49152);
+ var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ ts.setEmitFlags(helper, 1536);
return helper;
}
function addConstructorDecorationStatement(statements, node) {
@@ -39237,9 +39458,9 @@ var ts;
}
var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
var localName = ts.getLocalName(node, false, true);
- var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var decorate = createDecorateHelper(context, decoratorExpressions, localName);
var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
- ts.setEmitFlags(expression, 49152);
+ ts.setEmitFlags(expression, 1536);
ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
return expression;
}
@@ -39252,8 +39473,8 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset, decorator.expression);
- ts.setEmitFlags(helper, 49152);
+ var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, decorator.expression);
+ ts.setEmitFlags(helper, 1536);
expressions.push(helper);
}
}
@@ -39270,13 +39491,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -39293,7 +39514,7 @@ var ts;
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true)));
}
}
}
@@ -39462,7 +39683,7 @@ var ts;
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
- return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object"));
+ return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object"));
case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
return serializeEntityNameAsExpression(node.typeName, false);
case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
@@ -39518,7 +39739,7 @@ var ts;
return ts.createPropertyAccess(left, node.right);
}
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54), ts.createIdentifier("Symbol"), ts.createToken(55), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
var name = member.name;
@@ -39573,11 +39794,12 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function shouldEmitAccessorDeclaration(node) {
return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128));
@@ -39586,86 +39808,46 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createGetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateGetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitSetAccessor(node) {
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createSetAccessor(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]), node);
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateSetAccessor(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
function visitFunctionDeclaration(node) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return ts.createNotEmittedStatement(node);
}
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
+ var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
if (isNamespaceExport(node)) {
- var statements = [func];
+ var statements = [updated];
addExportMemberAssignment(statements, node);
return statements;
}
- return func;
+ return updated;
}
function visitFunctionExpression(node) {
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformFunctionBodyWorker(node.body);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- currentScope = body;
- currentScopeFirstDeclarationsOfName = ts.createMap();
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- }
- function transformConciseBody(node) {
- return transformConciseBodyWorker(node.body, false);
- }
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
- if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
- }
- else {
- startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
- var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
- }
+ var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
function visitParameter(node) {
if (ts.parameterIsThisKeyword(node)) {
@@ -39675,7 +39857,7 @@ var ts;
ts.setOriginalNode(parameter, node);
ts.setCommentRange(parameter, node);
ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));
- ts.setEmitFlags(parameter.name, 1024);
+ ts.setEmitFlags(parameter.name, 32);
return parameter;
}
function visitVariableStatement(node) {
@@ -39693,7 +39875,7 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node);
@@ -39734,10 +39916,10 @@ var ts;
return undefined;
}
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -39829,13 +40011,13 @@ var ts;
ts.setSourceMapRange(statement, node);
}
ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 | 33554432);
+ ts.setEmitFlags(statement, 1024 | 2097152);
statements.push(statement);
return true;
}
else {
var mergeMarker = ts.createMergeDeclarationMarker(statement);
- ts.setEmitFlags(mergeMarker, 49152 | 33554432);
+ ts.setEmitFlags(mergeMarker, 1536 | 2097152);
statements.push(mergeMarker);
return false;
}
@@ -39847,10 +40029,10 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name.");
enableSubstitutionForNamespaceExports();
var statements = [];
- var emitFlags = 64;
+ var emitFlags = 2;
if (addVarForEnumOrModuleDeclaration(statements, node)) {
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384;
+ emitFlags |= 512;
}
}
var parameterName = getNamespaceParameterName(node);
@@ -39906,7 +40088,7 @@ var ts;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true);
if (body.kind !== 231) {
- ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152);
+ ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);
}
return block;
}
@@ -39981,7 +40163,7 @@ var ts;
return undefined;
}
var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);
- ts.setEmitFlags(moduleReference, 49152 | 65536);
+ ts.setEmitFlags(moduleReference, 1536 | 2048);
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node)
@@ -40134,10 +40316,10 @@ var ts;
if (declaration) {
var classAlias = classAliases[declaration.id];
if (classAlias) {
- var clone_4 = ts.getSynthesizedClone(classAlias);
- ts.setSourceMapRange(clone_4, node);
- ts.setCommentRange(clone_4, node);
- return clone_4;
+ var clone_2 = ts.getSynthesizedClone(classAlias);
+ ts.setSourceMapRange(clone_2, node);
+ ts.setCommentRange(clone_2, node);
+ return clone_2;
}
}
}
@@ -40145,7 +40327,7 @@ var ts;
return undefined;
}
function trySubstituteNamespaceExportedName(node) {
- if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var container = resolver.getReferencedExportContainer(node, false);
if (container && container.kind !== 261) {
var substitute = (applicableSubstitutions & 2 && container.kind === 230) ||
@@ -40190,10 +40372,278 @@ var ts;
}
}
ts.transformTypeScript = transformTypeScript;
+ var paramHelper = {
+ name: "typescript:param",
+ scoped: false,
+ priority: 4,
+ text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
+ };
+ function createParamHelper(context, expression, parameterOffset, location) {
+ context.requestEmitHelper(paramHelper);
+ return ts.createCall(ts.getHelperName("__param"), undefined, [
+ ts.createLiteral(parameterOffset),
+ expression
+ ], location);
+ }
+ var metadataHelper = {
+ name: "typescript:metadata",
+ scoped: false,
+ priority: 3,
+ text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
+ };
+ function createMetadataHelper(context, metadataKey, metadataValue) {
+ context.requestEmitHelper(metadataHelper);
+ return ts.createCall(ts.getHelperName("__metadata"), undefined, [
+ ts.createLiteral(metadataKey),
+ metadataValue
+ ]);
+ }
+ var decorateHelper = {
+ name: "typescript:decorate",
+ scoped: false,
+ priority: 2,
+ text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
+ };
+ function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {
+ context.requestEmitHelper(decorateHelper);
+ var argumentsArray = [];
+ argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
+ }
+ return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location);
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ function transformESNext(context) {
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ return visited;
+ }
+ function visitor(node) {
+ return visitorWorker(node, false);
+ }
+ function visitorNoDestructuringValue(node) {
+ return visitorWorker(node, true);
+ }
+ function visitorWorker(node, noDestructuringValue) {
+ if ((node.transformFlags & 8) === 0) {
+ return node;
+ }
+ switch (node.kind) {
+ case 176:
+ return visitObjectLiteralExpression(node);
+ case 192:
+ return visitBinaryExpression(node, noDestructuringValue);
+ case 223:
+ return visitVariableDeclaration(node);
+ case 213:
+ return visitForOfStatement(node);
+ case 211:
+ return visitForStatement(node);
+ case 188:
+ return visitVoidExpression(node);
+ case 150:
+ return visitConstructorDeclaration(node);
+ case 149:
+ return visitMethodDeclaration(node);
+ case 151:
+ return visitGetAccessorDeclaration(node);
+ case 152:
+ return visitSetAccessorDeclaration(node);
+ case 225:
+ return visitFunctionDeclaration(node);
+ case 184:
+ return visitFunctionExpression(node);
+ case 185:
+ return visitArrowFunction(node);
+ case 144:
+ return visitParameter(node);
+ case 207:
+ return visitExpressionStatement(node);
+ case 183:
+ return visitParenthesizedExpression(node, noDestructuringValue);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 259) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 257) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ if (node.transformFlags & 1048576) {
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 176) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return createAssignHelper(context, objects);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitExpressionStatement(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitParenthesizedExpression(node, noDestructuringValue) {
+ return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);
+ }
+ function visitBinaryExpression(node, noDestructuringValue) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue);
+ }
+ else if (node.operatorToken.kind === 25) {
+ return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitVariableDeclaration(node) {
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) {
+ return ts.flattenDestructuringBinding(node, visitor, context, 1);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitForStatement(node) {
+ return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));
+ }
+ function visitVoidExpression(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitForOfStatement(node) {
+ var leadingStatements;
+ var temp;
+ var initializer = ts.skipParentheses(node.initializer);
+ if (initializer.transformFlags & 1048576) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var firstDeclaration = ts.firstOrUndefined(initializer.declarations);
+ var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ else if (ts.isAssignmentPattern(initializer)) {
+ temp = ts.createTempVariable(undefined);
+ var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1);
+ leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer));
+ }
+ }
+ if (temp) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var block = ts.isBlock(statement)
+ ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))
+ : ts.createBlock(ts.append(leadingStatements, statement), statement, true);
+ return ts.updateForOf(node, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, undefined, node.initializer)
+ ], node.initializer, 1), expression, block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParameter(node) {
+ if (node.transformFlags & 1048576) {
+ return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitConstructorDeclaration(node) {
+ return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitGetAccessorDeclaration(node) {
+ return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitSetAccessorDeclaration(node) {
+ return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitMethodDeclaration(node) {
+ return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionDeclaration(node) {
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitArrowFunction(node) {
+ return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function visitFunctionExpression(node) {
+ return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
+ }
+ function transformFunctionBody(node) {
+ resumeLexicalEnvironment();
+ var leadingStatements;
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ if (parameter.transformFlags & 1048576) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations));
+ ts.setEmitFlags(statement, 524288);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ }
+ var body = ts.visitNode(node.body, visitor, ts.isConciseBody);
+ var trailingStatements = endLexicalEnvironment();
+ if (ts.some(leadingStatements) || ts.some(trailingStatements)) {
+ var block = ts.convertToFunctionBody(body, true);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
+ }
+ return body;
+ }
+ }
+ ts.transformESNext = transformESNext;
+ var assignHelper = {
+ name: "typescript:assign",
+ scoped: false,
+ priority: 1,
+ text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
+ };
+ function createAssignHelper(context, attributesSegments) {
+ context.requestEmitHelper(assignHelper);
+ return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments);
+ }
+ ts.createAssignHelper = createAssignHelper;
})(ts || (ts = {}));
var ts;
(function (ts) {
- var entities = createEntitiesMap();
function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
var currentSourceFile;
@@ -40203,17 +40653,15 @@ var ts;
return node;
}
currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined;
- return node;
+ return visited;
}
function visitor(node) {
if (node.transformFlags & 4) {
return visitorWorker(node);
}
- else if (node.transformFlags & 8) {
- return ts.visitEachChild(node, visitor, context);
- }
else {
return node;
}
@@ -40227,8 +40675,7 @@ var ts;
case 252:
return visitJsxExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ return ts.visitEachChild(node, visitor, context);
}
}
function transformJsxChildToExpression(node) {
@@ -40266,8 +40713,10 @@ var ts;
if (ts.isJsxSpreadAttribute(attrs[0])) {
segments.unshift(ts.createObjectLiteral());
}
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
+ objectProperties = ts.singleOrUndefined(segments);
+ if (!objectProperties) {
+ objectProperties = ts.createAssignHelper(context, segments);
+ }
}
var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
@@ -40383,458 +40832,291 @@ var ts;
}
}
ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function transformESNext(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
- function visitor(node) {
- if (node.transformFlags & 16) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 32) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 176:
- return visitObjectLiteralExpression(node);
- case 192:
- return visitBinaryExpression(node);
- case 223:
- return visitVariableDeclaration(node);
- case 213:
- return visitForOfStatement(node);
- case 172:
- case 173:
- return node;
- case 225:
- return visitFunctionDeclaration(node);
- case 184:
- return visitFunctionExpression(node);
- case 185:
- return visitArrowFunction(node);
- case 144:
- return visitParameter(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
- }
- }
- function chunkObjectLiteralElements(elements) {
- var chunkObject;
- var objects = [];
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
- var e = elements_3[_i];
- if (e.kind === 259) {
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- chunkObject = undefined;
- }
- var target = e.expression;
- objects.push(ts.visitNode(target, visitor, ts.isExpression));
- }
- else {
- if (!chunkObject) {
- chunkObject = [];
- }
- if (e.kind === 257) {
- var p = e;
- chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
- }
- else {
- chunkObject.push(e);
- }
- }
- }
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- }
- return objects;
- }
- function visitObjectLiteralExpression(node) {
- if (ts.forEach(node.properties, function (p) { return p.kind === 259; })) {
- var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 176) {
- objects.unshift(ts.createObjectLiteral());
- }
- return ts.aggregateTransformFlags(ts.createCall(ts.createIdentifier("__assign"), undefined, objects));
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitBinaryExpression(node) {
- if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, visitor, true);
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitVariableDeclaration(node) {
- if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48) {
- var result = ts.flattenVariableDestructuring(node, undefined, visitor, undefined, true);
- return result;
- }
- return ts.visitEachChild(node, visitor, context);
- }
- function visitForOfStatement(node) {
- var initializer = node.initializer;
- if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
- return ts.visitEachChild(node, visitor, context);
- }
- return ts.convertForOf(node, undefined, visitor, ts.noop, context, true);
- }
- function isRestBindingPattern(initializer) {
- if (ts.isVariableDeclarationList(initializer)) {
- var declaration = ts.firstOrUndefined(initializer.declarations);
- return declaration && declaration.name &&
- declaration.name.kind === 172 &&
- !!(declaration.name.transformFlags & 8388608);
- }
- return false;
- }
- function isRestAssignment(initializer) {
- return initializer.kind === 176 &&
- initializer.transformFlags & 8388608;
- }
- function visitParameter(node) {
- if (isObjectRestParameter(node)) {
- return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, node.initializer, node), node);
- }
- else {
- return node;
- }
- }
- function isObjectRestParameter(node) {
- return node.name &&
- node.name.kind === 172 &&
- !!(node.name.transformFlags & 8388608);
- }
- function visitFunctionDeclaration(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- function visitArrowFunction(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- var func = ts.setOriginalNode(ts.createArrowFunction(node.modifiers, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, body, node), node);
- ts.setEmitFlags(func, 256);
- return func;
- }
- function visitFunctionExpression(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionExpression(node.modifiers, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, body, node), node);
- }
- }
- ts.transformESNext = transformESNext;
+ var entities = ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
})(ts || (ts = {}));
var ts;
(function (ts) {
function transformES2017(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
- var currentSourceFileExternalHelpersModuleName;
+ var currentSourceFile;
var enabledSubstitutions;
- var applicableSubstitutions;
var currentSuperContainer;
var previousOnEmitNode = context.onEmitNode;
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
- return ts.visitEachChild(node, visitor, context);
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 64) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 128) {
- return ts.visitEachChild(node, visitor, context);
+ if ((node.transformFlags & 16) === 0) {
+ return node;
}
- return node;
- }
- function visitorWorker(node) {
switch (node.kind) {
case 119:
return undefined;
@@ -40849,68 +41131,37 @@ var ts;
case 185:
return visitArrowFunction(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return node;
+ return ts.visitEachChild(node, visitor, context);
}
}
function visitAwaitExpression(node) {
return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node);
}
function visitMethodDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var method = ts.createMethod(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionExpression(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(undefined, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, transformFunctionBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitArrowFunction(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, node.equalsGreaterThanToken, transformConciseBody(node), node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformConciseBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- currentScope = body;
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformAsyncFunctionBody(node) {
+ resumeLexicalEnvironment();
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
@@ -40919,52 +41170,49 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, node.body, true);
if (languageVersion >= 2) {
if (resolver.getNodeCheckFlags(node) & 4096) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8);
+ ts.addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & 2048) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4);
+ ts.addEmitHelper(block, asyncSuperHelper);
}
}
return block;
}
else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, true));
+ var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));
+ var declarations = endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(expression);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));
+ }
+ return expression;
}
}
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ function transformFunctionBodyWorker(body, start) {
if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
+ return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));
}
else {
startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));
var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
+ return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));
}
}
function getPromiseConstructor(type) {
- if (type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
+ var typeName = type && ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
}
return undefined;
@@ -41038,14 +41286,15 @@ var ts;
|| kind === 152;
}
function onEmitNode(emitContext, node, emitCallback) {
- var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
if (enabledSubstitutions & 1 && isSuperContainer(node)) {
+ var savedCurrentSuperContainer = currentSuperContainer;
currentSuperContainer = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- previousOnEmitNode(emitContext, node, emitCallback);
- applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
function onSubstituteNode(emitContext, node) {
node = previousOnSubstituteNode(emitContext, node);
@@ -41068,6 +41317,33 @@ var ts;
}
}
ts.transformES2017 = transformES2017;
+ function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ context.requestEmitHelper(awaiterHelper);
+ var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body);
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072;
+ return ts.createCall(ts.getHelperName("__awaiter"), undefined, [
+ ts.createThis(),
+ hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
+ promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
+ generatorFunc
+ ]);
+ }
+ var awaiterHelper = {
+ name: "typescript:awaiter",
+ scoped: false,
+ priority: 5,
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };"
+ };
+ var asyncSuperHelper = {
+ name: "typescript:async-super",
+ scoped: true,
+ text: "\n const _super = name => super[name];"
+ };
+ var advancedAsyncSuperHelper = {
+ name: "typescript:advanced-async-super",
+ scoped: true,
+ text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -41081,55 +41357,52 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 256) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 512) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
+ if ((node.transformFlags & 32) === 0) {
return node;
}
- }
- function visitorWorker(node) {
switch (node.kind) {
case 192:
return visitBinaryExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
return ts.visitEachChild(node, visitor, context);
}
}
function visitBinaryExpression(node) {
+ switch (node.operatorToken.kind) {
+ case 61:
+ return visitExponentiationAssignmentExpression(node);
+ case 39:
+ return visitExponentiationExpression(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitExponentiationAssignmentExpression(node) {
+ var target;
+ var value;
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 61) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
- }
- else if (ts.isPropertyAccessExpression(left)) {
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
- value = ts.createPropertyAccess(expressionTemp, left.name, left);
- }
- else {
- target = left;
- value = left;
- }
- return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ if (ts.isElementAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left);
}
- else if (node.operatorToken.kind === 39) {
- return ts.createMathPow(left, right, node);
+ else if (ts.isPropertyAccessExpression(left)) {
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left);
+ value = ts.createPropertyAccess(expressionTemp, left.name, left);
}
else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ target = left;
+ value = left;
}
+ return ts.createAssignment(target, ts.createMathPow(value, right, node), node);
+ }
+ function visitExponentiationExpression(node) {
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return ts.createMathPow(left, right, node);
}
}
ts.transformES2016 = transformES2016;
@@ -41137,7 +41410,7 @@ var ts;
var ts;
(function (ts) {
function transformES2015(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
@@ -41163,7 +41436,11 @@ var ts;
}
currentSourceFile = node;
currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ currentText = undefined;
+ return visited;
}
function visitor(node) {
return saveStateAndInvoke(node, dispatcher);
@@ -41202,6 +41479,38 @@ var ts;
currentNode = savedCurrentNode;
return visited;
}
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 185) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 131072)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ switch (currentNode.kind) {
+ case 205:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 224:
+ case 223:
+ case 174:
+ case 172:
+ case 173:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
+ }
+ currentParent = currentNode;
+ currentNode = node;
+ }
function returnCapturedThis(node) {
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
@@ -41209,7 +41518,7 @@ var ts;
return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 1024) !== 0 ||
+ return (node.transformFlags & 64) !== 0 ||
node.kind === 219 ||
(ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node));
}
@@ -41220,7 +41529,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 2048 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -41320,14 +41629,14 @@ var ts;
return visitTemplateExpression(node);
case 195:
return visitYieldExpression(node);
+ case 196:
+ return visitSpreadElement(node);
case 96:
return visitSuperKeyword();
case 195:
return ts.visitEachChild(node, visitor, context);
case 149:
return visitMethodDeclaration(node);
- case 261:
- return visitSourceFileNode(node);
case 205:
return visitVariableStatement(node);
default:
@@ -41335,37 +41644,14 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 185) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- switch (currentNode.kind) {
- case 205:
- enclosingVariableStatement = currentNode;
- break;
- case 224:
- case 223:
- case 174:
- case 172:
- case 173:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
- }
- currentParent = currentNode;
- currentNode = node;
+ function visitSourceFile(node) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
}
function visitSwitchStatement(node) {
ts.Debug.assert(convertedLoopState !== undefined);
@@ -41467,9 +41753,9 @@ var ts;
statements.push(exportStatement);
}
var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 33554432) === 0) {
+ if ((emitFlags & 2097152) === 0) {
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(statement, emitFlags | 33554432);
+ ts.setEmitFlags(statement, emitFlags | 2097152);
}
return ts.singleOrMany(statements);
}
@@ -41482,15 +41768,15 @@ var ts;
}
var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node);
var classFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [ts.createParameter(undefined, undefined, undefined, "_super")] : [], undefined, transformClassBody(node, extendsClauseElement));
- if (ts.getEmitFlags(node) & 524288) {
- ts.setEmitFlags(classFunction, 524288);
+ if (ts.getEmitFlags(node) & 32768) {
+ ts.setEmitFlags(classFunction, 32768);
}
var inner = ts.createPartiallyEmittedExpression(classFunction);
inner.end = node.end;
- ts.setEmitFlags(inner, 49152);
+ ts.setEmitFlags(inner, 1536);
var outer = ts.createPartiallyEmittedExpression(inner);
outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement
? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
: []));
@@ -41505,19 +41791,19 @@ var ts;
var localName = ts.getLocalName(node);
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152);
+ ts.setEmitFlags(outer, 1536);
var statement = ts.createReturn(outer);
statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 | 12288);
+ ts.setEmitFlags(statement, 1536 | 384);
statements.push(statement);
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true);
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
return block;
}
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)), extendsClauseElement));
+ statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement));
}
}
function addConstructor(statements, node, extendsClauseElement) {
@@ -41525,29 +41811,27 @@ var ts;
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node);
if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256);
+ ts.setEmitFlags(constructorFunction, 8);
}
statements.push(constructorFunction);
}
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)
+ || [];
}
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
var statements = [];
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = -1;
if (hasSynthesizedSuper) {
- statementOffset = 1;
+ statementOffset = 0;
}
else if (constructor) {
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor);
}
if (constructor) {
- ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, false);
- ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -41569,7 +41853,7 @@ var ts;
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true);
if (!constructor) {
- ts.setEmitFlags(block, 49152);
+ ts.setEmitFlags(block, 1536);
}
return block;
}
@@ -41595,7 +41879,7 @@ var ts;
function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) {
if (!hasExtendsClause) {
if (ctor) {
- ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
+ addCaptureThisForNodeIfNeeded(statements, ctor);
}
return 0;
}
@@ -41604,7 +41888,7 @@ var ts;
return 2;
}
if (hasSynthesizedSuper) {
- ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1;
}
@@ -41624,11 +41908,11 @@ var ts;
|| superCallExpression.left.kind !== 179) {
ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
- ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 49152)));
+ ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536)));
statements.push(returnStatement);
return 2;
}
- ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
if (superCallExpression) {
return 1;
}
@@ -41636,7 +41920,7 @@ var ts;
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
}
@@ -41654,6 +41938,86 @@ var ts;
return node;
}
}
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 131072) !== 0;
+ }
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_37)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer);
+ }
+ }
+ }
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, temp))), 524288));
+ }
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288));
+ }
+ }
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter))
+ ], parameter), 1 | 32 | 384), undefined, parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 384 | 32 | 524288);
+ statements.push(statement);
+ }
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 && !inConstructorWithSynthesizedSuper;
+ }
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 48);
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([]))
+ ]), parameter), 524288));
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex))
+ ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0
+ ? temp
+ : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 524288);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 32768 && node.kind !== 185) {
+ captureThisForNode(statements, node, ts.createThis());
+ }
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this", undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 1536 | 524288);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
function addClassMembers(statements, node) {
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
@@ -41685,33 +42049,34 @@ var ts;
function transformClassMethodDeclarationToStatement(receiver, member) {
var commentRange = ts.getCommentRange(member);
var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, member, undefined);
- ts.setEmitFlags(func, 49152);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name), func), member);
+ var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name);
+ var memberFunction = transformFunctionLikeToExpression(member, member, undefined);
+ ts.setEmitFlags(memberFunction, 1536);
+ ts.setSourceMapRange(memberFunction, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member);
ts.setOriginalNode(statement, member);
ts.setCommentRange(statement, commentRange);
- ts.setEmitFlags(statement, 1536);
+ ts.setEmitFlags(statement, 48);
return statement;
}
function transformAccessorsToStatement(receiver, accessors) {
var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor));
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
return statement;
}
function transformAccessorsToExpression(receiver, _a, startsOnNewLine) {
var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 | 1024);
+ ts.setEmitFlags(target, 1536 | 32);
ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 | 512);
+ ts.setEmitFlags(propertyName, 1536 | 16);
ts.setSourceMapRange(propertyName, firstAccessor.name);
var properties = [];
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- ts.setEmitFlags(getterFunction, 16384);
+ ts.setEmitFlags(getterFunction, 512);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -41719,7 +42084,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- ts.setEmitFlags(setterFunction, 16384);
+ ts.setEmitFlags(setterFunction, 512);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -41736,28 +42101,91 @@ var ts;
return call;
}
function visitArrowFunction(node) {
- if (node.transformFlags & 262144) {
+ if (node.transformFlags & 16384) {
enableSubstitutionsForCapturedThis();
}
- var func = transformFunctionLikeToExpression(node, node, undefined);
- ts.setEmitFlags(func, 256);
+ var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ ts.setEmitFlags(func, 8);
return func;
}
function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, node, node.name);
+ return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, node.asteriskToken, node.name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis), node), node);
+ return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformFunctionLikeToExpression(node, location, name) {
var savedContainingNonArrowFunction = enclosingNonArrowFunction;
if (node.kind !== 185) {
enclosingNonArrowFunction = node;
}
- var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter), undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location), node);
+ var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
+ function transformFunctionBody(node) {
+ var multiLine = false;
+ var singleLine = false;
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ resumeLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, false);
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 185);
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, body);
+ ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
+ statements.push(returnStatement);
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 1);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
+ }
function visitExpressionStatement(node) {
switch (node.expression.kind) {
case 183:
@@ -41768,19 +42196,20 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitParenthesizedExpression(node, needsDestructuringValue) {
- if (needsDestructuringValue) {
+ if (!needsDestructuringValue) {
switch (node.expression.kind) {
case 183:
- return ts.createParen(visitParenthesizedExpression(node.expression, true), node);
+ return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));
case 192:
- return ts.createParen(visitBinaryExpression(node.expression, true), node);
+ return ts.updateParen(node, visitBinaryExpression(node.expression, false));
}
}
return ts.visitEachChild(node, visitor, context);
}
function visitBinaryExpression(node, needsDestructuringValue) {
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ if (ts.isDestructuringAssignment(node)) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue);
+ }
}
function visitVariableStatement(node) {
if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) {
@@ -41791,7 +42220,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, undefined, visitor);
+ assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);
}
else {
assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -41818,7 +42247,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 67108864
+ if (node.transformFlags & 8388608
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
var firstDeclaration = ts.firstOrUndefined(declarations);
@@ -41851,17 +42280,17 @@ var ts;
return visitVariableDeclaration(node);
}
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_5 = ts.getMutableClone(node);
- clone_5.initializer = ts.createVoidZero();
- return clone_5;
+ var clone_3 = ts.getMutableClone(node);
+ clone_3.initializer = ts.createVoidZero();
+ return clone_3;
}
return ts.visitEachChild(node, visitor, context);
}
function visitVariableDeclaration(node) {
if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1);
- return ts.flattenVariableDestructuring(node, undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ var hoistTempVariables = enclosingVariableStatement
+ && ts.hasModifier(enclosingVariableStatement, 1);
+ return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -41900,7 +42329,69 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, false);
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(undefined);
+ var elementAccess = ts.createElementAccess(rhsReference, counter);
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess);
+ var declarationList = ts.createVariableDeclarationList(declarations, initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(undefined, declarationList));
+ }
+ else {
+ statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter))
+ ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ var assignment = ts.createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0)));
+ }
+ else {
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));
+ var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation);
+ ts.setEmitFlags(body, 48 | 384);
+ var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression)
+ ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node);
+ ts.setEmitFlags(forStatement, 256);
+ return forStatement;
}
function visitObjectLiteralExpression(node) {
var properties = node.properties;
@@ -41908,7 +42399,7 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 134217728
+ if (property.transformFlags & 16777216
|| property.name.kind === 142) {
numInitialProperties = i;
break;
@@ -41917,7 +42408,7 @@ var ts;
ts.Debug.assert(numInitialProperties !== numProperties);
var temp = ts.createTempVariable(hoistVariableDeclaration);
var expressions = [];
- var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 524288));
+ var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768));
if (node.multiLine) {
assignment.startsOnNewLine = true;
}
@@ -41998,26 +42489,26 @@ var ts;
var currentState = convertedLoopState;
convertedLoopState = outerConvertedLoopState;
if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1, statements_3);
- loopBody = ts.createBlock(statements_3, undefined, true);
+ var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1, statements_4);
+ loopBody = ts.createBlock(statements_4, undefined, true);
}
if (!ts.isBlock(loopBody)) {
loopBody = ts.createBlock([loopBody], undefined, true);
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152) !== 0
- && (node.statement.transformFlags & 134217728) !== 0;
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0
+ && (node.statement.transformFlags & 16777216) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256;
+ loopBodyFlags |= 8;
}
if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152;
+ loopBodyFlags |= 131072;
}
var convertedLoopVariable = ts.createVariableStatement(undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
ts.createVariableDeclaration(functionName, undefined, ts.setEmitFlags(ts.createFunctionExpression(undefined, isAsyncBlockContainingAwait ? ts.createToken(38) : undefined, undefined, undefined, loopParameters, undefined, loopBody), loopBodyFlags))
- ]), 16777216));
+ ]), 1048576));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
if (currentState.argumentsName) {
@@ -42234,7 +42725,7 @@ var ts;
ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));
var temp = ts.createTempVariable(undefined);
var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);
- var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor);
+ var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);
var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags);
var destructure = ts.createVariableStatement(undefined, list);
return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
@@ -42246,7 +42737,7 @@ var ts;
function visitMethodDeclaration(node) {
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined);
- ts.setEmitFlags(functionExpression, 16384 | ts.getEmitFlags(functionExpression));
+ ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));
return ts.createPropertyAssignment(node.name, functionExpression, node);
}
function visitShorthandPropertyAssignment(node) {
@@ -42267,10 +42758,10 @@ var ts;
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
if (node.expression.kind === 96) {
- ts.setEmitFlags(thisArg, 128);
+ ts.setEmitFlags(thisArg, 4);
}
var resultingCall;
- if (node.transformFlags & 8388608) {
+ if (node.transformFlags & 524288) {
resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
@@ -42278,7 +42769,7 @@ var ts;
}
if (node.expression.kind === 96) {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128);
+ ts.setEmitFlags(actualThis, 4);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
return assignToCapturedThis
? ts.createAssignment(ts.createIdentifier("_this"), initializer)
@@ -42287,7 +42778,7 @@ var ts;
return resultingCall;
}
function visitNewExpression(node) {
- ts.Debug.assert((node.transformFlags & 8388608) !== 0);
+ ts.Debug.assert((node.transformFlags & 524288) !== 0);
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []);
}
@@ -42315,6 +42806,9 @@ var ts;
function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine);
}
+ function visitSpreadElement(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
function visitExpressionOfSpread(node) {
return ts.visitNode(node.expression, visitor, ts.isExpression);
}
@@ -42392,18 +42886,6 @@ var ts;
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, node.statements);
- return clone;
- }
function onEmitNode(emitContext, node, emitCallback) {
var savedEnclosingFunction = enclosingFunction;
if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
@@ -42483,7 +42965,7 @@ var ts;
function substituteThisKeyword(node) {
if (enabledSubstitutions & 1
&& enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256) {
+ && ts.getEmitFlags(enclosingFunction) & 8) {
return ts.createIdentifier("_this", node);
}
return node;
@@ -42496,8 +42978,7 @@ var ts;
if (!constructor || !hasExtendsClause) {
return false;
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ if (ts.some(constructor.parameters)) {
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
@@ -42517,10 +42998,23 @@ var ts;
return false;
}
var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ return ts.isIdentifier(expression) && expression.text === "arguments";
}
}
ts.transformES2015 = transformES2015;
+ function createExtendsHelper(context, name) {
+ context.requestEmitHelper(extendsHelper);
+ return ts.createCall(ts.getHelperName("__extends"), undefined, [
+ name,
+ ts.createIdentifier("_super")
+ ]);
+ }
+ var extendsHelper = {
+ name: "typescript:extends",
+ scoped: false,
+ priority: 0,
+ text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };"
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -42532,7 +43026,7 @@ var ts;
_a[7] = "endfinally",
_a));
function transformGenerators(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var resolver = context.getEmitResolver();
@@ -42566,15 +43060,15 @@ var ts;
var withBlockStack;
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
+ if (ts.isDeclarationFile(node)
+ || (node.transformFlags & 512) === 0) {
return node;
}
- if (node.transformFlags & 8192) {
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- }
- return node;
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
var transformFlags = node.transformFlags;
@@ -42584,10 +43078,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 4096) {
+ else if (transformFlags & 256) {
return visitGenerator(node);
}
- else if (transformFlags & 8192) {
+ else if (transformFlags & 512) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -42630,10 +43124,10 @@ var ts;
case 216:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (8192 | 268435456)) {
+ else if (node.transformFlags & (512 | 33554432)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -42675,8 +43169,8 @@ var ts;
}
}
function visitFunctionDeclaration(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -42696,8 +43190,8 @@ var ts;
}
}
function visitFunctionExpression(node) {
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152) {
- node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, node.parameters, undefined, transformGeneratorFunctionBody(node.body), node), node);
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072) {
+ node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node);
}
else {
var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
@@ -42748,7 +43242,7 @@ var ts;
operationArguments = undefined;
operationLocations = undefined;
state = ts.createTempVariable(undefined);
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
@@ -42770,12 +43264,12 @@ var ts;
return ts.createBlock(statements, body, body.multiLine);
}
function visitVariableStatement(node) {
- if (node.transformFlags & 134217728) {
+ if (node.transformFlags & 16777216) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
else {
- if (ts.getEmitFlags(node) & 8388608) {
+ if (ts.getEmitFlags(node) & 524288) {
return node;
}
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
@@ -42852,10 +43346,10 @@ var ts;
else if (node.operatorToken.kind === 25) {
return visitCommaExpression(node);
}
- var clone_6 = ts.getMutableClone(node);
- clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_6;
+ var clone_4 = ts.getMutableClone(node);
+ clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_4;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -42920,26 +43414,30 @@ var ts;
return createGeneratorResume();
}
function visitArrayLiteralExpression(node) {
- return visitElements(node.elements, node.multiLine);
+ return visitElements(node.elements, undefined, undefined, node.multiLine);
}
- function visitElements(elements, _multiLine) {
+ function visitElements(elements, leadingElement, location, multiLine) {
var numInitialElements = countInitialNodesWithoutYield(elements);
var temp = declareLocal();
var hasAssignedTemp = false;
if (numInitialElements > 0) {
- emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements)));
+ var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
+ emitAssignment(temp, ts.createArrayLiteral(leadingElement
+ ? [leadingElement].concat(initialElements) : initialElements));
+ leadingElement = undefined;
hasAssignedTemp = true;
}
var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
return hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions);
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);
function reduceElement(expressions, element) {
if (containsYield(element) && expressions.length > 0) {
emitAssignment(temp, hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions));
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine));
hasAssignedTemp = true;
+ leadingElement = undefined;
expressions = [];
}
expressions.push(ts.visitNode(element, visitor, ts.isExpression));
@@ -42973,10 +43471,10 @@ var ts;
}
function visitElementAccessExpression(node) {
if (containsYield(node.argumentExpression)) {
- var clone_7 = ts.getMutableClone(node);
- clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_7;
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_5;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -42990,7 +43488,7 @@ var ts;
function visitNewExpression(node) {
if (ts.forEach(node.arguments, containsYield)) {
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)), undefined, [], node), node);
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -43432,7 +43930,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 134217728) !== 0;
+ return node && (node.transformFlags & 16777216) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -43462,12 +43960,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_37) {
- var clone_8 = ts.getMutableClone(name_37);
- ts.setSourceMapRange(clone_8, node);
- ts.setCommentRange(clone_8, node);
- return clone_8;
+ var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_38) {
+ var clone_6 = ts.getMutableClone(name_38);
+ ts.setSourceMapRange(clone_6, node);
+ ts.setCommentRange(clone_6, node);
+ return clone_6;
}
}
}
@@ -43858,10 +44356,7 @@ var ts;
currentExceptionBlock = undefined;
withBlockStack = undefined;
var buildResult = buildStatements();
- return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), undefined, [
- ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 4194304)
- ]);
+ return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144));
}
function buildStatements() {
if (operations) {
@@ -44124,6 +44619,16 @@ var ts;
}
}
ts.transformGenerators = transformGenerators;
+ function createGeneratorHelper(context, body) {
+ context.requestEmitHelper(generatorHelper);
+ return ts.createCall(ts.getHelperName("__generator"), undefined, [ts.createThis(), body]);
+ }
+ var generatorHelper = {
+ name: "typescript:generator",
+ scoped: false,
+ priority: 6,
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
+ };
var _a;
})(ts || (ts = {}));
var ts;
@@ -44180,7 +44685,7 @@ var ts;
_a[ts.ModuleKind.AMD] = transformAMDModule,
_a[ts.ModuleKind.UMD] = transformUMDModule,
_a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
@@ -44209,7 +44714,7 @@ var ts;
return node;
}
currentSourceFile = node;
- currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule(node);
currentSourceFile = undefined;
@@ -44220,12 +44725,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, false);
var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 | ts.getEmitFlags(node));
+ ts.addEmitHelper(updated, exportStarHelper);
}
return updated;
}
@@ -44235,8 +44741,7 @@ var ts;
return transformAsynchronousModule(node, define, moduleName, true);
}
function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16);
+ var define = ts.createRawExpression(umdHelper);
return transformAsynchronousModule(node, define, undefined, false);
}
function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) {
@@ -44273,7 +44778,7 @@ var ts;
var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions);
var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile);
if (includeNonAmdDependencies && importAliasName) {
- ts.setEmitFlags(importAliasName, 128);
+ ts.setEmitFlags(importAliasName, 4);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName));
}
@@ -44287,12 +44792,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, true);
var body = ts.createBlock(statements, undefined, true);
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(body, 2);
+ ts.addEmitHelper(body, exportStarHelper);
}
return body;
}
@@ -44300,12 +44806,12 @@ var ts;
if (currentModuleInfo.exportEquals) {
if (emitAsReturn) {
var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 12288 | 49152);
+ ts.setEmitFlags(statement, 384 | 1536);
statements.push(statement);
}
else {
var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
statements.push(statement);
}
}
@@ -44326,9 +44832,9 @@ var ts;
return visitFunctionDeclaration(node);
case 226:
return visitClassDeclaration(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return node;
@@ -44519,7 +45025,7 @@ var ts;
}
function transformInitializedVariable(node) {
if (ts.isBindingPattern(node.name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression);
}
else {
return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer);
@@ -44533,7 +45039,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -44653,7 +45159,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value), location);
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -44720,6 +45226,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
if (exportContainer && exportContainer.kind === 261) {
@@ -44731,8 +45244,8 @@ var ts;
return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node);
}
else if (ts.isImportSpecifier(importDeclaration)) {
- var name_38 = importDeclaration.propertyName || importDeclaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node);
+ var name_39 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node);
}
}
}
@@ -44791,6 +45304,12 @@ var ts;
var _a;
}
ts.transformModule = transformModule;
+ var exportStarHelper = {
+ name: "typescript:export-star",
+ scoped: true,
+ text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }"
+ };
+ var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })";
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -44829,14 +45348,15 @@ var ts;
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
enclosingBlockScopedContainer = node;
- moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
contextObject = ts.createUniqueName("context");
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [
ts.createParameter(undefined, undefined, undefined, exportFunction),
ts.createParameter(undefined, undefined, undefined, contextObject)
- ], undefined, createSystemModuleBody(node, dependencyGroups));
+ ], undefined, moduleBodyBlock);
var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
var updated = ts.updateSourceFileNode(node, ts.createNodeArray([
@@ -44844,7 +45364,9 @@ var ts;
? [moduleName, dependencies, moduleBodyFunction]
: [dependencies, moduleBodyFunction]))
], node.statements));
- ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1);
+ if (!(compilerOptions.outFile || compilerOptions.out)) {
+ ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
+ }
if (noSubstitution) {
noSubstitutionMap[id] = noSubstitution;
noSubstitution = undefined;
@@ -44885,6 +45407,7 @@ var ts;
statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
])));
+ ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true);
var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset);
ts.addRange(statements, hoistedStatements);
ts.addRange(statements, endLexicalEnvironment());
@@ -44893,9 +45416,7 @@ var ts;
ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true)))
]), true)));
- var body = ts.createBlock(statements, undefined, true);
- ts.setEmitFlags(body, 1);
- return body;
+ return ts.createBlock(statements, undefined, true);
}
function addExportStarIfNeeded(statements) {
if (!moduleInfo.hasExportStarsToExportValues) {
@@ -44955,7 +45476,7 @@ var ts;
var exports = ts.createIdentifier("exports");
var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n])));
}
return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([
ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
@@ -44964,7 +45485,7 @@ var ts;
ts.createForIn(ts.createVariableDeclarationList([
ts.createVariableDeclaration(n, undefined)
]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32)
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1)
])),
ts.createStatement(ts.createCall(exportFunction, undefined, [exports]))
], undefined, true));
@@ -45136,14 +45657,14 @@ var ts;
}
}
function shouldHoistVariableDeclarationList(node) {
- return (ts.getEmitFlags(node) & 16777216) === 0
+ return (ts.getEmitFlags(node) & 1048576) === 0
&& (enclosingBlockScopedContainer.kind === 261
|| (ts.getOriginalNode(node).flags & 3) === 0);
}
function transformInitializedVariable(node, isExportedDeclaration) {
var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
return ts.isBindingPattern(node.name)
- ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment)
: createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
}
function createExportedVariableAssignment(name, value, location) {
@@ -45167,7 +45688,7 @@ var ts;
return node;
}
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432) !== 0;
+ return (ts.getEmitFlags(node) & 2097152) !== 0;
}
function visitEndOfDeclarationMarker(node) {
var id = ts.getOriginalNodeId(node);
@@ -45284,7 +45805,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value));
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152);
+ ts.setEmitFlags(statement, 1536);
}
return statement;
}
@@ -45328,9 +45849,9 @@ var ts;
return visitCatchClause(node);
case 204:
return visitBlock(node);
- case 294:
- return visitMergeDeclarationMarker(node);
case 295:
+ return visitMergeDeclarationMarker(node);
+ case 296:
return visitEndOfDeclarationMarker(node);
default:
return destructuringVisitor(node);
@@ -45420,11 +45941,11 @@ var ts;
return node;
}
function destructuringVisitor(node) {
- if (node.transformFlags & 16384
+ if (node.transformFlags & 1024
&& node.kind === 192) {
return visitDestructuringAssignment(node);
}
- else if (node.transformFlags & 32768) {
+ else if (node.transformFlags & 2048) {
return ts.visitEachChild(node, destructuringVisitor, context);
}
else {
@@ -45433,7 +45954,7 @@ var ts;
}
function visitDestructuringAssignment(node) {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
- return ts.flattenDestructuringAssignment(context, node, true, hoistVariableDeclaration, destructuringVisitor);
+ return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true);
}
return ts.visitEachChild(node, destructuringVisitor, context);
}
@@ -45515,6 +46036,13 @@ var ts;
return node;
}
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var importDeclaration = resolver.getReferencedImportDeclaration(node);
if (importDeclaration) {
@@ -45602,13 +46130,30 @@ var ts;
(function (ts) {
function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableEmitNotification(261);
+ context.enableSubstitution(70);
+ var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
+ var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
+ if (externalHelpersModuleName) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements);
+ ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ }
+ else {
+ return ts.visitEachChild(node, visitor, context);
+ }
}
return node;
}
@@ -45624,6 +46169,32 @@ var ts;
function visitExportAssignment(node) {
return node.isExportEquals ? undefined : node;
}
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (ts.isSourceFile(node)) {
+ currentSourceFile = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isIdentifier(node) && emitContext === 1) {
+ return substituteExpressionIdentifier(node);
+ }
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ }
+ return node;
+ }
}
ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
@@ -45667,21 +46238,27 @@ var ts;
}
ts.getTransformers = getTransformers;
function transformFiles(resolver, host, sourceFiles, transformers) {
+ var enabledSyntaxKindFeatures = new Array(298);
+ var lexicalEnvironmentDisabled = false;
+ var lexicalEnvironmentVariableDeclarations;
+ var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(296);
var lexicalEnvironmentStackOffset = 0;
- var hoistedVariableDeclarations;
- var hoistedFunctionDeclarations;
- var lexicalEnvironmentDisabled;
+ var lexicalEnvironmentSuspended = false;
+ var emitHelpers;
var context = {
getCompilerOptions: function () { return host.getCompilerOptions(); },
getEmitResolver: function () { return resolver; },
getEmitHost: function () { return host; },
- hoistVariableDeclaration: hoistVariableDeclaration,
- hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
+ suspendLexicalEnvironment: suspendLexicalEnvironment,
+ resumeLexicalEnvironment: resumeLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
+ hoistVariableDeclaration: hoistVariableDeclaration,
+ hoistFunctionDeclaration: hoistFunctionDeclaration,
+ requestEmitHelper: requestEmitHelper,
+ readEmitHelpers: readEmitHelpers,
onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
@@ -45708,7 +46285,7 @@ var ts;
}
function isSubstitutionEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0
- && (ts.getEmitFlags(node) & 128) === 0;
+ && (ts.getEmitFlags(node) & 4) === 0;
}
function emitNodeWithSubstitution(emitContext, node, emitCallback) {
if (node) {
@@ -45727,7 +46304,7 @@ var ts;
}
function isEmitNotificationEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0
- || (ts.getEmitFlags(node) & 64) !== 0;
+ || (ts.getEmitFlags(node) & 2) !== 0;
}
function emitNodeWithNotification(emitContext, node, emitCallback) {
if (node) {
@@ -45742,39 +46319,51 @@ var ts;
function hoistVariableDeclaration(name) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
var decl = ts.createVariableDeclaration(name);
- if (!hoistedVariableDeclarations) {
- hoistedVariableDeclarations = [decl];
+ if (!lexicalEnvironmentVariableDeclarations) {
+ lexicalEnvironmentVariableDeclarations = [decl];
}
else {
- hoistedVariableDeclarations.push(decl);
+ lexicalEnvironmentVariableDeclarations.push(decl);
}
}
function hoistFunctionDeclaration(func) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
- if (!hoistedFunctionDeclarations) {
- hoistedFunctionDeclarations = [func];
+ if (!lexicalEnvironmentFunctionDeclarations) {
+ lexicalEnvironmentFunctionDeclarations = [func];
}
else {
- hoistedFunctionDeclarations.push(func);
+ lexicalEnvironmentFunctionDeclarations.push(func);
}
}
function startLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase.");
- lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations;
- lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations;
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
+ lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
+ lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStackOffset++;
- hoistedVariableDeclarations = undefined;
- hoistedFunctionDeclarations = undefined;
+ lexicalEnvironmentVariableDeclarations = undefined;
+ lexicalEnvironmentFunctionDeclarations = undefined;
+ }
+ function suspendLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
+ lexicalEnvironmentSuspended = true;
+ }
+ function resumeLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase.");
+ ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
+ lexicalEnvironmentSuspended = false;
}
function endLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
var statements;
- if (hoistedVariableDeclarations || hoistedFunctionDeclarations) {
- if (hoistedFunctionDeclarations) {
- statements = hoistedFunctionDeclarations.slice();
+ if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
+ if (lexicalEnvironmentFunctionDeclarations) {
+ statements = lexicalEnvironmentFunctionDeclarations.slice();
}
- if (hoistedVariableDeclarations) {
- var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations));
+ if (lexicalEnvironmentVariableDeclarations) {
+ var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
if (!statements) {
statements = [statement];
}
@@ -45784,10 +46373,25 @@ var ts;
}
}
lexicalEnvironmentStackOffset--;
- hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
- hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ if (lexicalEnvironmentStackOffset === 0) {
+ lexicalEnvironmentVariableDeclarationsStack = [];
+ lexicalEnvironmentFunctionDeclarationsStack = [];
+ }
return statements;
}
+ function requestEmitHelper(helper) {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
+ emitHelpers = ts.append(emitHelpers, helper);
+ }
+ function readEmitHelpers() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ var helpers = emitHelpers;
+ emitHelpers = undefined;
+ return helpers;
+ }
}
ts.transformFiles = transformFiles;
var _a;
@@ -46042,15 +46646,15 @@ var ts;
}
}
function emitLines(nodes) {
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
emit(node);
}
}
function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {
var currentWriterPos = writer.getTextPos();
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (!canEmitFn || canEmitFn(node)) {
if (currentWriterPos !== writer.getTextPos()) {
write(separator);
@@ -46065,7 +46669,7 @@ var ts;
}
function writeJsDocComments(declaration) {
if (declaration) {
- var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText);
+ var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);
ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);
ts.emitComments(currentText, currentLineMap, writer, jsDocComments, false, true, newLine, ts.writeCommentRange);
}
@@ -46252,9 +46856,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_39 = baseName + "_" + count;
- if (!(name_39 in currentIdentifiers)) {
- return name_39;
+ var name_40 = baseName + "_" + count;
+ if (!(name_40 in currentIdentifiers)) {
+ return name_40;
}
}
}
@@ -46648,6 +47252,9 @@ var ts;
case 225:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
+ case 228:
+ diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
+ break;
default:
ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
@@ -46741,7 +47348,10 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
- emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false);
+ var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });
+ if (interfaceExtendsTypes && interfaceExtendsTypes.length) {
+ emitHeritageClause(interfaceExtendsTypes, false);
+ }
write(" {");
writeLine();
increaseIndent();
@@ -47459,12 +48069,12 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 292
- && (emitFlags & 512) === 0
+ if (node.kind !== 293
+ && (emitFlags & 16) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
}
- if (emitFlags & 2048) {
+ if (emitFlags & 64) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47472,8 +48082,8 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 292
- && (emitFlags & 1024) === 0
+ if (node.kind !== 293
+ && (emitFlags & 32) === 0
&& end >= 0) {
emitPos(end);
}
@@ -47487,13 +48097,13 @@ var ts;
var emitFlags = emitNode && emitNode.flags;
var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);
- if ((emitFlags & 4096) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 128) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
tokenPos = emitCallback(token, tokenPos);
if (range)
tokenPos = range.end;
- if ((emitFlags & 8192) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 256) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
return tokenPos;
@@ -47603,7 +48213,7 @@ var ts;
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
var emitFlags = ts.getEmitFlags(node);
if ((pos < 0 && end < 0) || (pos === end)) {
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47616,9 +48226,9 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 292;
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = end < 0 || (emitFlags & 32768) !== 0;
+ var isEmittedNode = node.kind !== 293;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitLeadingComments(pos, isEmittedNode);
}
@@ -47637,7 +48247,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitNodeWithComment");
}
- if (emitFlags & 65536) {
+ if (emitFlags & 2048) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -47666,15 +48276,15 @@ var ts;
}
var pos = detachedRange.pos, end = detachedRange.end;
var emitFlags = ts.getEmitFlags(node);
- var skipLeadingComments = pos < 0 || (emitFlags & 16384) !== 0;
- var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768) !== 0;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
+ var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024) !== 0;
if (!skipLeadingComments) {
emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
}
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments");
}
- if (emitFlags & 65536 && !disabled) {
+ if (emitFlags & 2048 && !disabled) {
disabled = true;
emitCallback(node);
disabled = false;
@@ -47835,18 +48445,6 @@ var ts;
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
- var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};";
- var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
- var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
- var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
- var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};";
- var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};";
- var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};";
- var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};";
- var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}";
- var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})";
- var superHelper = "\nconst _super = name => super[name];";
- var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);";
var compilerOptions = host.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
@@ -47868,12 +48466,7 @@ var ts;
var currentSourceFile;
var currentText;
var currentFileIdentifiers;
- var extendsEmitted;
- var assignEmitted;
- var restEmitted;
- var decorateEmitted;
- var paramEmitted;
- var awaiterEmitted;
+ var bundledHelpers;
var isOwnFileEmit;
var emitSkipped = false;
var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);
@@ -47922,11 +48515,12 @@ var ts;
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNameSet = ts.createMap();
+ bundledHelpers = isBundledEmit ? ts.createMap() : undefined;
isOwnFileEmit = !isBundledEmit;
if (isBundledEmit && moduleKind) {
for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {
var sourceFile = sourceFiles_5[_a];
- emitEmitHelpers(sourceFile);
+ emitHelpers(sourceFile, true);
}
}
ts.forEach(sourceFiles, printSourceFile);
@@ -47936,23 +48530,18 @@ var ts;
write("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
}
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false);
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles);
}
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
}
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM);
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
sourceMap.reset();
comments.reset();
writer.reset();
tempFlags = 0;
currentSourceFile = undefined;
currentText = undefined;
- extendsEmitted = false;
- assignEmitted = false;
- decorateEmitted = false;
- paramEmitted = false;
- awaiterEmitted = false;
isOwnFileEmit = false;
}
function printSourceFile(node) {
@@ -48320,8 +48909,10 @@ var ts;
return emitJsxElement(node);
case 247:
return emitJsxSelfClosingElement(node);
- case 293:
+ case 294:
return emitPartiallyEmittedExpression(node);
+ case 297:
+ return writeLines(node.text);
}
}
function emitNumericLiteral(node) {
@@ -48341,12 +48932,7 @@ var ts;
}
}
function emitIdentifier(node) {
- if (ts.getEmitFlags(node) & 16) {
- writeLines(umdHelper);
- }
- else {
- write(getTextOfNode(node, false));
- }
+ write(getTextOfNode(node, false));
}
function emitQualifiedName(node) {
emitEntityName(node.left);
@@ -48589,7 +49175,7 @@ var ts;
write("{}");
}
else {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -48604,7 +49190,7 @@ var ts;
function emitPropertyAccessExpression(node) {
var indentBeforeDot = false;
var indentAfterDot = false;
- if (!(ts.getEmitFlags(node) & 1048576)) {
+ if (!(ts.getEmitFlags(node) & 65536)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd };
@@ -48788,7 +49374,7 @@ var ts;
}
}
function emitBlockStatements(node) {
- if (ts.getEmitFlags(node) & 32) {
+ if (ts.getEmitFlags(node) & 1) {
emitList(node, node.statements, 384);
}
else {
@@ -48964,11 +49550,11 @@ var ts;
var body = node.body;
if (body) {
if (ts.isBlock(body)) {
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
- if (ts.getEmitFlags(node) & 4194304) {
+ if (ts.getEmitFlags(node) & 262144) {
emitSignatureHead(node);
emitBlockFunctionBody(body);
}
@@ -49000,7 +49586,7 @@ var ts;
emitWithPrefix(": ", node.type);
}
function shouldEmitBlockFunctionBodyOnSingleLine(body) {
- if (ts.getEmitFlags(body) & 32) {
+ if (ts.getEmitFlags(body) & 1) {
return true;
}
if (body.multiLine) {
@@ -49055,7 +49641,7 @@ var ts;
emitModifiers(node, node.modifiers);
write("class");
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
- var indentedFlag = ts.getEmitFlags(node) & 524288;
+ var indentedFlag = ts.getEmitFlags(node) & 32768;
if (indentedFlag) {
increaseIndent();
}
@@ -49314,7 +49900,7 @@ var ts;
emit(node.name);
write(": ");
var initializer = node.initializer;
- if ((ts.getEmitFlags(initializer) & 16384) === 0) {
+ if ((ts.getEmitFlags(initializer) & 512) === 0) {
var commentRange = ts.getCommentRange(initializer);
emitTrailingCommentsOfPosition(commentRange.pos);
}
@@ -49368,71 +49954,31 @@ var ts;
}
return statements.length;
}
- function emitHelpers(node) {
- var emitFlags = ts.getEmitFlags(node);
+ function emitHelpers(node, isBundle) {
+ var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;
+ var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;
var helpersEmitted = false;
- if (emitFlags & 1) {
- helpersEmitted = emitEmitHelpers(currentSourceFile);
- }
- if (emitFlags & 2) {
- writeLines(exportStarHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 4) {
- writeLines(superHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 8) {
- writeLines(advancedSuperHelper);
- helpersEmitted = true;
- }
- return helpersEmitted;
- }
- function emitEmitHelpers(node) {
- if (compilerOptions.noEmitHelpers) {
- return false;
- }
- if (compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- return false;
- }
- var helpersEmitted = false;
- if ((languageVersion < 2) && (!extendsEmitted && node.flags & 1024)) {
- writeLines(extendsHelper);
- extendsEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 5 || currentSourceFile.scriptKind === 2 || currentSourceFile.scriptKind === 4) &&
- compilerOptions.jsx !== 1 &&
- !assignEmitted &&
- node.flags & 16384) {
- writeLines(assignHelper);
- assignEmitted = true;
- }
- if (languageVersion < 5 && !restEmitted && node.flags & 32768) {
- writeLines(restHelper);
- restEmitted = true;
- }
- if (!decorateEmitted && node.flags & 2048) {
- writeLines(decorateHelper);
- if (compilerOptions.emitDecoratorMetadata) {
- writeLines(metadataHelper);
- }
- decorateEmitted = true;
- helpersEmitted = true;
- }
- if (!paramEmitted && node.flags & 4096) {
- writeLines(paramHelper);
- paramEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 4) && (!awaiterEmitted && node.flags & 8192)) {
- writeLines(awaiterHelper);
- if (languageVersion < 2) {
- writeLines(generatorHelper);
+ var helpers = ts.getEmitHelpers(node);
+ if (helpers) {
+ for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {
+ var helper = _b[_a];
+ if (!helper.scoped) {
+ if (shouldSkip)
+ continue;
+ if (shouldBundle) {
+ if (bundledHelpers[helper.name]) {
+ continue;
+ }
+ bundledHelpers[helper.name] = true;
+ }
+ }
+ else if (isBundle) {
+ continue;
+ }
+ writeLines(helper.text);
+ helpersEmitted = true;
}
- awaiterEmitted = true;
- helpersEmitted = true;
}
if (helpersEmitted) {
writeLine();
@@ -49440,9 +49986,10 @@ var ts;
return helpersEmitted;
}
function writeLines(text) {
- var lines = text.split(/\r\n|\r|\n/g);
+ var lines = text.split(/\r\n?|\n/g);
+ var indentation = guessIndentation(lines);
for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
+ var line = indentation ? lines[i].slice(indentation) : lines[i];
if (line.length) {
if (i > 0) {
writeLine();
@@ -49451,6 +49998,21 @@ var ts;
}
}
}
+ function guessIndentation(lines) {
+ var indentation;
+ for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
+ var line = lines_1[_a];
+ for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
+ if (!ts.isWhiteSpace(line.charCodeAt(i))) {
+ if (indentation === undefined || i < indentation) {
+ indentation = i;
+ break;
+ }
+ }
+ }
+ }
+ return indentation;
+ }
function emitShebang() {
var shebang = ts.getShebang(currentText);
if (shebang) {
@@ -49792,21 +50354,21 @@ var ts;
}
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_40 = flags === 268435456 ? "_i" : "_n";
- if (isUniqueName(name_40)) {
+ var name_41 = flags === 268435456 ? "_i" : "_n";
+ if (isUniqueName(name_41)) {
tempFlags |= flags;
- return name_40;
+ return name_41;
}
}
while (true) {
var count = tempFlags & 268435455;
tempFlags++;
if (count !== 8 && count !== 13) {
- var name_41 = count < 26
+ var name_42 = count < 26
? "_" + String.fromCharCode(97 + count)
: "_" + (count - 26);
- if (isUniqueName(name_41)) {
- return name_41;
+ if (isUniqueName(name_42)) {
+ return name_42;
}
}
}
@@ -49927,7 +50489,6 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
- ts.version = "2.2.0-dev.20161115";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -50143,10 +50704,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_42 = names_1[_i];
- var result = name_42 in cache
- ? cache[name_42]
- : cache[name_42] = loader(name_42, containingFile);
+ var name_43 = names_1[_i];
+ var result = name_43 in cache
+ ? cache[name_43]
+ : cache[name_43] = loader(name_43, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -50200,7 +50761,8 @@ var ts;
ts.forEach(rootNames, function (name) { return processRootFile(name, false); });
var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);
if (typeReferences.length) {
- var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
+ var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
+ var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts");
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (var i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
@@ -50680,8 +51242,8 @@ var ts;
}
break;
}
- for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
- var node = nodes_4[_b];
+ for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {
+ var node = nodes_6[_b];
walk(node);
}
}
@@ -51714,7 +52276,7 @@ var ts;
case 243:
case 237:
return ts.ScriptElementKind.alias;
- case 284:
+ case 285:
return ts.ScriptElementKind.typeElement;
default:
return ts.ScriptElementKind.unknown;
@@ -51929,7 +52491,7 @@ var ts;
ts.findChildOfKind = findChildOfKind;
function findContainingList(node) {
var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
- if (c.kind === 291 && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
@@ -52165,11 +52727,11 @@ var ts;
}
}
if (node) {
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- if (jsDocComment.tags) {
- for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ if (jsDoc.tags) {
+ for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {
var tag = _c[_b];
if (tag.pos <= position && position <= tag.end) {
return tag;
@@ -52491,7 +53053,7 @@ var ts;
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
- else if (ts.isStringOrNumericLiteral(location.kind) &&
+ else if (ts.isStringOrNumericLiteral(location) &&
location.parent.kind === 142) {
return location.text;
}
@@ -53574,16 +54136,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18);
pos = tag.tagName.end;
switch (tag.kind) {
- case 280:
+ case 281:
processJSDocParameterTag(tag);
break;
- case 283:
+ case 284:
processJSDocTemplateTag(tag);
break;
- case 282:
+ case 283:
processElement(tag.typeExpression);
break;
- case 281:
+ case 282:
processElement(tag.typeExpression);
break;
}
@@ -53835,13 +54397,13 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_43 in nameTable) {
- if (nameTable[name_43] === position) {
+ for (var name_44 in nameTable) {
+ if (nameTable[name_44] === position) {
continue;
}
- if (!uniqueNames[name_43]) {
- uniqueNames[name_43] = name_43;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, true);
+ if (!uniqueNames[name_44]) {
+ uniqueNames[name_44] = name_44;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, true);
if (displayName) {
var entry = {
name: displayName,
@@ -54263,11 +54825,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_14 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_14) {
+ var parent_13 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_13) {
break;
}
- currentDir = parent_14;
+ currentDir = parent_13;
}
else {
break;
@@ -54344,10 +54906,10 @@ var ts;
function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_2 = completionData.location;
- var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; });
+ var symbols = completionData.symbols, location_3 = completionData.location;
+ var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
if (symbol) {
- var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
+ var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
return {
name: entryName,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
@@ -54373,8 +54935,8 @@ var ts;
function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) {
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_3 = completionData.location;
- return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_3) === entryName ? s : undefined; });
+ var symbols = completionData.symbols, location_4 = completionData.location;
+ return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_4) === entryName ? s : undefined; });
}
return undefined;
}
@@ -54399,9 +54961,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 282:
- case 280:
+ case 283:
case 281:
+ case 282:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -54436,13 +54998,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_15 = contextToken.parent, kind = contextToken.kind;
+ var parent_14 = contextToken.parent, kind = contextToken.kind;
if (kind === 22) {
- if (parent_15.kind === 177) {
+ if (parent_14.kind === 177) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_15.kind === 141) {
+ else if (parent_14.kind === 141) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -54739,9 +55301,9 @@ var ts;
switch (contextToken.kind) {
case 16:
case 25:
- var parent_16 = contextToken.parent;
- if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) {
- return parent_16;
+ var parent_15 = contextToken.parent;
+ if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) {
+ return parent_15;
}
break;
}
@@ -54764,34 +55326,34 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_17 = contextToken.parent;
+ var parent_16 = contextToken.parent;
switch (contextToken.kind) {
case 27:
case 40:
case 70:
case 250:
case 251:
- if (parent_17 && (parent_17.kind === 247 || parent_17.kind === 248)) {
- return parent_17;
+ if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) {
+ return parent_16;
}
- else if (parent_17.kind === 250) {
- return parent_17.parent;
+ else if (parent_16.kind === 250) {
+ return parent_16.parent;
}
break;
case 9:
- if (parent_17 && ((parent_17.kind === 250) || (parent_17.kind === 251))) {
- return parent_17.parent;
+ if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) {
+ return parent_16.parent;
}
break;
case 17:
- if (parent_17 &&
- parent_17.kind === 252 &&
- parent_17.parent &&
- (parent_17.parent.kind === 250)) {
- return parent_17.parent.parent;
+ if (parent_16 &&
+ parent_16.kind === 252 &&
+ parent_16.parent &&
+ (parent_16.parent.kind === 250)) {
+ return parent_16.parent.parent;
}
- if (parent_17 && parent_17.kind === 251) {
- return parent_17.parent;
+ if (parent_16 && parent_16.kind === 251) {
+ return parent_16.parent;
}
break;
}
@@ -54914,8 +55476,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_44 = element.propertyName || element.name;
- existingImportsOrExports[name_44.text] = true;
+ var name_45 = element.propertyName || element.name;
+ existingImportsOrExports[name_45.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -55212,17 +55774,17 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_18 = child.parent;
- if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261) {
- return parent_18;
+ var parent_17 = child.parent;
+ if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) {
+ return parent_17;
}
- if (parent_18.kind === 221) {
- var tryStatement = parent_18;
+ if (parent_17.kind === 221) {
+ var tryStatement = parent_17;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_18;
+ child = parent_17;
}
return undefined;
}
@@ -56057,24 +56619,24 @@ var ts;
}
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_19 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.initializer));
+ var parent_18 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.initializer));
}
- else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) {
- if (parent_19.body.kind === 204) {
- ts.forEachReturnStatement(parent_19.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {
+ if (parent_18.body.kind === 204) {
+ ts.forEachReturnStatement(parent_18.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_19.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.body));
+ else if (isImplementationExpression(parent_18.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.body));
}
}
- else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.expression));
+ else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.expression));
}
}
}
@@ -56450,9 +57012,9 @@ var ts;
return undefined;
}
}
- var result_3 = [];
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, ts.createMap());
- return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
+ var result_4 = [];
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap());
+ return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
}
return undefined;
});
@@ -56460,7 +57022,7 @@ var ts;
function getNameFromObjectLiteralElement(node) {
if (node.name.kind === 142) {
var nameExpression = node.name.expression;
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
return undefined;
@@ -56472,20 +57034,20 @@ var ts;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name = getNameFromObjectLiteralElement(node);
if (name && contextualType) {
- var result_4 = [];
+ var result_5 = [];
var symbol_2 = contextualType.getProperty(name);
if (symbol_2) {
- result_4.push(symbol_2);
+ result_5.push(symbol_2);
}
if (contextualType.flags & 65536) {
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name);
if (symbol) {
- result_4.push(symbol);
+ result_5.push(symbol);
}
});
}
- return result_4;
+ return result_5;
}
return undefined;
}
@@ -56713,13 +57275,13 @@ var ts;
return undefined;
}
if (type.flags & 65536 && !(type.flags & 16)) {
- var result_5 = [];
+ var result_6 = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
- ts.addRange(result_5, getDefinitionFromSymbol(typeChecker, t.symbol, node));
+ ts.addRange(result_6, getDefinitionFromSymbol(typeChecker, t.symbol, node));
}
});
- return result_5;
+ return result_6;
}
if (!type.symbol) {
return undefined;
@@ -56911,7 +57473,7 @@ var ts;
function getJsDocCommentsFromDeclarations(declarations) {
var documentationComment = [];
forEachUnique(declarations, function (declaration) {
- var comments = ts.getJSDocComments(declaration, true);
+ var comments = ts.getCommentsFromJSDoc(declaration);
if (!comments) {
return;
}
@@ -57050,10 +57612,10 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_45 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_45];
+ for (var name_46 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_46];
if (declarations) {
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46);
if (!matches) {
continue;
}
@@ -57064,14 +57626,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_45);
+ matches = patternMatcher.getMatches(containers, name_46);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -57324,9 +57886,9 @@ var ts;
case 174:
case 223:
var decl = node;
- var name_46 = decl.name;
- if (ts.isBindingPattern(name_46)) {
- addChildrenRecursively(name_46);
+ var name_47 = decl.name;
+ if (ts.isBindingPattern(name_47)) {
+ addChildrenRecursively(name_47);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
addChildrenRecursively(decl.initializer);
@@ -57372,9 +57934,9 @@ var ts;
addLeafNode(node);
break;
default:
- ts.forEach(node.jsDocComments, function (jsDocComment) {
- ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 284) {
+ ts.forEach(node.jsDoc, function (jsDoc) {
+ ts.forEach(jsDoc.tags, function (tag) {
+ if (tag.kind === 285) {
addLeafNode(tag);
}
});
@@ -57490,7 +58052,7 @@ var ts;
case 185:
case 197:
return getFunctionOrClassName(node);
- case 284:
+ case 285:
return getJSDocTypedefTagName(node);
default:
return undefined;
@@ -57530,7 +58092,7 @@ var ts;
return "()";
case 155:
return "[]";
- case 284:
+ case 285:
return getJSDocTypedefTagName(node);
default:
return "<unknown>";
@@ -57577,7 +58139,7 @@ var ts;
case 230:
case 261:
case 228:
- case 284:
+ case 285:
return true;
case 150:
case 149:
@@ -57790,24 +58352,24 @@ var ts;
switch (n.kind) {
case 204:
if (!ts.isFunctionBlock(n)) {
- var parent_20 = n.parent;
+ var parent_19 = n.parent;
var openBrace = ts.findChildOfKind(n, 16, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17, sourceFile);
- if (parent_20.kind === 209 ||
- parent_20.kind === 212 ||
- parent_20.kind === 213 ||
- parent_20.kind === 211 ||
- parent_20.kind === 208 ||
- parent_20.kind === 210 ||
- parent_20.kind === 217 ||
- parent_20.kind === 256) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ if (parent_19.kind === 209 ||
+ parent_19.kind === 212 ||
+ parent_19.kind === 213 ||
+ parent_19.kind === 211 ||
+ parent_19.kind === 208 ||
+ parent_19.kind === 210 ||
+ parent_19.kind === 217 ||
+ parent_19.kind === 256) {
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_20.kind === 221) {
- var tryStatement = parent_20;
+ if (parent_19.kind === 221) {
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -59421,8 +59983,8 @@ var ts;
if (declaration.kind !== 223 && declaration.kind !== 225) {
return false;
}
- for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) {
- if (parent_21.kind === 261 || parent_21.kind === 231) {
+ for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {
+ if (parent_20.kind === 261 || parent_20.kind === 231) {
return false;
}
}
@@ -59909,7 +60471,7 @@ var ts;
function RuleOperationContext() {
var funcs = [];
for (var _i = 0; _i < arguments.length; _i++) {
- funcs[_i - 0] = arguments[_i];
+ funcs[_i] = arguments[_i];
}
this.customContextChecks = funcs;
}
@@ -60116,9 +60678,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_47 in o) {
- if (o[name_47] === rule) {
- return name_47;
+ for (var name_48 in o) {
+ if (o[name_48] === rule) {
+ return name_48;
}
}
throw new Error("Unknown rule");
@@ -61297,11 +61859,23 @@ var ts;
else {
var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
- if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
+ if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
+ function characterToColumn(startLinePosition, characterInLine) {
+ var column = 0;
+ for (var i = 0; i < characterInLine; i++) {
+ if (sourceFile.text.charCodeAt(startLinePosition + i) === 9) {
+ column += options.tabSize - column % options.tabSize;
+ }
+ else {
+ column++;
+ }
+ }
+ return column;
+ }
function indentationIsDifferent(indentationString, startLinePosition) {
return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
}
@@ -62007,6 +62581,579 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ var codefix;
+ (function (codefix) {
+ var ModuleSpecifierComparison;
+ (function (ModuleSpecifierComparison) {
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse";
+ })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {}));
+ var ImportCodeActionMap = (function () {
+ function ImportCodeActionMap() {
+ this.symbolIdToActionMap = ts.createMap();
+ }
+ ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) {
+ if (!newAction) {
+ return;
+ }
+ if (!this.symbolIdToActionMap[symbolId]) {
+ this.symbolIdToActionMap[symbolId] = [newAction];
+ return;
+ }
+ if (newAction.kind === "CodeChange") {
+ this.symbolIdToActionMap[symbolId].push(newAction);
+ return;
+ }
+ var updatedNewImports = [];
+ for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) {
+ var existingAction = _a[_i];
+ if (existingAction.kind === "CodeChange") {
+ updatedNewImports.push(existingAction);
+ continue;
+ }
+ switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) {
+ case ModuleSpecifierComparison.Better:
+ if (newAction.kind === "NewImport") {
+ return;
+ }
+ case ModuleSpecifierComparison.Equal:
+ updatedNewImports.push(existingAction);
+ break;
+ case ModuleSpecifierComparison.Worse:
+ continue;
+ }
+ }
+ updatedNewImports.push(newAction);
+ this.symbolIdToActionMap[symbolId] = updatedNewImports;
+ };
+ ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) {
+ for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) {
+ var newAction = newActions_1[_i];
+ this.addAction(symbolId, newAction);
+ }
+ };
+ ImportCodeActionMap.prototype.getAllActions = function () {
+ var result = [];
+ for (var symbolId in this.symbolIdToActionMap) {
+ result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]);
+ }
+ return result;
+ };
+ ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) {
+ if (moduleSpecifier1 === moduleSpecifier2) {
+ return ModuleSpecifierComparison.Equal;
+ }
+ if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) {
+ return ModuleSpecifierComparison.Better;
+ }
+ if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) {
+ return ModuleSpecifierComparison.Worse;
+ }
+ if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) {
+ var regex = new RegExp(ts.directorySeparator, "g");
+ var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length;
+ var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length;
+ return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Better
+ : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Equal
+ : ModuleSpecifierComparison.Worse;
+ }
+ return ModuleSpecifierComparison.Equal;
+ };
+ return ImportCodeActionMap;
+ }());
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.Cannot_find_name_0.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var checker = context.program.getTypeChecker();
+ var allSourceFiles = context.program.getSourceFiles();
+ var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ var name = token.getText();
+ var symbolIdActionMap = new ImportCodeActionMap();
+ var cachedImportDeclarations = ts.createMap();
+ var cachedNewImportInsertPosition;
+ var allPotentialModules = checker.getAmbientModules();
+ for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) {
+ var otherSourceFile = allSourceFiles_1[_i];
+ if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) {
+ allPotentialModules.push(otherSourceFile.symbol);
+ }
+ }
+ var currentTokenMeaning = ts.getMeaningFromLocation(token);
+ for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) {
+ var moduleSymbol = allPotentialModules_1[_a];
+ context.cancellationToken.throwIfCancellationRequested();
+ var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol);
+ if (defaultExport) {
+ var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
+ if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(localSymbol);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, true));
+ }
+ }
+ var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol);
+ if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol));
+ }
+ }
+ return symbolIdActionMap.getAllActions();
+ function getImportDeclarations(moduleSymbol) {
+ var moduleSymbolId = getUniqueSymbolId(moduleSymbol);
+ if (cachedImportDeclarations[moduleSymbolId]) {
+ return cachedImportDeclarations[moduleSymbolId];
+ }
+ var existingDeclarations = [];
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var importModuleSpecifier = _a[_i];
+ var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier);
+ if (importSymbol === moduleSymbol) {
+ existingDeclarations.push(getImportDeclaration(importModuleSpecifier));
+ }
+ }
+ cachedImportDeclarations[moduleSymbolId] = existingDeclarations;
+ return existingDeclarations;
+ function getImportDeclaration(moduleSpecifier) {
+ var node = moduleSpecifier;
+ while (node) {
+ if (node.kind === 235) {
+ return node;
+ }
+ if (node.kind === 234) {
+ return node;
+ }
+ node = node.parent;
+ }
+ return undefined;
+ }
+ }
+ function getUniqueSymbolId(symbol) {
+ if (symbol.flags & 8388608) {
+ return ts.getSymbolId(checker.getAliasedSymbol(symbol));
+ }
+ return ts.getSymbolId(symbol);
+ }
+ function checkSymbolHasMeaning(symbol, meaning) {
+ var declarations = symbol.getDeclarations();
+ return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false;
+ }
+ function getCodeActionForImport(moduleSymbol, isDefault) {
+ var existingDeclarations = getImportDeclarations(moduleSymbol);
+ if (existingDeclarations.length > 0) {
+ return getCodeActionsForExistingImport(existingDeclarations);
+ }
+ else {
+ return [getCodeActionForNewImport()];
+ }
+ function getCodeActionsForExistingImport(declarations) {
+ var actions = [];
+ var namespaceImportDeclaration;
+ var namedImportDeclaration;
+ var existingModuleSpecifier;
+ for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
+ var declaration = declarations_11[_i];
+ if (declaration.kind === 235) {
+ var namedBindings = declaration.importClause && declaration.importClause.namedBindings;
+ if (namedBindings && namedBindings.kind === 237) {
+ namespaceImportDeclaration = declaration;
+ }
+ else {
+ namedImportDeclaration = declaration;
+ }
+ existingModuleSpecifier = declaration.moduleSpecifier.getText();
+ }
+ else {
+ namespaceImportDeclaration = declaration;
+ existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration);
+ }
+ }
+ if (namespaceImportDeclaration) {
+ actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration));
+ }
+ if (namedImportDeclaration && namedImportDeclaration.importClause &&
+ (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) {
+ var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText());
+ actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes));
+ }
+ else {
+ actions.push(getCodeActionForNewImport(existingModuleSpecifier));
+ }
+ return actions;
+ function getModuleSpecifierFromImportEqualsDeclaration(declaration) {
+ if (declaration.moduleReference && declaration.moduleReference.kind === 245) {
+ return declaration.moduleReference.expression.getText();
+ }
+ return declaration.moduleReference.getText();
+ }
+ function getTextChangeForImportClause(importClause) {
+ var newImportText = isDefault ? "default as " + name : name;
+ var importList = importClause.namedBindings;
+ if (!importList && importClause.name) {
+ var start = importClause.name.getEnd();
+ return {
+ newText: ", { " + newImportText + " }",
+ span: { start: start, length: 0 }
+ };
+ }
+ if (importList.elements.length === 0) {
+ var start = importList.getStart();
+ return {
+ newText: "{ " + newImportText + " }",
+ span: { start: start, length: importList.getEnd() - start }
+ };
+ }
+ var insertPoint = importList.elements[importList.elements.length - 1].getEnd();
+ var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart());
+ var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd());
+ var oneImportPerLine = endLine - startLine > importList.elements.length;
+ return {
+ newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText,
+ span: { start: insertPoint, length: 0 }
+ };
+ }
+ function getCodeActionForNamespaceImport(declaration) {
+ var namespacePrefix;
+ if (declaration.kind === 235) {
+ namespacePrefix = declaration.importClause.namedBindings.name.getText();
+ }
+ else {
+ namespacePrefix = declaration.name.getText();
+ }
+ namespacePrefix = ts.stripQuotes(namespacePrefix);
+ return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange");
+ }
+ }
+ function getCodeActionForNewImport(moduleSpecifier) {
+ if (!cachedNewImportInsertPosition) {
+ var lastModuleSpecifierEnd = -1;
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var moduleSpecifier_1 = _a[_i];
+ var end = moduleSpecifier_1.getEnd();
+ if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) {
+ lastModuleSpecifierEnd = end;
+ }
+ }
+ cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart();
+ }
+ var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport());
+ var importStatementText = isDefault
+ ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\""
+ : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\"";
+ var newText = cachedNewImportInsertPosition === sourceFile.getStart()
+ ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter
+ : "" + context.newLineCharacter + importStatementText + ";";
+ return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes);
+ function getModuleSpecifierForNewImport() {
+ var fileName = sourceFile.path;
+ var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path;
+ var sourceDirectory = ts.getDirectoryPath(fileName);
+ var options = context.program.getCompilerOptions();
+ return tryGetModuleNameFromAmbientModule() ||
+ tryGetModuleNameFromBaseUrl() ||
+ tryGetModuleNameFromRootDirs() ||
+ tryGetModuleNameFromTypeRoots() ||
+ tryGetModuleNameAsNodeModule() ||
+ ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));
+ function tryGetModuleNameFromAmbientModule() {
+ if (moduleSymbol.valueDeclaration.kind !== 261) {
+ return moduleSymbol.name;
+ }
+ }
+ function tryGetModuleNameFromBaseUrl() {
+ if (!options.baseUrl) {
+ return undefined;
+ }
+ var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName);
+ var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl);
+ if (!relativeName) {
+ return undefined;
+ }
+ relativeName = removeExtensionAndIndexPostFix(relativeName);
+ if (options.paths) {
+ for (var key in options.paths) {
+ for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {
+ var pattern = _a[_i];
+ var indexOfStar = pattern.indexOf("*");
+ if (indexOfStar === 0 && pattern.length === 1) {
+ continue;
+ }
+ else if (indexOfStar !== -1) {
+ var prefix = pattern.substr(0, indexOfStar);
+ var suffix = pattern.substr(indexOfStar + 1);
+ if (relativeName.length >= prefix.length + suffix.length &&
+ ts.startsWith(relativeName, prefix) &&
+ ts.endsWith(relativeName, suffix)) {
+ var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
+ return key.replace("\*", matchedStar);
+ }
+ }
+ else if (pattern === relativeName) {
+ return key;
+ }
+ }
+ }
+ }
+ return relativeName;
+ }
+ function tryGetModuleNameFromRootDirs() {
+ if (options.rootDirs) {
+ var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); });
+ var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs);
+ var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs);
+ if (normalizedTargetPath !== undefined) {
+ var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath;
+ return ts.removeFileExtension(relativePath);
+ }
+ }
+ return undefined;
+ }
+ function tryGetModuleNameFromTypeRoots() {
+ var typeRoots = ts.getEffectiveTypeRoots(options, context.host);
+ if (typeRoots) {
+ var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, undefined, getCanonicalFileName); });
+ for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) {
+ var typeRoot = normalizedTypeRoots_1[_i];
+ if (ts.startsWith(moduleFileName, typeRoot)) {
+ var relativeFileName = moduleFileName.substring(typeRoot.length + 1);
+ return removeExtensionAndIndexPostFix(relativeFileName);
+ }
+ }
+ }
+ }
+ function tryGetModuleNameAsNodeModule() {
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
+ return undefined;
+ }
+ var indexOfNodeModules = moduleFileName.indexOf("node_modules");
+ if (indexOfNodeModules < 0) {
+ return undefined;
+ }
+ var relativeFileName;
+ if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) {
+ relativeFileName = moduleFileName.substring(indexOfNodeModules + 13);
+ }
+ else {
+ relativeFileName = getRelativePath(moduleFileName, sourceDirectory);
+ }
+ relativeFileName = ts.removeFileExtension(relativeFileName);
+ if (ts.endsWith(relativeFileName, "/index")) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ else {
+ try {
+ var moduleDirectory = ts.getDirectoryPath(moduleFileName);
+ var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json")));
+ if (packageJsonContent) {
+ var mainFile = packageJsonContent.main || packageJsonContent.typings;
+ if (mainFile) {
+ var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName);
+ if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ }
+ }
+ }
+ catch (e) { }
+ }
+ return relativeFileName;
+ }
+ }
+ function getPathRelativeToRootDirs(path, rootDirs) {
+ for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) {
+ var rootDir = rootDirs_2[_i];
+ var relativeName = tryRemoveParentDirectoryName(path, rootDir);
+ if (relativeName !== undefined) {
+ return relativeName;
+ }
+ }
+ return undefined;
+ }
+ function removeExtensionAndIndexPostFix(fileName) {
+ fileName = ts.removeFileExtension(fileName);
+ if (ts.endsWith(fileName, "/index")) {
+ fileName = fileName.substr(0, fileName.length - 6);
+ }
+ return fileName;
+ }
+ function getRelativePath(path, directoryPath) {
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
+ return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath;
+ }
+ function tryRemoveParentDirectoryName(path, parentDirectory) {
+ var index = path.indexOf(parentDirectory);
+ if (index === 0) {
+ return ts.endsWith(parentDirectory, ts.directorySeparator)
+ ? path.substring(parentDirectory.length)
+ : path.substring(parentDirectory.length + 1);
+ }
+ return undefined;
+ }
+ }
+ }
+ function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) {
+ return {
+ description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)),
+ changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }],
+ kind: kind,
+ moduleSpecifier: moduleSpecifier
+ };
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ codefix.registerCodeFix({
+ errorCodes: [
+ ts.Diagnostics._0_is_declared_but_never_used.code,
+ ts.Diagnostics.Property_0_is_declared_but_never_used.code
+ ],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var start = context.span.start;
+ var token = ts.getTokenAtPosition(sourceFile, start);
+ if (token.kind === 20) {
+ token = ts.getTokenAtPosition(sourceFile, start + 1);
+ }
+ switch (token.kind) {
+ case 70:
+ switch (token.parent.kind) {
+ case 223:
+ switch (token.parent.parent.parent.kind) {
+ case 211:
+ var forStatement = token.parent.parent.parent;
+ var forInitializer = forStatement.initializer;
+ if (forInitializer.declarations.length === 1) {
+ return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
+ }
+ else {
+ return removeSingleItem(forInitializer.declarations, token);
+ }
+ case 213:
+ var forOfStatement = token.parent.parent.parent;
+ if (forOfStatement.initializer.kind === 224) {
+ var forOfInitializer = forOfStatement.initializer;
+ return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
+ }
+ break;
+ case 212:
+ return undefined;
+ case 256:
+ var catchClause = token.parent.parent;
+ var parameter = catchClause.variableDeclaration.getChildren()[0];
+ return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
+ default:
+ var variableStatement = token.parent.parent.parent;
+ if (variableStatement.declarationList.declarations.length === 1) {
+ return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
+ }
+ else {
+ var declarations = variableStatement.declarationList.declarations;
+ return removeSingleItem(declarations, token);
+ }
+ }
+ case 143:
+ var typeParameters = token.parent.parent.typeParameters;
+ if (typeParameters.length === 1) {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
+ }
+ else {
+ return removeSingleItem(typeParameters, token);
+ }
+ case 144:
+ var functionDeclaration = token.parent.parent;
+ if (functionDeclaration.parameters.length === 1) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else {
+ return removeSingleItem(functionDeclaration.parameters, token);
+ }
+ case 234:
+ var importEquals = findImportDeclaration(token);
+ return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
+ case 239:
+ var namedImports = token.parent.parent;
+ if (namedImports.elements.length === 1) {
+ var importSpec = findImportDeclaration(token);
+ return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
+ }
+ else {
+ return removeSingleItem(namedImports.elements, token);
+ }
+ case 236:
+ var importClause = token.parent;
+ if (!importClause.namedBindings) {
+ var importDecl = findImportDeclaration(importClause);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
+ }
+ case 237:
+ var namespaceImport = token.parent;
+ if (namespaceImport.name == token && !namespaceImport.parent.name) {
+ var importDecl = findImportDeclaration(namespaceImport);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ var start_4 = namespaceImport.parent.name.end;
+ return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4);
+ }
+ }
+ break;
+ case 147:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ case 237:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ if (ts.isDeclarationName(token)) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else if (ts.isLiteralComputedPropertyDeclarationName(token)) {
+ return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
+ }
+ else {
+ return undefined;
+ }
+ function findImportDeclaration(token) {
+ var importDecl = token;
+ while (importDecl.kind != 235 && importDecl.parent) {
+ importDecl = importDecl.parent;
+ }
+ return importDecl;
+ }
+ function createCodeFix(newText, start, length) {
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers),
+ changes: [{
+ fileName: sourceFile.fileName,
+ textChanges: [{ newText: newText, span: { start: start, length: length } }]
+ }]
+ }];
+ }
+ function removeSingleItem(elements, token) {
+ if (elements[0] === token.parent) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
+ }
+ else {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
+ }
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
ts.servicesVersion = "0.5";
function createNode(kind, pos, end, parent) {
var node = kind >= 141 ? new NodeObject(kind, pos, end) :
@@ -62067,11 +63214,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(291, nodes.pos, nodes.end, this);
+ var list = createNode(292, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
- var node = nodes_5[_i];
+ for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
+ var node = nodes_7[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -62090,7 +63237,7 @@ var ts;
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 290;
+ var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -62108,8 +63255,8 @@ var ts;
children.push(_this.createSyntaxList(nodes));
pos_3 = nodes.end;
};
- if (this.jsDocComments) {
- for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
+ if (this.jsDoc) {
+ for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
processNode(jsDocComment);
}
@@ -62329,6 +63476,19 @@ var ts;
SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
return ts.getPositionOfLineAndCharacter(this, line, character);
};
+ SourceFileObject.prototype.getLineEndOfPosition = function (pos) {
+ var line = this.getLineAndCharacterOfPosition(pos).line;
+ var lineStarts = this.getLineStarts();
+ var lastCharPos;
+ if (line + 1 >= lineStarts.length) {
+ lastCharPos = this.getEnd();
+ }
+ if (!lastCharPos) {
+ lastCharPos = lineStarts[line + 1] - 1;
+ }
+ var fullText = this.getFullText();
+ return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos;
+ };
SourceFileObject.prototype.getNamedDeclarations = function () {
if (!this.namedDeclarations) {
this.namedDeclarations = this.computeNamedDeclarations();
@@ -62350,9 +63510,9 @@ var ts;
}
function getDeclarationName(declaration) {
if (declaration.name) {
- var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
- if (result_6 !== undefined) {
- return result_6;
+ var result_7 = getTextOfIdentifierOrLiteral(declaration.name);
+ if (result_7 !== undefined) {
+ return result_7;
}
if (declaration.name.kind === 142) {
var expr = declaration.name.expression;
@@ -63179,7 +64339,9 @@ var ts;
sourceFile: sourceFile,
span: span,
program: program,
- newLineCharacter: newLineChar
+ newLineCharacter: newLineChar,
+ host: host,
+ cancellationToken: cancellationToken
};
var fixes = ts.codefix.getFixes(context);
if (fixes) {
@@ -63344,10 +64506,10 @@ var ts;
break;
default:
ts.forEachChild(node, walk);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- ts.forEachChild(jsDocComment, walk);
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ ts.forEachChild(jsDoc, walk);
}
}
}
@@ -63544,7 +64706,7 @@ var ts;
this.trace = function (s) { return host.trace(s); };
}
this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) {
- var globalCache = _this.project.getTypingOptions().enableAutoDiscovery
+ var globalCache = _this.project.getTypeAcquisition().enable
? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation
: undefined;
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host);
@@ -63576,15 +64738,15 @@ var ts;
var compilerOptions = this.getCompilationSettings();
var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName;
for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
- var name_48 = names_2[_i];
- var resolution = newResolutions[name_48];
+ var name_49 = names_2[_i];
+ var resolution = newResolutions[name_49];
if (!resolution) {
- var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_48];
+ var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_49];
if (moduleResolutionIsValid(existingResolution)) {
resolution = existingResolution;
}
else {
- newResolutions[name_48] = resolution = loader(name_48, containingFile, compilerOptions, this);
+ newResolutions[name_49] = resolution = loader(name_49, containingFile, compilerOptions, this);
}
if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
this.filesWithChangedSetOfUnresolvedImports.push(path);
@@ -63746,8 +64908,8 @@ var ts;
}
return unique === 0;
}
- function typingOptionsChanged(opt1, opt2) {
- return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery ||
+ function typeAcquisitionChanged(opt1, opt2) {
+ return opt1.enable !== opt2.enable ||
!setIsEqualTo(opt1.include, opt2.include) ||
!setIsEqualTo(opt1.exclude, opt2.exclude);
}
@@ -63766,32 +64928,32 @@ var ts;
this.perProjectCache = ts.createMap();
}
TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) {
- var typingOptions = project.getTypingOptions();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ var typeAcquisition = project.getTypeAcquisition();
+ if (!typeAcquisition || !typeAcquisition.enable) {
return server.emptyArray;
}
var entry = this.perProjectCache[project.getProjectName()];
var result = entry ? entry.typings : server.emptyArray;
if (forceRefresh ||
!entry ||
- typingOptionsChanged(typingOptions, entry.typingOptions) ||
+ typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) ||
compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) ||
unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {
this.perProjectCache[project.getProjectName()] = {
compilerOptions: project.getCompilerOptions(),
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
typings: result,
unresolvedImports: unresolvedImports,
poisoned: true
};
- this.installer.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports);
+ this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
}
return result;
};
- TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typingOptions, unresolvedImports, newTypings) {
+ TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
this.perProjectCache[projectName] = {
compilerOptions: compilerOptions,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
typings: server.toSortedReadonlyArray(newTypings),
unresolvedImports: unresolvedImports,
poisoned: false
@@ -64289,7 +65451,8 @@ var ts;
}
server.createNoSemanticFeaturesWrapper = createNoSemanticFeaturesWrapper;
var Project = (function () {
- function Project(projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) {
+ this.projectName = projectName;
this.projectKind = projectKind;
this.projectService = projectService;
this.documentRegistry = documentRegistry;
@@ -64372,6 +65535,9 @@ var ts;
this.languageServiceEnabled = false;
this.projectService.onUpdateLanguageServiceStateForProject(this, false);
};
+ Project.prototype.getProjectName = function () {
+ return this.projectName;
+ };
Project.prototype.getSourceFile = function (path) {
if (!this.program) {
return undefined;
@@ -64529,9 +65695,9 @@ var ts;
}
var unresolvedImports;
if (file.resolvedModules) {
- for (var name_49 in file.resolvedModules) {
- if (!file.resolvedModules[name_49] && !ts.isExternalModuleNameRelative(name_49)) {
- var trimmed = name_49.trim();
+ for (var name_50 in file.resolvedModules) {
+ if (!file.resolvedModules[name_50] && !ts.isExternalModuleNameRelative(name_50)) {
+ var trimmed = name_50.trim();
var i = trimmed.indexOf("/");
if (i !== -1 && trimmed.charCodeAt(0) === 64) {
i = trimmed.indexOf("/", i + 1);
@@ -64753,15 +65919,10 @@ var ts;
var InferredProject = (function (_super) {
__extends(InferredProject, _super);
function InferredProject(projectService, documentRegistry, compilerOptions) {
- var _this = _super.call(this, ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this;
+ var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this;
_this.directoriesWatchedForTsconfig = [];
- _this.inferredProjectName = server.makeInferredProjectName(InferredProject.NextId);
- InferredProject.NextId++;
return _this;
}
- InferredProject.prototype.getProjectName = function () {
- return this.inferredProjectName;
- };
InferredProject.prototype.getProjectRootPath = function () {
if (this.projectService.useSingleInferredProject) {
return undefined;
@@ -64776,45 +65937,52 @@ var ts;
this.projectService.stopWatchingDirectory(directory);
}
};
- InferredProject.prototype.getTypingOptions = function () {
+ InferredProject.prototype.getTypeAcquisition = function () {
return {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ enable: allRootFilesAreJsOrDts(this),
include: [],
exclude: []
};
};
return InferredProject;
}(Project));
- InferredProject.NextId = 1;
+ InferredProject.newName = (function () {
+ var nextId = 1;
+ return function () {
+ var id = nextId;
+ nextId++;
+ return server.makeInferredProjectName(id);
+ };
+ })();
server.InferredProject = InferredProject;
var ConfiguredProject = (function (_super) {
__extends(ConfiguredProject, _super);
function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) {
- var _this = _super.call(this, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.configFileName = configFileName;
+ var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
_this.wildcardDirectories = wildcardDirectories;
_this.compileOnSaveEnabled = compileOnSaveEnabled;
_this.openRefCount = 0;
+ _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName));
return _this;
}
+ ConfiguredProject.prototype.getConfigFilePath = function () {
+ return this.getProjectName();
+ };
ConfiguredProject.prototype.getProjectRootPath = function () {
- return ts.getDirectoryPath(this.configFileName);
+ return ts.getDirectoryPath(this.getConfigFilePath());
};
ConfiguredProject.prototype.setProjectErrors = function (projectErrors) {
this.projectErrors = projectErrors;
};
- ConfiguredProject.prototype.setTypingOptions = function (newTypingOptions) {
- this.typingOptions = newTypingOptions;
- };
- ConfiguredProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
+ ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {
+ this.typeAcquisition = newTypeAcquisition;
};
- ConfiguredProject.prototype.getProjectName = function () {
- return this.configFileName;
+ ConfiguredProject.prototype.getTypeAcquisition = function () {
+ return this.typeAcquisition;
};
ConfiguredProject.prototype.watchConfigFile = function (callback) {
var _this = this;
- this.projectFileWatcher = this.projectService.host.watchFile(this.configFileName, function (_) { return callback(_this); });
+ this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); });
};
ConfiguredProject.prototype.watchTypeRoots = function (callback) {
var _this = this;
@@ -64832,7 +66000,7 @@ var ts;
if (this.directoryWatcher) {
return;
}
- var directoryToWatch = ts.getDirectoryPath(this.configFileName);
+ var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath());
this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch);
this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true);
};
@@ -64841,7 +66009,7 @@ var ts;
if (!this.wildcardDirectories) {
return;
}
- var configDirectoryPath = ts.getDirectoryPath(this.configFileName);
+ var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath());
this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) {
if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) {
var recursive = (flag & 1) !== 0;
@@ -64891,8 +66059,7 @@ var ts;
var ExternalProject = (function (_super) {
__extends(ExternalProject, _super);
function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) {
- var _this = _super.call(this, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
- _this.externalProjectName = externalProjectName;
+ var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this;
_this.compileOnSaveEnabled = compileOnSaveEnabled;
_this.projectFilePath = projectFilePath;
return _this;
@@ -64901,37 +66068,34 @@ var ts;
if (this.projectFilePath) {
return ts.getDirectoryPath(this.projectFilePath);
}
- return ts.getDirectoryPath(ts.normalizeSlashes(this.externalProjectName));
+ return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName()));
};
- ExternalProject.prototype.getTypingOptions = function () {
- return this.typingOptions;
+ ExternalProject.prototype.getTypeAcquisition = function () {
+ return this.typeAcquisition;
};
ExternalProject.prototype.setProjectErrors = function (projectErrors) {
this.projectErrors = projectErrors;
};
- ExternalProject.prototype.setTypingOptions = function (newTypingOptions) {
- if (!newTypingOptions) {
- newTypingOptions = {
- enableAutoDiscovery: allRootFilesAreJsOrDts(this),
+ ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) {
+ if (!newTypeAcquisition) {
+ newTypeAcquisition = {
+ enable: allRootFilesAreJsOrDts(this),
include: [],
exclude: []
};
}
else {
- if (newTypingOptions.enableAutoDiscovery === undefined) {
- newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this);
+ if (newTypeAcquisition.enable === undefined) {
+ newTypeAcquisition.enable = allRootFilesAreJsOrDts(this);
}
- if (!newTypingOptions.include) {
- newTypingOptions.include = [];
+ if (!newTypeAcquisition.include) {
+ newTypeAcquisition.include = [];
}
- if (!newTypingOptions.exclude) {
- newTypingOptions.exclude = [];
+ if (!newTypeAcquisition.exclude) {
+ newTypeAcquisition.exclude = [];
}
}
- this.typingOptions = newTypingOptions;
- };
- ExternalProject.prototype.getProjectName = function () {
- return this.externalProjectName;
+ this.typeAcquisition = newTypeAcquisition;
};
return ExternalProject;
}(Project));
@@ -65123,7 +66287,7 @@ var ts;
}
switch (response.kind) {
case server.ActionSet:
- this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.unresolvedImports, response.typings);
+ this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings);
break;
case server.ActionInvalidate:
this.typingsCache.deleteTypingsForProject(response.projectName);
@@ -65252,7 +66416,7 @@ var ts;
ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) {
var _this = this;
this.logger.info("Type root file " + fileName + " changed");
- this.throttledOperations.schedule(project.configFileName + " * type root", 250, function () {
+ this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () {
project.updateTypes();
_this.updateConfiguredProject(project);
_this.refreshInferredProjects();
@@ -65264,11 +66428,11 @@ var ts;
return;
}
this.logger.info("Detected source file changes: " + fileName);
- this.throttledOperations.schedule(project.configFileName, 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });
+ this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); });
};
ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) {
var _this = this;
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile);
var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));
var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));
@@ -65279,8 +66443,10 @@ var ts;
}
};
ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) {
- this.logger.info("Config file changed: " + project.configFileName);
- this.updateConfiguredProject(project);
+ var configFileName = project.getConfigFilePath();
+ this.logger.info("Config file changed: " + configFileName);
+ var configFileErrors = this.updateConfiguredProject(project);
+ this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName);
this.refreshInferredProjects();
};
ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) {
@@ -65466,7 +66632,13 @@ var ts;
}
};
ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) {
- return findProjectByName(configFileName, this.configuredProjects);
+ configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName));
+ for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) {
+ var proj = _a[_i];
+ if (proj.canonicalConfigFilePath === configFileName) {
+ return proj;
+ }
+ }
};
ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) {
return findProjectByName(projectFileName, this.externalProjects);
@@ -65496,7 +66668,7 @@ var ts;
compilerOptions: parsedCommandLine.options,
configHasFilesProperty: config["files"] !== undefined,
wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories),
- typingOptions: parsedCommandLine.typingOptions,
+ typeAcquisition: parsedCommandLine.typeAcquisition,
compileOnSave: parsedCommandLine.compileOnSave
};
return { success: true, projectOptions: projectOptions, configFileErrors: errors };
@@ -65519,10 +66691,10 @@ var ts;
}
return false;
};
- ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
+ ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) {
var compilerOptions = convertCompilerOptions(options);
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
+ this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined);
this.externalProjects.push(project);
return project;
};
@@ -65539,7 +66711,7 @@ var ts;
var _this = this;
var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader);
var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
- this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typingOptions, configFileErrors);
+ this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); });
if (!sizeLimitExceeded) {
this.watchConfigDirectoryForProject(project, projectOptions);
@@ -65555,7 +66727,7 @@ var ts;
project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); });
}
};
- ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typingOptions, configFileErrors) {
+ ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) {
var errors;
for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
var f = files_4[_i];
@@ -65571,7 +66743,7 @@ var ts;
}
}
project.setProjectErrors(ts.concatenate(configFileErrors, errors));
- project.setTypingOptions(typingOptions);
+ project.setTypeAcquisition(typeAcquisition);
project.updateGraph();
};
ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) {
@@ -65586,7 +66758,7 @@ var ts;
errors: project.getProjectErrors()
};
};
- ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypingOptions, compileOnSave, configFileErrors) {
+ ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) {
var oldRootScriptInfos = project.getRootScriptInfos();
var newRootScriptInfos = [];
var newRootScriptInfoMap = server.createNormalizedPathMap();
@@ -65648,7 +66820,7 @@ var ts;
}
}
project.setCompilerOptions(newOptions);
- project.setTypingOptions(newTypingOptions);
+ project.setTypeAcquisition(newTypeAcquisition);
if (compileOnSave !== undefined) {
project.compileOnSaveEnabled = compileOnSave;
}
@@ -65656,12 +66828,12 @@ var ts;
project.updateGraph();
};
ProjectService.prototype.updateConfiguredProject = function (project) {
- if (!this.host.fileExists(project.configFileName)) {
+ if (!this.host.fileExists(project.getConfigFilePath())) {
this.logger.info("Config file deleted");
this.removeProject(project);
return;
}
- var _a = this.convertConfigFileContentToProjectOptions(project.configFileName), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
+ var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors;
if (!success) {
this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors);
return configFileErrors;
@@ -65669,7 +66841,7 @@ var ts;
if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) {
project.setCompilerOptions(projectOptions.compilerOptions);
if (!project.languageServiceEnabled) {
- return;
+ return configFileErrors;
}
project.disableLanguageService();
project.stopWatchingDirectory();
@@ -65679,8 +66851,9 @@ var ts;
project.enableLanguageService();
}
this.watchConfigDirectoryForProject(project, projectOptions);
- this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors);
+ this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors);
}
+ return configFileErrors;
};
ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) {
var _this = this;
@@ -65910,6 +67083,10 @@ var ts;
}
};
ProjectService.prototype.openExternalProject = function (proj) {
+ if (proj.typingOptions && !proj.typeAcquisition) {
+ var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions);
+ proj.typeAcquisition = typeAcquisition;
+ }
var tsConfigFiles;
var rootFiles = [];
for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) {
@@ -65931,7 +67108,7 @@ var ts;
var exisingConfigFiles;
if (externalProject) {
if (!tsConfigFiles) {
- this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined);
+ this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, undefined);
return;
}
this.closeExternalProject(proj.projectFileName, true);
@@ -65981,7 +67158,7 @@ var ts;
}
else {
delete this.externalProjectToConfiguredProjectMap[proj.projectFileName];
- this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions);
+ this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition);
}
this.refreshInferredProjects();
};
@@ -67059,9 +68236,9 @@ var ts;
if (simplifiedResult) {
return completions.entries.reduce(function (result, entry) {
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
- var name_50 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
+ var name_51 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined;
- result.push({ name: name_50, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
+ result.push({ name: name_51, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
}
return result;
}, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });
@@ -68902,7 +70079,7 @@ var ts;
if (result.error) {
return {
options: {},
- typingOptions: {},
+ typeAcquisition: {},
files: [],
raw: {},
errors: [realizeDiagnostic(result.error, "\r\n")]
@@ -68912,7 +70089,7 @@ var ts;
var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName);
return {
options: configFile.options,
- typingOptions: configFile.typingOptions,
+ typeAcquisition: configFile.typeAcquisition,
files: configFile.fileNames,
raw: configFile.raw,
errors: realizeDiagnostics(configFile.errors, "\r\n")
@@ -68927,7 +70104,7 @@ var ts;
var getCanonicalFileName = ts.createGetCanonicalFileName(false);
return this.forwardJSONCall("discoverTypings()", function () {
var info = JSON.parse(discoverTypingsJson);
- return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports);
+ return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);
});
};
return CoreServicesShimObject;
diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts
index d25ce84b7..cec498e41 100644
--- a/node_modules/typescript/lib/typescript.d.ts
+++ b/node_modules/typescript/lib/typescript.d.ts
@@ -317,23 +317,25 @@ declare namespace ts {
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
- JSDocParameterTag = 280,
- JSDocReturnTag = 281,
- JSDocTypeTag = 282,
- JSDocTemplateTag = 283,
- JSDocTypedefTag = 284,
- JSDocPropertyTag = 285,
- JSDocTypeLiteral = 286,
- JSDocLiteralType = 287,
- JSDocNullKeyword = 288,
- JSDocUndefinedKeyword = 289,
- JSDocNeverKeyword = 290,
- SyntaxList = 291,
- NotEmittedStatement = 292,
- PartiallyEmittedExpression = 293,
- MergeDeclarationMarker = 294,
- EndOfDeclarationMarker = 295,
- Count = 296,
+ JSDocAugmentsTag = 280,
+ JSDocParameterTag = 281,
+ JSDocReturnTag = 282,
+ JSDocTypeTag = 283,
+ JSDocTemplateTag = 284,
+ JSDocTypedefTag = 285,
+ JSDocPropertyTag = 286,
+ JSDocTypeLiteral = 287,
+ JSDocLiteralType = 288,
+ JSDocNullKeyword = 289,
+ JSDocUndefinedKeyword = 290,
+ JSDocNeverKeyword = 291,
+ SyntaxList = 292,
+ NotEmittedStatement = 293,
+ PartiallyEmittedExpression = 294,
+ MergeDeclarationMarker = 295,
+ EndOfDeclarationMarker = 296,
+ RawExpression = 297,
+ Count = 298,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -360,9 +362,9 @@ declare namespace ts {
LastBinaryOperator = 69,
FirstNode = 141,
FirstJSDocNode = 262,
- LastJSDocNode = 287,
+ LastJSDocNode = 288,
FirstJSDocTagNode = 278,
- LastJSDocTagNode = 290,
+ LastJSDocTagNode = 291,
}
enum NodeFlags {
None = 0,
@@ -464,14 +466,14 @@ declare namespace ts {
right: Identifier;
}
type EntityName = Identifier | QualifiedName;
- type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
- type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
+ type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
+ type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
interface Declaration extends Node {
_declarationBrand: any;
name?: DeclarationName;
}
interface DeclarationStatement extends Declaration, Statement {
- name?: Identifier | LiteralExpression;
+ name?: Identifier | StringLiteral | NumericLiteral;
}
interface ComputedPropertyName extends Node {
kind: SyntaxKind.ComputedPropertyName;
@@ -573,18 +575,16 @@ declare namespace ts {
interface PropertyLikeDeclaration extends Declaration {
name: PropertyName;
}
- interface BindingPattern extends Node {
- elements: NodeArray<BindingElement | ArrayBindingElement>;
- }
- interface ObjectBindingPattern extends BindingPattern {
+ interface ObjectBindingPattern extends Node {
kind: SyntaxKind.ObjectBindingPattern;
elements: NodeArray<BindingElement>;
}
- type ArrayBindingElement = BindingElement | OmittedExpression;
- interface ArrayBindingPattern extends BindingPattern {
+ interface ArrayBindingPattern extends Node {
kind: SyntaxKind.ArrayBindingPattern;
elements: NodeArray<ArrayBindingElement>;
}
+ type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
+ type ArrayBindingElement = BindingElement | OmittedExpression;
/**
* Several node kinds share function-like features such as a signature,
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
@@ -809,17 +809,25 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
- interface AssignmentExpression extends BinaryExpression {
+ type AssignmentOperatorToken = Token<AssignmentOperator>;
+ interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
left: LeftHandSideExpression;
- operatorToken: Token<SyntaxKind.EqualsToken>;
+ operatorToken: TOperator;
}
- interface ObjectDestructuringAssignment extends AssignmentExpression {
+ interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ObjectLiteralExpression;
}
- interface ArrayDestructuringAssignment extends AssignmentExpression {
+ interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ArrayLiteralExpression;
}
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
+ type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
+ type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
+ type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
+ type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
+ type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
+ type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
+ type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -1180,7 +1188,7 @@ declare namespace ts {
type ModuleName = Identifier | StringLiteral;
interface ModuleDeclaration extends DeclarationStatement {
kind: SyntaxKind.ModuleDeclaration;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral;
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
}
interface NamespaceDeclaration extends ModuleDeclaration {
@@ -1332,7 +1340,7 @@ declare namespace ts {
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
kind: SyntaxKind.JSDocRecordMember;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral | NumericLiteral;
type?: JSDocType;
}
interface JSDoc extends Node {
@@ -1348,6 +1356,10 @@ declare namespace ts {
interface JSDocUnknownTag extends JSDocTag {
kind: SyntaxKind.JSDocTag;
}
+ interface JSDocAugmentsTag extends JSDocTag {
+ kind: SyntaxKind.JSDocAugmentsTag;
+ typeExpression: JSDocTypeExpression;
+ }
interface JSDocTemplateTag extends JSDocTag {
kind: SyntaxKind.JSDocTemplateTag;
typeParameters: NodeArray<TypeParameterDeclaration>;
@@ -1596,6 +1608,7 @@ declare namespace ts {
getJsxIntrinsicTagNames(): Symbol[];
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
+ tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
}
interface SymbolDisplayBuilder {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@@ -1761,7 +1774,7 @@ declare namespace ts {
Literal = 480,
StringOrNumberLiteral = 96,
PossiblyFalsy = 7406,
- StringLike = 34,
+ StringLike = 262178,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
@@ -1845,7 +1858,7 @@ declare namespace ts {
}
interface IndexedAccessType extends Type {
objectType: Type;
- indexType: TypeParameter;
+ indexType: Type;
}
enum SignatureKind {
Call = 0,
@@ -1962,12 +1975,13 @@ declare namespace ts {
target?: ScriptTarget;
traceResolution?: boolean;
types?: string[];
- /** Paths used to used to compute primary types search locations */
+ /** Paths used to compute primary types search locations */
typeRoots?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
- interface TypingOptions {
+ interface TypeAcquisition {
enableAutoDiscovery?: boolean;
+ enable?: boolean;
include?: string[];
exclude?: string[];
[option: string]: string[] | boolean | undefined;
@@ -1977,7 +1991,7 @@ declare namespace ts {
projectRootPath: string;
safeListPath: string;
packageNameToTypingLocation: Map<string>;
- typingOptions: TypingOptions;
+ typeAcquisition: TypeAcquisition;
compilerOptions: CompilerOptions;
unresolvedImports: ReadonlyArray<string>;
}
@@ -2025,7 +2039,7 @@ declare namespace ts {
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
- typingOptions?: TypingOptions;
+ typeAcquisition?: TypeAcquisition;
fileNames: string[];
raw?: any;
errors: Diagnostic[];
@@ -2130,6 +2144,10 @@ declare namespace ts {
}
}
declare namespace ts {
+ /** The version of the TypeScript compiler release */
+ const version = "2.2.0-dev.20161127";
+}
+declare namespace ts {
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
type DirectoryWatcherCallback = (fileName: string) => void;
interface WatchedFile {
@@ -2260,9 +2278,19 @@ declare namespace ts {
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
- function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
+ function isParameterPropertyDeclaration(node: Node): boolean;
function getCombinedModifierFlags(node: Node): ModifierFlags;
function getCombinedNodeFlags(node: Node): NodeFlags;
+ /**
+ * Checks to see if the locale is in the appropriate format,
+ * and if it is, attempts to set the appropriate language.
+ */
+ function validateLocaleAndSetLanguage(locale: string, sys: {
+ getExecutingFilePath(): string;
+ resolvePath(path: string): string;
+ fileExists(fileName: string): boolean;
+ readFile(fileName: string): string;
+ }, errors?: Diagnostic[]): void;
}
declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
@@ -2273,6 +2301,7 @@ declare namespace ts {
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
declare namespace ts {
+ function moduleHasNonRelativeName(moduleName: string): boolean;
function getEffectiveTypeRoots(options: CompilerOptions, host: {
directoryExists?: (directoryName: string) => boolean;
getCurrentDirectory?: () => string;
@@ -2297,8 +2326,6 @@ declare namespace ts {
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
}
declare namespace ts {
- /** The version of the TypeScript compiler release */
- const version = "2.2.0-dev.20161115";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
@@ -2343,8 +2370,8 @@ declare namespace ts {
options: CompilerOptions;
errors: Diagnostic[];
};
- function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
- options: TypingOptions;
+ function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
+ options: TypeAcquisition;
errors: Diagnostic[];
};
}
@@ -2393,6 +2420,7 @@ declare namespace ts {
}
interface SourceFile {
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
+ getLineEndOfPosition(pos: number): number;
getLineStarts(): number[];
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
diff --git a/node_modules/typescript/lib/typescript.js b/node_modules/typescript/lib/typescript.js
index 4964aa75f..d4ad545cf 100644
--- a/node_modules/typescript/lib/typescript.js
+++ b/node_modules/typescript/lib/typescript.js
@@ -333,26 +333,28 @@ var ts;
SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType";
SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment";
SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 280] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 281] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 282] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 283] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 284] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 285] = "JSDocPropertyTag";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 286] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocLiteralType"] = 287] = "JSDocLiteralType";
- SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 288] = "JSDocNullKeyword";
- SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 289] = "JSDocUndefinedKeyword";
- SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 290] = "JSDocNeverKeyword";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType";
+ SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword";
+ SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword";
+ SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 291] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 292] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 293] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 294] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 295] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 296] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 298] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment";
@@ -380,9 +382,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 287] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode";
SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 290] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -710,7 +712,7 @@ var ts;
TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic";
/* @internal */
TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive";
- TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike";
+ TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike";
TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike";
TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike";
TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike";
@@ -974,98 +976,95 @@ var ts;
// - Flags used to indicate that a node or subtree contains syntax that requires transformation.
TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript";
TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
- TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx";
- TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx";
- TransformFlags[TransformFlags["ESNext"] = 16] = "ESNext";
- TransformFlags[TransformFlags["ContainsESNext"] = 32] = "ContainsESNext";
- TransformFlags[TransformFlags["ES2017"] = 64] = "ES2017";
- TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017";
- TransformFlags[TransformFlags["ES2016"] = 256] = "ES2016";
- TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016";
- TransformFlags[TransformFlags["ES2015"] = 1024] = "ES2015";
- TransformFlags[TransformFlags["ContainsES2015"] = 2048] = "ContainsES2015";
- TransformFlags[TransformFlags["Generator"] = 4096] = "Generator";
- TransformFlags[TransformFlags["ContainsGenerator"] = 8192] = "ContainsGenerator";
- TransformFlags[TransformFlags["DestructuringAssignment"] = 16384] = "DestructuringAssignment";
- TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 32768] = "ContainsDestructuringAssignment";
+ TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx";
+ TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext";
+ TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017";
+ TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016";
+ TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015";
+ TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015";
+ TransformFlags[TransformFlags["Generator"] = 256] = "Generator";
+ TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator";
+ TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
+ TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment";
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
- TransformFlags[TransformFlags["ContainsDecorators"] = 65536] = "ContainsDecorators";
- TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 131072] = "ContainsPropertyInitializer";
- TransformFlags[TransformFlags["ContainsLexicalThis"] = 262144] = "ContainsLexicalThis";
- TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 524288] = "ContainsCapturedLexicalThis";
- TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 1048576] = "ContainsLexicalThisInComputedPropertyName";
- TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 2097152] = "ContainsDefaultValueAssignments";
- TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 4194304] = "ContainsParameterPropertyAssignments";
- TransformFlags[TransformFlags["ContainsSpreadExpression"] = 8388608] = "ContainsSpreadExpression";
- TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 16777216] = "ContainsComputedPropertyName";
- TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 33554432] = "ContainsBlockScopedBinding";
- TransformFlags[TransformFlags["ContainsBindingPattern"] = 67108864] = "ContainsBindingPattern";
- TransformFlags[TransformFlags["ContainsYield"] = 134217728] = "ContainsYield";
- TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 268435456] = "ContainsHoistedDeclarationOrCompletion";
+ TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators";
+ TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer";
+ TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis";
+ TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis";
+ TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments";
+ TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments";
+ TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread";
+ TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread";
+ TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest";
+ TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest";
+ TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding";
+ TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern";
+ TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield";
+ TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion";
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
// Assertions
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
- TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx";
- TransformFlags[TransformFlags["AssertESNext"] = 48] = "AssertESNext";
- TransformFlags[TransformFlags["AssertES2017"] = 192] = "AssertES2017";
- TransformFlags[TransformFlags["AssertES2016"] = 768] = "AssertES2016";
- TransformFlags[TransformFlags["AssertES2015"] = 3072] = "AssertES2015";
- TransformFlags[TransformFlags["AssertGenerator"] = 12288] = "AssertGenerator";
- TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 49152] = "AssertDestructuringAssignment";
+ TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx";
+ TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext";
+ TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017";
+ TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016";
+ TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015";
+ TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator";
+ TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment";
// Scope Exclusions
// - Bitmasks that exclude flags from propagating out of a specific context
// into the subtree flags of their container.
- TransformFlags[TransformFlags["NodeExcludes"] = 536892757] = "NodeExcludes";
- TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 979719509] = "ArrowFunctionExcludes";
- TransformFlags[TransformFlags["FunctionExcludes"] = 980243797] = "FunctionExcludes";
- TransformFlags[TransformFlags["ConstructorExcludes"] = 975983957] = "ConstructorExcludes";
- TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 975983957] = "MethodOrAccessorExcludes";
- TransformFlags[TransformFlags["ClassExcludes"] = 559895893] = "ClassExcludes";
- TransformFlags[TransformFlags["ModuleExcludes"] = 839734613] = "ModuleExcludes";
+ TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes";
+ TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes";
+ TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes";
+ TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes";
+ TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes";
+ TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes";
+ TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes";
TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes";
- TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 554784085] = "ObjectLiteralExcludes";
- TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 545281365] = "ArrayLiteralOrCallOrNewExcludes";
- TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 604001621] = "VariableDeclarationListExcludes";
- TransformFlags[TransformFlags["ParameterExcludes"] = 604001621] = "ParameterExcludes";
+ TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes";
+ TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes";
+ TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes";
+ TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes";
+ TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes";
+ TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes";
// Masks
// - Additional bitmasks
- TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 4390912] = "TypeScriptClassSyntaxMask";
- TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 2621440] = "ES2015FunctionSyntaxMask";
+ TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask";
+ TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask";
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
/* @internal */
var EmitFlags;
(function (EmitFlags) {
- EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers";
- EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar";
- EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper";
- EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper";
- EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine";
- EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine";
- EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode";
- EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution";
- EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis";
- EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap";
- EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap";
- EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap";
- EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps";
- EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps";
- EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps";
- EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps";
- EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments";
- EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments";
- EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments";
- EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments";
- EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName";
- EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName";
- EmitFlags[EmitFlags["Indented"] = 524288] = "Indented";
- EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation";
- EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody";
- EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope";
- EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue";
- EmitFlags[EmitFlags["NoHoisting"] = 16777216] = "NoHoisting";
- EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 33554432] = "HasEndOfDeclarationMarker";
+ EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine";
+ EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode";
+ EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution";
+ EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis";
+ EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap";
+ EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap";
+ EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap";
+ EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps";
+ EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps";
+ EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments";
+ EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments";
+ EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments";
+ EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments";
+ EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName";
+ EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName";
+ EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName";
+ EmitFlags[EmitFlags["Indented"] = 32768] = "Indented";
+ EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation";
+ EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody";
+ EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope";
+ EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue";
+ EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting";
+ EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker";
})(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {}));
/* @internal */
var EmitContext;
@@ -1172,9 +1171,13 @@ var ts;
})(ts || (ts = {}));
/// <reference path="types.ts"/>
/// <reference path="performance.ts" />
-/* @internal */
var ts;
(function (ts) {
+ /** The version of the TypeScript compiler release */
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+/* @internal */
+(function (ts) {
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
@@ -1727,7 +1730,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -1750,6 +1753,17 @@ var ts;
return to;
}
ts.addRange = addRange;
+ /**
+ * Stable sort of an array. Elements equal to each other maintain their relative position in the array.
+ */
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; }) // create array of indices
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) // sort indices by value then position
+ .map(function (i) { return array[i]; }); // get sorted array
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -1968,6 +1982,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -2483,6 +2506,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
/* @internal */
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
@@ -3140,6 +3171,17 @@ var ts;
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
/** Remove an item from an array, moving everything to its right one space left. */
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
+ /** Remove an item by index from an array, moving everything to its right one space left. */
function orderedRemoveItemAt(array, index) {
// This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`.
for (var i = index; i < array.length - 1; i++) {
@@ -4244,7 +4286,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -4309,7 +4351,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -4380,6 +4423,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -4594,9 +4638,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -4608,6 +4652,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
/// <reference path="core.ts"/>
@@ -6552,7 +6599,7 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
// With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
// want to skip trivia because this will launch us forward to the next token.
if (nodeIsMissing(node)) {
@@ -6561,25 +6608,25 @@ var ts;
if (isJSDocNode(node)) {
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
}
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
+ if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
+ return getTokenPosOfNode(node.jsDoc[0]);
}
// For a syntax list, it is possible that one of its children has JSDocComment nodes, while
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 291 /* SyntaxList */ && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 287 /* LastJSDocNode */;
+ return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 290 /* LastJSDocTagNode */;
+ return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -6778,7 +6825,7 @@ var ts;
case 8 /* NumericLiteral */:
return name.text;
case 142 /* ComputedPropertyName */:
- if (isStringOrNumericLiteral(name.expression.kind)) {
+ if (isStringOrNumericLiteral(name.expression)) {
return name.expression.text;
}
}
@@ -6907,7 +6954,8 @@ var ts;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 207 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */;
+ return node.kind === 207 /* ExpressionStatement */
+ && node.expression.kind === 9 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -6918,26 +6966,21 @@ var ts;
return ts.getLeadingCommentRanges(text, node.pos);
}
ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
- }
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
+ function getJSDocCommentRanges(node, text) {
var commentRanges = (node.kind === 144 /* Parameter */ ||
node.kind === 143 /* TypeParameter */ ||
node.kind === 184 /* FunctionExpression */ ||
node.kind === 185 /* ArrowFunction */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
- // True if the comment starts with '/**' but not if it is '/**/'
+ // True if the comment starts with '/**' but not if it is '/**/'
+ return ts.filter(commentRanges, function (comment) {
return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ &&
text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ &&
text.charCodeAt(comment.pos + 3) !== 47 /* slash */;
- }
+ });
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.getJSDocCommentRanges = getJSDocCommentRanges;
ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
@@ -7520,6 +7563,7 @@ var ts;
case 145 /* Decorator */:
case 252 /* JsxExpression */:
case 251 /* JsxSpreadAttribute */:
+ case 259 /* SpreadAssignment */:
return true;
case 199 /* ExpressionWithTypeArguments */:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
@@ -7690,127 +7734,98 @@ var ts;
node.parameters[0].type.kind === 276 /* JSDocConstructorType */;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ function getCommentsFromJSDoc(node) {
+ return ts.map(getJSDocs(node), function (doc) { return doc.comment; });
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
- }
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
- }
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ ts.getCommentsFromJSDoc = getCommentsFromJSDoc;
+ function getJSDocTags(node, kind) {
+ var docs = getJSDocs(node);
+ if (docs) {
var result = [];
for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
+ if (doc.kind === 281 /* JSDocParameterTag */) {
+ if (doc.kind === kind) {
+ result.push(doc);
+ }
+ }
+ else {
+ result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));
}
}
return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- // TODO: Get rid of getJsDocComments and friends (note the lowercase 's' in Js)
- // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now...
- var result = undefined;
- // prepend documentation from parent sources
- if (checkParentVariableStatement) {
+ }
+ }
+ function getFirstJSDocTag(node, kind) {
+ return node && ts.firstOrUndefined(getJSDocTags(node, kind));
+ }
+ function getJSDocs(node) {
+ var cache = node.jsDocCache;
+ if (!cache) {
+ getJSDocsWorker(node);
+ node.jsDocCache = cache;
+ }
+ return cache;
+ function getJSDocsWorker(node) {
+ var parent = node.parent;
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
// /**
// * @param {number} name
// * @returns {number}
// */
// var x = function(name) { return name.length; }
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 205 /* VariableStatement */;
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&
+ parent.initializer === node &&
+ parent.parent.parent.kind === 205 /* VariableStatement */;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 205 /* VariableStatement */;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ parent.parent.kind === 205 /* VariableStatement */;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? parent.parent :
undefined;
if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 230 /* ModuleDeclaration */ &&
- node.parent && node.parent.kind === 230 /* ModuleDeclaration */) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(variableStatementNode);
}
// Also recognize when the node is the RHS of an assignment expression
- var parent_4 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 192 /* BinaryExpression */ &&
- parent_4.operatorToken.kind === 57 /* EqualsToken */ &&
- parent_4.parent.kind === 207 /* ExpressionStatement */;
+ var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&
+ parent.kind === 192 /* BinaryExpression */ &&
+ parent.operatorToken.kind === 57 /* EqualsToken */ &&
+ parent.parent.kind === 207 /* ExpressionStatement */;
if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(parent.parent);
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257 /* PropertyAssignment */;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
+ var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ &&
+ parent && parent.kind === 230 /* ModuleDeclaration */;
+ var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */;
+ if (isModuleDeclaration || isPropertyAssignmentExpression) {
+ getJSDocsWorker(parent);
}
// Pull parameter comments from declaring function as well
if (node.kind === 144 /* Parameter */) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
+ cache = ts.concatenate(cache, getJSDocParameterTags(node));
}
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
- }
- else {
- return getDocs(node.jsDocComments);
+ if (isVariableLike(node) && node.initializer) {
+ cache = ts.concatenate(cache, node.initializer.jsDoc);
}
+ cache = ts.concatenate(cache, node.jsDoc);
}
- return result;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
+ function getJSDocParameterTags(param) {
+ if (!isParameter(param)) {
+ return undefined;
+ }
var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
+ var tags = getJSDocTags(func, 281 /* JSDocParameterTag */);
if (!param.name) {
// this is an anonymous jsdoc param from a `function(type1, type2): type3` specification
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70 /* Identifier */) {
var name_6 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
- if (paramTags) {
- return paramTags;
- }
+ return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
}
else {
// TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines
@@ -7818,40 +7833,30 @@ var ts;
return undefined;
}
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 282 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false);
+ ts.getJSDocParameterTags = getJSDocParameterTags;
+ function getJSDocType(node) {
+ var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */);
+ if (!tag && node.kind === 144 /* Parameter */) {
+ var paramTags = getJSDocParameterTags(node);
+ if (paramTags) {
+ tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });
+ }
+ }
+ return tag && tag.typeExpression && tag.typeExpression.type;
+ }
+ ts.getJSDocType = getJSDocType;
+ function getJSDocAugmentsTag(node) {
+ return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */);
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
+ ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 281 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true);
+ return getFirstJSDocTag(node, 282 /* JSDocReturnTag */);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 283 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false);
+ return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 70 /* Identifier */) {
- // If it's a parameter, see if the parent has a jsdoc comment with an @param
- // annotation.
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, /*checkParentVariableStatement*/ true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 280 /* JSDocParameterTag */) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
- }
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
function hasRestParameter(s) {
return isRestParameter(ts.lastOrUndefined(s.parameters));
}
@@ -7862,13 +7867,10 @@ var ts;
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
if (node && (node.flags & 2097152 /* JavaScriptFile */)) {
- if (node.type && node.type.kind === 275 /* JSDocVariadicType */) {
+ if (node.type && node.type.kind === 275 /* JSDocVariadicType */ ||
+ ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) {
return true;
}
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 275 /* JSDocVariadicType */;
- }
}
return isDeclaredRestParam(node);
}
@@ -8115,8 +8117,10 @@ var ts;
return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node);
}
ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */;
+ function isStringOrNumericLiteral(node) {
+ var kind = node.kind;
+ return kind === 9 /* StringLiteral */
+ || kind === 8 /* NumericLiteral */;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
/**
@@ -8132,7 +8136,7 @@ var ts;
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
return name.kind === 142 /* ComputedPropertyName */ &&
- !isStringOrNumericLiteral(name.expression.kind) &&
+ !isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
@@ -8356,6 +8360,7 @@ var ts;
case 194 /* TemplateExpression */:
case 183 /* ParenthesizedExpression */:
case 198 /* OmittedExpression */:
+ case 297 /* RawExpression */:
return 19;
case 181 /* TaggedTemplateExpression */:
case 177 /* PropertyAccessExpression */:
@@ -9226,19 +9231,19 @@ var ts;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isAssignmentExpression(node) {
+ function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node)
- && isAssignmentOperator(node.operatorToken.kind)
+ && (excludeCompoundAssignment
+ ? node.operatorToken.kind === 57 /* EqualsToken */
+ : isAssignmentOperator(node.operatorToken.kind))
&& isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 57 /* EqualsToken */) {
- var kind = node.left.kind;
- return kind === 176 /* ObjectLiteralExpression */
- || kind === 175 /* ArrayLiteralExpression */;
- }
+ if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
+ var kind = node.left.kind;
+ return kind === 176 /* ObjectLiteralExpression */
+ || kind === 175 /* ArrayLiteralExpression */;
}
return false;
}
@@ -9632,135 +9637,6 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportedBindings = ts.createMap();
- var uniqueExports = ts.createMap();
- var hasExportDefault = false;
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 235 /* ImportDeclaration */:
- // import "mod"
- // import x from "mod"
- // import * as x from "mod"
- // import { x, y } from "mod"
- externalImports.push(node);
- break;
- case 234 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {
- // import x = require("mod")
- externalImports.push(node);
- }
- break;
- case 241 /* ExportDeclaration */:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- // export * from "mod"
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- else {
- // export { x, y } from "mod"
- externalImports.push(node);
- }
- }
- else {
- // export { x, y }
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- if (!uniqueExports[specifier.name.text]) {
- var name_8 = specifier.propertyName || specifier.name;
- ts.multiMapAdd(exportSpecifiers, name_8.text, specifier);
- var decl = resolver.getReferencedImportDeclaration(name_8)
- || resolver.getReferencedValueDeclaration(name_8);
- if (decl) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
- }
- uniqueExports[specifier.name.text] = specifier.name;
- }
- }
- }
- break;
- case 240 /* ExportAssignment */:
- if (node.isExportEquals && !exportEquals) {
- // export = x
- exportEquals = node;
- }
- break;
- case 205 /* VariableStatement */:
- if (hasModifier(node, 1 /* Export */)) {
- for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
- var decl = _e[_d];
- collectExportedVariableInfo(decl, uniqueExports);
- }
- }
- break;
- case 225 /* FunctionDeclaration */:
- if (hasModifier(node, 1 /* Export */)) {
- if (hasModifier(node, 512 /* Default */)) {
- // export default function() { }
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- // export function x() { }
- var name_9 = node.name;
- if (!uniqueExports[name_9.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9);
- uniqueExports[name_9.text] = name_9;
- }
- }
- }
- break;
- case 226 /* ClassDeclaration */:
- if (hasModifier(node, 1 /* Export */)) {
- if (hasModifier(node, 512 /* Default */)) {
- // export default class { }
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- // export class x { }
- var name_10 = node.name;
- if (!uniqueExports[name_10.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10);
- uniqueExports[name_10.text] = name_10;
- }
- }
- }
- break;
- }
- }
- var exportedNames;
- for (var key in uniqueExports) {
- exportedNames = ts.append(exportedNames, uniqueExports[key]);
- }
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
- }
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function collectExportedVariableInfo(decl, uniqueExports) {
- if (isBindingPattern(decl.name)) {
- for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!isOmittedExpression(element)) {
- collectExportedVariableInfo(element, uniqueExports);
- }
- }
- }
- else if (!isGeneratedIdentifier(decl.name)) {
- if (!uniqueExports[decl.name.text]) {
- uniqueExports[decl.name.text] = decl.name;
- }
- }
- }
/**
* Determines whether a name was originally the declaration name of an enum or namespace
* declaration.
@@ -9964,6 +9840,14 @@ var ts;
}
ts.isTypeNode = isTypeNode;
// Binding patterns
+ function isArrayBindingPattern(node) {
+ return node.kind === 173 /* ArrayBindingPattern */;
+ }
+ ts.isArrayBindingPattern = isArrayBindingPattern;
+ function isObjectBindingPattern(node) {
+ return node.kind === 172 /* ObjectBindingPattern */;
+ }
+ ts.isObjectBindingPattern = isObjectBindingPattern;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
@@ -9973,6 +9857,12 @@ var ts;
return false;
}
ts.isBindingPattern = isBindingPattern;
+ function isAssignmentPattern(node) {
+ var kind = node.kind;
+ return kind === 175 /* ArrayLiteralExpression */
+ || kind === 176 /* ObjectLiteralExpression */;
+ }
+ ts.isAssignmentPattern = isAssignmentPattern;
function isBindingElement(node) {
return node.kind === 174 /* BindingElement */;
}
@@ -9983,6 +9873,51 @@ var ts;
|| kind === 198 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
+ /**
+ * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration
+ */
+ function isDeclarationBindingElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 223 /* VariableDeclaration */:
+ case 144 /* Parameter */:
+ case 174 /* BindingElement */:
+ return true;
+ }
+ return false;
+ }
+ ts.isDeclarationBindingElement = isDeclarationBindingElement;
+ /**
+ * Determines whether a node is a BindingOrAssignmentPattern
+ */
+ function isBindingOrAssignmentPattern(node) {
+ return isObjectBindingOrAssignmentPattern(node)
+ || isArrayBindingOrAssignmentPattern(node);
+ }
+ ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
+ /**
+ * Determines whether a node is an ObjectBindingOrAssignmentPattern
+ */
+ function isObjectBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 172 /* ObjectBindingPattern */:
+ case 176 /* ObjectLiteralExpression */:
+ return true;
+ }
+ return false;
+ }
+ ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
+ /**
+ * Determines whether a node is an ArrayBindingOrAssignmentPattern
+ */
+ function isArrayBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ return true;
+ }
+ return false;
+ }
+ ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
// Expression
function isArrayLiteralExpression(node) {
return node.kind === 175 /* ArrayLiteralExpression */;
@@ -10050,7 +9985,8 @@ var ts;
|| kind === 98 /* ThisKeyword */
|| kind === 100 /* TrueKeyword */
|| kind === 96 /* SuperKeyword */
- || kind === 201 /* NonNullExpression */;
+ || kind === 201 /* NonNullExpression */
+ || kind === 297 /* RawExpression */;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
@@ -10078,6 +10014,7 @@ var ts;
|| kind === 196 /* SpreadElement */
|| kind === 200 /* AsExpression */
|| kind === 198 /* OmittedExpression */
+ || kind === 297 /* RawExpression */
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -10091,11 +10028,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 293 /* PartiallyEmittedExpression */;
+ return node.kind === 294 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 292 /* NotEmittedStatement */;
+ return node.kind === 293 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -10209,7 +10146,7 @@ var ts;
|| kind === 228 /* TypeAliasDeclaration */
|| kind === 143 /* TypeParameter */
|| kind === 223 /* VariableDeclaration */
- || kind === 284 /* JSDocTypedefTag */;
+ || kind === 285 /* JSDocTypedefTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 225 /* FunctionDeclaration */
@@ -10244,9 +10181,9 @@ var ts;
|| kind === 205 /* VariableStatement */
|| kind === 210 /* WhileStatement */
|| kind === 217 /* WithStatement */
- || kind === 292 /* NotEmittedStatement */
- || kind === 295 /* EndOfDeclarationMarker */
- || kind === 294 /* MergeDeclarationMarker */;
+ || kind === 293 /* NotEmittedStatement */
+ || kind === 296 /* EndOfDeclarationMarker */
+ || kind === 295 /* MergeDeclarationMarker */;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -10641,6 +10578,60 @@ var ts;
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
+ /**
+ * Checks to see if the locale is in the appropriate format,
+ * and if it is, attempts to set the appropriate language.
+ */
+ function validateLocaleAndSetLanguage(locale, sys, errors) {
+ var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
+ if (!matchResult) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
+ }
+ return;
+ }
+ var language = matchResult[1];
+ var territory = matchResult[3];
+ // First try the entire locale, then fall back to just language if that's all we have.
+ // Either ways do not fail, and fallback to the English diagnostic strings.
+ if (!trySetLanguageAndTerritory(language, territory, errors)) {
+ trySetLanguageAndTerritory(language, /*territory*/ undefined, errors);
+ }
+ function trySetLanguageAndTerritory(language, territory, errors) {
+ var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
+ var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
+ var filePath = ts.combinePaths(containingDirectoryPath, language);
+ if (territory) {
+ filePath = filePath + "-" + territory;
+ }
+ filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
+ if (!sys.fileExists(filePath)) {
+ return false;
+ }
+ // TODO: Add codePage support for readFile?
+ var fileContents = "";
+ try {
+ fileContents = sys.readFile(filePath);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
+ }
+ return false;
+ }
+ try {
+ ts.localizedDiagnosticMessages = JSON.parse(fileContents);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
})(ts || (ts = {}));
/// <reference path="core.ts"/>
/// <reference path="utilities.ts"/>
@@ -10858,9 +10849,9 @@ var ts;
return node;
}
ts.createParameter = createParameter;
- function updateParameter(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
+ function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
}
return node;
}
@@ -10995,9 +10986,9 @@ var ts;
return node;
}
ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);
}
return node;
}
@@ -11038,7 +11029,7 @@ var ts;
function createPropertyAccess(expression, name, location, flags) {
var node = createNode(177 /* PropertyAccessExpression */, location, flags);
node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576 /* NoIndentation */;
+ (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */;
node.name = typeof name === "string" ? createIdentifier(name) : name;
return node;
}
@@ -11260,13 +11251,23 @@ var ts;
return node;
}
ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(193 /* ConditionalExpression */, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
+ function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {
+ var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation);
+ node.condition = parenthesizeForConditionalHead(condition);
+ if (whenFalse) {
+ // second overload
+ node.questionToken = questionTokenOrWhenTrue;
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ node.colonToken = colonTokenOrLocation;
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);
+ }
+ else {
+ // first overload
+ node.questionToken = createToken(54 /* QuestionToken */);
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);
+ node.colonToken = createToken(55 /* ColonToken */);
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ }
return node;
}
ts.createConditional = createConditional;
@@ -12082,8 +12083,6 @@ var ts;
updated.imports = node.imports;
if (node.moduleAugmentations !== undefined)
updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
return updateNode(updated, node);
}
return node;
@@ -12097,7 +12096,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createNode(292 /* NotEmittedStatement */, /*location*/ original);
+ var node = createNode(293 /* NotEmittedStatement */, /*location*/ original);
node.original = original;
return node;
}
@@ -12107,7 +12106,7 @@ var ts;
* order to properly emit exports.
*/
function createEndOfDeclarationMarker(original) {
- var node = createNode(295 /* EndOfDeclarationMarker */);
+ var node = createNode(296 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -12118,7 +12117,7 @@ var ts;
* order to properly emit exports.
*/
function createMergeDeclarationMarker(original) {
- var node = createNode(294 /* MergeDeclarationMarker */);
+ var node = createNode(295 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -12133,7 +12132,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(293 /* PartiallyEmittedExpression */, /*location*/ location || original);
+ var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original);
node.expression = expression;
node.original = original;
return node;
@@ -12146,6 +12145,19 @@ var ts;
return node;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ /**
+ * Creates a node that emits a string of raw text in an expression position. Raw text is never
+ * transformed, should be ES3 compliant, and should have the same precedence as
+ * PrimaryExpression.
+ *
+ * @param text The raw text of the node.
+ */
+ function createRawExpression(text) {
+ var node = createNode(297 /* RawExpression */);
+ node.text = text;
+ return node;
+ }
+ ts.createRawExpression = createRawExpression;
// Compound nodes
function createComma(left, right) {
return createBinary(left, 25 /* CommaToken */, right);
@@ -12195,13 +12207,19 @@ var ts;
return createVoid(createLiteral(0));
}
ts.createVoidZero = createVoidZero;
+ function createTypeCheck(value, tag) {
+ return tag === "undefined"
+ ? createStrictEquality(value, createVoidZero())
+ : createStrictEquality(createTypeOf(value), createLiteral(tag));
+ }
+ ts.createTypeCheck = createTypeCheck;
function createMemberAccessForPropertyName(target, memberName, location) {
if (ts.isComputedPropertyName(memberName)) {
return createElementAccess(target, memberName.expression, location);
}
else {
var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048 /* NoNestedSourceMaps */;
+ (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */;
return expression;
}
}
@@ -12245,14 +12263,17 @@ var ts;
// flag and setting a parent node.
var react = createIdentifier(reactNamespace || "React");
react.flags &= ~8 /* Synthesized */;
- // Set the parent that is in parse tree
+ // Set the parent that is in parse tree
// this makes sure that parent chain is intact for checker to traverse complete scope tree
react.parent = ts.getParseTreeNode(parent);
return react;
}
function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
if (ts.isQualifiedName(jsxFactory)) {
- return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536 /* NoSourceMap */));
+ var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);
+ var right = createSynthesizedNode(70 /* Identifier */);
+ right.text = jsxFactory.right.text;
+ return createPropertyAccess(left, right);
}
else {
return createReactNamespace(jsxFactory.text, parent);
@@ -12308,170 +12329,10 @@ var ts;
}
ts.createConstDeclarationList = createConstDeclarationList;
// Helpers
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"),
- /*typeArguments*/ undefined, [
- name,
- createIdentifier("_super")
- ]);
- }
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"),
- /*typeArguments*/ undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"),
- /*typeArguments*/ undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"),
- /*typeArguments*/ undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
- }
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
- }
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(
- /*modifiers*/ undefined, createToken(38 /* AsteriskToken */),
- /*name*/ undefined,
- /*typeParameters*/ undefined,
- /*parameters*/ [],
- /*type*/ undefined, body);
- // Mark this node as originally an async function
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152 /* AsyncFunctionBody */;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"),
- /*typeArguments*/ undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
+ function getHelperName(name) {
+ return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"),
- /*typeArguments*/ undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"),
- /*typeArguments*/ undefined, [prototype]);
- }
- function createGeti(target) {
- // name => super[name]
- return createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- // (name, value) => super[name] = value
- return createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name"),
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "value")
- ],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- // const _super = (function (geti, seti) {
- // const cache = Object.create(null);
- // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
- // })(name => super[name], (name, value) => super[name] = value);
- // const cache = Object.create(null);
- var createCache = createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("cache",
- /*type*/ undefined, createObjectCreate(createNull()))
- ]));
- // get value() { return geti(name); }
- var getter = createGetAccessor(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, "value",
- /*parameters*/ [],
- /*type*/ undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"),
- /*typeArguments*/ undefined, [createIdentifier("name")]))
- ]));
- // set value(v) { seti(name, v); }
- var setter = createSetAccessor(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, "value", [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "v")], createBlock([
- createStatement(createCall(createIdentifier("seti"),
- /*typeArguments*/ undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- // return name => cache[name] || ...
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- // const _super = (function (geti, seti) {
- // const cache = Object.create(null);
- // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
- // })(name => super[name], (name, value) => super[name] = value);
- return createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("_super",
- /*type*/ undefined, createCall(createParen(createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "geti"),
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "seti")
- ],
- /*type*/ undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))),
- /*typeArguments*/ undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("_super",
- /*type*/ undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ ts.getHelperName = getHelperName;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
@@ -12657,14 +12518,14 @@ var ts;
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
*/
function getLocalName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 262144 /* LocalName */);
+ return getName(node, allowComments, allowSourceMaps, 16384 /* LocalName */);
}
ts.getLocalName = getLocalName;
/**
* Gets whether an identifier should only be referred to by its local name.
*/
function isLocalName(node) {
- return (getEmitFlags(node) & 262144 /* LocalName */) !== 0;
+ return (getEmitFlags(node) & 16384 /* LocalName */) !== 0;
}
ts.isLocalName = isLocalName;
/**
@@ -12678,7 +12539,7 @@ var ts;
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
*/
function getExportName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 131072 /* ExportName */);
+ return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */);
}
ts.getExportName = getExportName;
/**
@@ -12686,7 +12547,7 @@ var ts;
* name points to an exported symbol.
*/
function isExportName(node) {
- return (getEmitFlags(node) & 131072 /* ExportName */) !== 0;
+ return (getEmitFlags(node) & 8192 /* ExportName */) !== 0;
}
ts.isExportName = isExportName;
/**
@@ -12702,15 +12563,15 @@ var ts;
ts.getDeclarationName = getDeclarationName;
function getName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
- var name_11 = getMutableClone(node.name);
+ var name_8 = getMutableClone(node.name);
emitFlags |= getEmitFlags(node.name);
if (!allowSourceMaps)
- emitFlags |= 1536 /* NoSourceMap */;
+ emitFlags |= 48 /* NoSourceMap */;
if (!allowComments)
- emitFlags |= 49152 /* NoComments */;
+ emitFlags |= 1536 /* NoComments */;
if (emitFlags)
- setEmitFlags(name_11, emitFlags);
- return name_11;
+ setEmitFlags(name_8, emitFlags);
+ return name_8;
}
return getGeneratedNameForNode(node);
}
@@ -12744,15 +12605,18 @@ var ts;
var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name);
var emitFlags;
if (!allowSourceMaps)
- emitFlags |= 1536 /* NoSourceMap */;
+ emitFlags |= 48 /* NoSourceMap */;
if (!allowComments)
- emitFlags |= 49152 /* NoComments */;
+ emitFlags |= 1536 /* NoComments */;
if (emitFlags)
setEmitFlags(qualifiedName, emitFlags);
return qualifiedName;
}
ts.getNamespaceMemberName = getNamespaceMemberName;
- // Utilities
+ function convertToFunctionBody(node, multiLine) {
+ return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine);
+ }
+ ts.convertToFunctionBody = convertToFunctionBody;
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
@@ -12790,7 +12654,7 @@ var ts;
}
while (statementOffset < numStatements) {
var statement = source[statementOffset];
- if (getEmitFlags(statement) & 8388608 /* CustomPrologue */) {
+ if (getEmitFlags(statement) & 524288 /* CustomPrologue */) {
target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
}
else {
@@ -12801,15 +12665,22 @@ var ts;
return statementOffset;
}
ts.addPrologueDirectives = addPrologueDirectives;
+ function startsWithUseStrict(statements) {
+ var firstStatement = ts.firstOrUndefined(statements);
+ return firstStatement !== undefined
+ && ts.isPrologueDirective(firstStatement)
+ && isUseStrictPrologue(firstStatement);
+ }
+ ts.startsWithUseStrict = startsWithUseStrict;
/**
* Ensures "use strict" directive is added
*
- * @param node source file
+ * @param statements An array of statements
*/
- function ensureUseStrict(node) {
+ function ensureUseStrict(statements) {
var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
if (ts.isPrologueDirective(statement)) {
if (isUseStrictPrologue(statement)) {
foundUseStrict = true;
@@ -12821,12 +12692,11 @@ var ts;
}
}
if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- // add "use strict" as the first statement
- return updateSourceFileNode(node, statements.concat(node.statements));
+ return createNodeArray([
+ startOnNewLine(createStatement(createLiteral("use strict")))
+ ].concat(statements), statements);
}
- return node;
+ return statements;
}
ts.ensureUseStrict = ensureUseStrict;
/**
@@ -12987,6 +12857,24 @@ var ts;
}
return 0 /* Unknown */;
}
+ function parenthesizeForConditionalHead(condition) {
+ var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */);
+ var emittedCondition = skipPartiallyEmittedExpressions(condition);
+ var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
+ if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
+ return createParen(condition);
+ }
+ return condition;
+ }
+ ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;
+ function parenthesizeSubexpressionOfConditionalExpression(e) {
+ // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions
+ // so in case when comma expression is introduced as a part of previous transformations
+ // if should be wrapped in parens since comma operator has the lowest precedence
+ return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */
+ ? createParen(e)
+ : e;
+ }
/**
* Wraps an expression in parentheses if it is needed in order to use the expression
* as the expression of a NewExpression node.
@@ -13118,7 +13006,7 @@ var ts;
case 177 /* PropertyAccessExpression */:
node = node.expression;
continue;
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -13173,7 +13061,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 293 /* PartiallyEmittedExpression */) {
+ while (node.kind === 294 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -13195,8 +13083,8 @@ var ts;
}
ts.setOriginalNode = setOriginalNode;
function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;
+ if (!destEmitNode)
destEmitNode = {};
if (flags)
destEmitNode.flags = flags;
@@ -13206,6 +13094,10 @@ var ts;
destEmitNode.sourceMapRange = sourceMapRange;
if (tokenSourceMapRanges)
destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ if (constantValue !== undefined)
+ destEmitNode.constantValue = constantValue;
+ if (helpers)
+ destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);
return destEmitNode;
}
function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
@@ -13258,6 +13150,7 @@ var ts;
}
return node.emitNode;
}
+ ts.getOrCreateEmitNode = getOrCreateEmitNode;
/**
* Gets flags that control emit behavior of a node.
*
@@ -13280,6 +13173,16 @@ var ts;
}
ts.setEmitFlags = setEmitFlags;
/**
+ * Gets a custom text range to use when emitting source maps.
+ *
+ * @param node The node.
+ */
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
+ }
+ ts.getSourceMapRange = getSourceMapRange;
+ /**
* Sets a custom text range to use when emitting source maps.
*
* @param node The node.
@@ -13291,6 +13194,18 @@ var ts;
}
ts.setSourceMapRange = setSourceMapRange;
/**
+ * Gets the TextRange to use for source maps for a token of a node.
+ *
+ * @param node The node.
+ * @param token The token.
+ */
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ }
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ /**
* Sets the TextRange to use for source maps for a token of a node.
*
* @param node The node.
@@ -13305,14 +13220,6 @@ var ts;
}
ts.setTokenSourceMapRange = setTokenSourceMapRange;
/**
- * Sets a custom text range to use when emitting comments.
- */
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
- /**
* Gets a custom text range to use when emitting comments.
*
* @param node The node.
@@ -13323,27 +13230,13 @@ var ts;
}
ts.getCommentRange = getCommentRange;
/**
- * Gets a custom text range to use when emitting source maps.
- *
- * @param node The node.
- */
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- /**
- * Gets the TextRange to use for source maps for a token of a node.
- *
- * @param node The node.
- * @param token The token.
+ * Sets a custom text range to use when emitting comments.
*/
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
+ return node;
}
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ ts.setCommentRange = setCommentRange;
/**
* Gets the constant value to emit for an expression.
*/
@@ -13361,6 +13254,118 @@ var ts;
return node;
}
ts.setConstantValue = setConstantValue;
+ function getExternalHelpersModuleName(node) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return emitNode && emitNode.externalHelpersModuleName;
+ }
+ ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {
+ if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
+ var externalHelpersModuleName = getExternalHelpersModuleName(node);
+ if (externalHelpersModuleName) {
+ return externalHelpersModuleName;
+ }
+ var helpers = getEmitHelpers(node);
+ if (helpers) {
+ for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
+ var helper = helpers_1[_i];
+ if (!helper.scoped) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = getOrCreateEmitNode(parseNode);
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));
+ }
+ }
+ }
+ }
+ }
+ ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
+ /**
+ * Adds an EmitHelper to a node.
+ */
+ function addEmitHelper(node, helper) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ return node;
+ }
+ ts.addEmitHelper = addEmitHelper;
+ /**
+ * Adds an EmitHelper to a node.
+ */
+ function addEmitHelpers(node, helpers) {
+ if (ts.some(helpers)) {
+ var emitNode = getOrCreateEmitNode(node);
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!ts.contains(emitNode.helpers, helper)) {
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ }
+ }
+ }
+ return node;
+ }
+ ts.addEmitHelpers = addEmitHelpers;
+ /**
+ * Removes an EmitHelper from a node.
+ */
+ function removeEmitHelper(node, helper) {
+ var emitNode = node.emitNode;
+ if (emitNode) {
+ var helpers = emitNode.helpers;
+ if (helpers) {
+ return ts.orderedRemoveItem(helpers, helper);
+ }
+ }
+ return false;
+ }
+ ts.removeEmitHelper = removeEmitHelper;
+ /**
+ * Gets the EmitHelpers of a node.
+ */
+ function getEmitHelpers(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.helpers;
+ }
+ ts.getEmitHelpers = getEmitHelpers;
+ /**
+ * Moves matching emit helpers from a source node to a target node.
+ */
+ function moveEmitHelpers(source, target, predicate) {
+ var sourceEmitNode = source.emitNode;
+ var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
+ if (!ts.some(sourceEmitHelpers))
+ return;
+ var targetEmitNode = getOrCreateEmitNode(target);
+ var helpersRemoved = 0;
+ for (var i = 0; i < sourceEmitHelpers.length; i++) {
+ var helper = sourceEmitHelpers[i];
+ if (predicate(helper)) {
+ helpersRemoved++;
+ if (!ts.contains(targetEmitNode.helpers, helper)) {
+ targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);
+ }
+ }
+ else if (helpersRemoved > 0) {
+ sourceEmitHelpers[i - helpersRemoved] = helper;
+ }
+ }
+ if (helpersRemoved > 0) {
+ sourceEmitHelpers.length -= helpersRemoved;
+ }
+ }
+ ts.moveEmitHelpers = moveEmitHelpers;
+ function compareEmitHelpers(x, y) {
+ if (x === y)
+ return 0 /* EqualTo */;
+ if (x.priority === y.priority)
+ return 0 /* EqualTo */;
+ if (x.priority === undefined)
+ return 1 /* GreaterThan */;
+ if (y.priority === undefined)
+ return -1 /* LessThan */;
+ return ts.compareValues(x.priority, y.priority);
+ }
+ ts.compareEmitHelpers = compareEmitHelpers;
function setTextRange(node, location) {
if (location) {
node.pos = location.pos;
@@ -13390,8 +13395,8 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_12 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_9 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
if (node.kind === 235 /* ImportDeclaration */ && node.importClause) {
return getGeneratedNameForNode(node);
@@ -13454,362 +13459,390 @@ var ts;
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
/**
- * Transforms the body of a function-like node.
- *
- * @param node A function-like node.
+ * Gets the initializer of an BindingOrAssignmentElement.
*/
- function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
- var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
- var singleLine = false; // indicates whether the block *may* be emitted as a single line
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- context.startLexicalEnvironment();
- if (ts.isBlock(body)) {
- // ensureUseStrict is false because no new prologue-directive should be added.
- // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
- statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
- addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
- // If we added any generated statements, this must be a multi-line block.
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- // If the original body was a multi-line block, this must be a multi-line block.
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
- }
- else {
- ts.Debug.assert(node.kind === 185 /* ArrowFunction */);
- // To align with the old emitter, we use a synthetic end position on the location
- // for the statement list we synthesize when we down-level an arrow function with
- // an expression function body. This prevents both comments and source maps from
- // being emitted for the end position only.
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = createReturn(expression, /*location*/ body);
- setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */);
- statements.push(returnStatement);
- // To align with the source map emit for the old emitter, we set a custom
- // source map location for the close brace.
- closeBraceLocation = body;
+ function getInitializerOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ // `1` in `let { a = 1 } = ...`
+ // `1` in `let { a: b = 1 } = ...`
+ // `1` in `let { a: {b} = 1 } = ...`
+ // `1` in `let { a: [b] = 1 } = ...`
+ // `1` in `let [a = 1] = ...`
+ // `1` in `let [{a} = 1] = ...`
+ // `1` in `let [[a] = 1] = ...`
+ return bindingElement.initializer;
+ }
+ if (ts.isPropertyAssignment(bindingElement)) {
+ // `1` in `({ a: b = 1 } = ...)`
+ // `1` in `({ a: {b} = 1 } = ...)`
+ // `1` in `({ a: [b] = 1 } = ...)`
+ return ts.isAssignmentExpression(bindingElement.initializer, /*excludeCompoundAssignment*/ true)
+ ? bindingElement.initializer.right
+ : undefined;
}
- var lexicalEnvironment = context.endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- // If we added any final generated statements, this must be a multi-line block
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
+ if (ts.isShorthandPropertyAssignment(bindingElement)) {
+ // `1` in `({ a = 1 } = ...)`
+ return bindingElement.objectAssignmentInitializer;
}
- var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- setEmitFlags(block, 32 /* SingleLine */);
+ if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {
+ // `1` in `[a = 1] = ...`
+ // `1` in `[{a} = 1] = ...`
+ // `1` in `[[a] = 1] = ...`
+ return bindingElement.right;
}
- if (closeBraceLocation) {
- setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
+ if (ts.isSpreadExpression(bindingElement)) {
+ // Recovery consistent with existing emit.
+ return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
}
- setOriginalNode(block, node.body);
- return block;
}
- ts.transformFunctionBody = transformFunctionBody;
+ ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
/**
- * Adds a statement to capture the `this` of a function declaration if it is needed.
- *
- * @param statements The statements for the new function body.
- * @param node A node.
+ * Gets the name of an BindingOrAssignmentElement.
*/
- function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
- if (node.transformFlags & 524288 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) {
- captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
- }
- }
- ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
- function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList([
- createVariableDeclaration("_this",
- /*type*/ undefined, initializer)
- ]), originalStatement);
- setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */);
- setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
- }
- ts.captureThisForNode = captureThisForNode;
+ function getTargetOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ // `a` in `let { a } = ...`
+ // `a` in `let { a = 1 } = ...`
+ // `b` in `let { a: b } = ...`
+ // `b` in `let { a: b = 1 } = ...`
+ // `a` in `let { ...a } = ...`
+ // `{b}` in `let { a: {b} } = ...`
+ // `{b}` in `let { a: {b} = 1 } = ...`
+ // `[b]` in `let { a: [b] } = ...`
+ // `[b]` in `let { a: [b] = 1 } = ...`
+ // `a` in `let [a] = ...`
+ // `a` in `let [a = 1] = ...`
+ // `a` in `let [...a] = ...`
+ // `{a}` in `let [{a}] = ...`
+ // `{a}` in `let [{a} = 1] = ...`
+ // `[a]` in `let [[a]] = ...`
+ // `[a]` in `let [[a] = 1] = ...`
+ return bindingElement.name;
+ }
+ if (ts.isObjectLiteralElementLike(bindingElement)) {
+ switch (bindingElement.kind) {
+ case 257 /* PropertyAssignment */:
+ // `b` in `({ a: b } = ...)`
+ // `b` in `({ a: b = 1 } = ...)`
+ // `{b}` in `({ a: {b} } = ...)`
+ // `{b}` in `({ a: {b} = 1 } = ...)`
+ // `[b]` in `({ a: [b] } = ...)`
+ // `[b]` in `({ a: [b] = 1 } = ...)`
+ // `b.c` in `({ a: b.c } = ...)`
+ // `b.c` in `({ a: b.c = 1 } = ...)`
+ // `b[0]` in `({ a: b[0] } = ...)`
+ // `b[0]` in `({ a: b[0] = 1 } = ...)`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
+ case 258 /* ShorthandPropertyAssignment */:
+ // `a` in `({ a } = ...)`
+ // `a` in `({ a = 1 } = ...)`
+ return bindingElement.name;
+ case 259 /* SpreadAssignment */:
+ // `a` in `({ ...a } = ...)`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ // no target
+ return undefined;
+ }
+ if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {
+ // `a` in `[a = 1] = ...`
+ // `{a}` in `[{a} = 1] = ...`
+ // `[a]` in `[[a] = 1] = ...`
+ // `a.b` in `[a.b = 1] = ...`
+ // `a[0]` in `[a[0] = 1] = ...`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.left);
+ }
+ if (ts.isSpreadExpression(bindingElement)) {
+ // `a` in `[...a] = ...`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ // `a` in `[a] = ...`
+ // `{a}` in `[{a}] = ...`
+ // `[a]` in `[[a]] = ...`
+ // `a.b` in `[a.b] = ...`
+ // `a[0]` in `[a[0]] = ...`
+ return bindingElement;
+ }
+ ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
/**
- * Gets a value indicating whether we need to add default value assignments for a
- * function-like node.
- *
- * @param node A function-like node.
+ * Determines whether an BindingOrAssignmentElement is a rest element.
*/
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 2097152 /* ContainsDefaultValueAssignments */) !== 0;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 144 /* Parameter */:
+ case 174 /* BindingElement */:
+ // `...` in `let [...a] = ...`
+ return bindingElement.dotDotDotToken;
+ case 196 /* SpreadElement */:
+ case 259 /* SpreadAssignment */:
+ // `...` in `[...a] = ...`
+ return bindingElement;
+ }
+ return undefined;
}
+ ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
/**
- * Adds statements to the body of a function-like node if it contains parameters with
- * binding patterns or initializers.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
+ * Gets the property name of a BindingOrAssignmentElement
*/
- function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 174 /* BindingElement */:
+ // `a` in `let { a: b } = ...`
+ // `[a]` in `let { [a]: b } = ...`
+ // `"a"` in `let { "a": b } = ...`
+ // `1` in `let { 1: b } = ...`
+ if (bindingElement.propertyName) {
+ var propertyName = bindingElement.propertyName;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 257 /* PropertyAssignment */:
+ // `a` in `({ a: b } = ...)`
+ // `[a]` in `({ [a]: b } = ...)`
+ // `"a"` in `({ "a": b } = ...)`
+ // `1` in `({ 1: b } = ...)`
+ if (bindingElement.name) {
+ var propertyName = bindingElement.name;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 259 /* SpreadAssignment */:
+ // `a` in `({ ...a } = ...)`
+ return bindingElement.name;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- // A rest parameter cannot have a binding pattern or an initializer,
- // so let's just ignore it.
- if (dotDotDotToken) {
- continue;
- }
- if (ts.isBindingPattern(name_13)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest);
- }
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor);
- }
+ var target = getTargetOfBindingOrAssignmentElement(bindingElement);
+ if (target && ts.isPropertyName(target)) {
+ return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)
+ ? target.expression
+ : target;
}
+ ts.Debug.fail("Invalid property name for binding element.");
}
- ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
+ ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
/**
- * Adds statements to the body of a function-like node for parameters with binding patterns
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
+ * Gets the elements of a BindingOrAssignmentPattern
*/
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
- var temp = getGeneratedNameForNode(parameter);
- // In cases where a binding pattern is simply '[]' or '{}',
- // we usually don't want to emit a var declaration; however, in the presence
- // of an initializer, we must emit that expression to preserve side effects.
- if (name.elements.length > 0) {
- statements.push(setEmitFlags(createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608 /* CustomPrologue */));
+ function getElementsOfBindingOrAssignmentPattern(name) {
+ switch (name.kind) {
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ // `a` in `{a}`
+ // `a` in `[a]`
+ return name.elements;
+ case 176 /* ObjectLiteralExpression */:
+ // `a` in `{a}`
+ return name.properties;
}
- else if (initializer) {
- statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */));
+ }
+ ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
+ function convertToArrayAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpread(element.name, element), element);
+ }
+ var expression = convertToAssignmentElementTarget(element.name);
+ return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;
}
+ ts.Debug.assertNode(element, ts.isExpression);
+ return element;
}
- /**
- * Adds statements to the body of a function-like node for parameters with initializers.
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
- */
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
- createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536 /* NoSourceMap */), setEmitFlags(initializer, 1536 /* NoSourceMap */ | getEmitFlags(initializer)),
- /*location*/ parameter))
- ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */),
- /*elseStatement*/ undefined,
- /*location*/ parameter);
- statement.startsOnNewLine = true;
- setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */);
- statements.push(statement);
+ ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;
+ function convertToObjectAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpreadAssignment(element.name, element), element);
+ }
+ if (element.propertyName) {
+ var expression = convertToAssignmentElementTarget(element.name);
+ return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);
+ }
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);
+ }
+ ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);
+ return element;
}
- /**
- * Gets a value indicating whether we need to add statements to handle a rest parameter.
- *
- * @param node A ParameterDeclaration node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
+ ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
+ function convertToAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ return convertToArrayAssignmentPattern(node);
+ case 172 /* ObjectBindingPattern */:
+ case 176 /* ObjectLiteralExpression */:
+ return convertToObjectAssignmentPattern(node);
+ }
}
- /**
- * Adds statements to the body of a function-like node if it contains a rest parameter.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ ts.convertToAssignmentPattern = convertToAssignmentPattern;
+ function convertToObjectAssignmentPattern(node) {
+ if (ts.isObjectBindingPattern(node)) {
+ return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);
}
- // `declarationName` is the name of the local declaration for the parameter.
- var declarationName = getMutableClone(parameter.name);
- setEmitFlags(declarationName, 1536 /* NoSourceMap */);
- // `expressionName` is the name of the parameter used in expressions.
- var expressionName = getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = createLoopVariable();
- // var param = [];
- statements.push(setEmitFlags(createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList([
- createVariableDeclaration(declarationName,
- /*type*/ undefined, createArrayLiteral([]))
- ]),
- /*location*/ parameter), 8388608 /* CustomPrologue */));
- // for (var _i = restIndex; _i < arguments.length; _i++) {
- // param[_i - restIndex] = arguments[_i];
- // }
- var forStatement = createFor(createVariableDeclarationList([
- createVariableDeclaration(temp, /*type*/ undefined, createLiteral(restIndex))
- ], /*location*/ parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"),
- /*location*/ parameter), createPostfixIncrement(temp, /*location*/ parameter), createBlock([
- startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)),
- /*location*/ parameter))
- ]));
- setEmitFlags(forStatement, 8388608 /* CustomPrologue */);
- startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
- function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
- // The following ES6 code:
- //
- // for (let v of expr) { }
- //
- // should be emitted as
- //
- // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
- // var v = _a[_i];
- // }
- //
- // where _a and _i are temps emitted to capture the RHS and the counter,
- // respectively.
- // When the left hand side is an expression instead of a let declaration,
- // the "let v" is not emitted.
- // When the left hand side is a let/const, the v is renamed if there is
- // another v in scope.
- // Note that all assignments to the LHS are emitted in the body, including
- // all destructuring.
- // Note also that because an extra statement is needed to assign to the LHS,
- // for-of bodies are always emitted as blocks.
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- // In the case where the user wrote an identifier as the RHS, like this:
- //
- // for (let v of arr) { }
- //
- // we don't want to emit a temporary variable for the RHS, just use it directly.
- var counter = convertObjectRest ? undefined : createLoopVariable();
- var rhsReference = expression.kind === 70 /* Identifier */
- ? createUniqueName(expression.text)
- : createTempVariable(/*recordTempVariable*/ undefined);
- var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
- // Initialize LHS
- // var v = _a[_i];
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3 /* BlockScoped */) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- // This works whether the declaration is a var, let, or const.
- // It will use rhsIterationValue _a[_i] as the initializer.
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor,
- /*recordTempVariable*/ undefined, convertObjectRest);
- var declarationList = createVariableDeclarationList(declarations, /*location*/ initializer);
- setOriginalNode(declarationList, initializer);
- // Adjust the source map range for the first declaration to align with the old
- // emitter.
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(createVariableStatement(
- /*modifiers*/ undefined, declarationList));
- }
- else {
- // The following call does not include the initializer, so we have
- // to emit it separately.
- statements.push(createVariableStatement(
- /*modifiers*/ undefined, setOriginalNode(createVariableDeclarationList([
- createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined),
- /*type*/ undefined, createElementAccess(rhsReference, counter))
- ], /*location*/ ts.moveRangePos(initializer, -1)), initializer),
- /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
+ ts.Debug.assertNode(node, ts.isObjectLiteralExpression);
+ return node;
+ }
+ ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;
+ function convertToArrayAssignmentPattern(node) {
+ if (ts.isArrayBindingPattern(node)) {
+ return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);
}
- else {
- // Initializer is an expression. Emit the expression in the body, so that it's
- // evaluated on every iteration.
- var assignment = createAssignment(initializer, elementAccess);
- if (ts.isDestructuringAssignment(assignment)) {
- // This is a destructuring pattern, so we flatten the destructuring instead.
- statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment,
- /*needsValue*/ false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
- }
- else {
- // Currently there is not way to check that assignment is binary expression of destructing assignment
- // so we have to cast never type to binaryExpression
- assignment.end = initializer.end;
- statements.push(createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
+ ts.Debug.assertNode(node, ts.isArrayLiteralExpression);
+ return node;
+ }
+ ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;
+ function convertToAssignmentElementTarget(node) {
+ if (ts.isBindingPattern(node)) {
+ return convertToAssignmentPattern(node);
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
+ ts.Debug.assertNode(node, ts.isExpression);
+ return node;
+ }
+ ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;
+ function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var exportedNames;
+ var hasExportDefault = false;
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);
+ var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));
+ if (externalHelpersImportDeclaration) {
+ externalImports.push(externalHelpersImportDeclaration);
}
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 235 /* ImportDeclaration */:
+ // import "mod"
+ // import x from "mod"
+ // import * as x from "mod"
+ // import { x, y } from "mod"
+ externalImports.push(node);
+ break;
+ case 234 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {
+ // import x = require("mod")
+ externalImports.push(node);
+ }
+ break;
+ case 241 /* ExportDeclaration */:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ // export * from "mod"
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ // export { x, y } from "mod"
+ externalImports.push(node);
+ }
+ }
+ else {
+ // export { x, y }
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ if (!uniqueExports[specifier.name.text]) {
+ var name_10 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_10)
+ || resolver.getReferencedValueDeclaration(name_10);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = true;
+ exportedNames = ts.append(exportedNames, specifier.name);
+ }
+ }
+ }
+ break;
+ case 240 /* ExportAssignment */:
+ if (node.isExportEquals && !exportEquals) {
+ // export = x
+ exportEquals = node;
+ }
+ break;
+ case 205 /* VariableStatement */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
+ }
+ }
+ break;
+ case 225 /* FunctionDeclaration */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ if (ts.hasModifier(node, 512 /* Default */)) {
+ // export default function() { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export function x() { }
+ var name_11 = node.name;
+ if (!uniqueExports[name_11.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11);
+ uniqueExports[name_11.text] = true;
+ exportedNames = ts.append(exportedNames, name_11);
+ }
+ }
+ }
+ break;
+ case 226 /* ClassDeclaration */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ if (ts.hasModifier(node, 512 /* Default */)) {
+ // export default class { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export class x { }
+ var name_12 = node.name;
+ if (!uniqueExports[name_12.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12);
+ uniqueExports[name_12.text] = true;
+ exportedNames = ts.append(exportedNames, name_12);
+ }
+ }
+ }
+ break;
}
}
- // The old emitter does not emit source maps for the expression
- setEmitFlags(expression, 1536 /* NoSourceMap */ | getEmitFlags(expression));
- // The old emitter does not emit source maps for the block.
- // We add the location to preserve comments.
- var body = createBlock(createNodeArray(statements, /*location*/ statementsLocation),
- /*location*/ bodyLocation);
- setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */);
- var forStatement;
- if (convertObjectRest) {
- forStatement = createForOf(createVariableDeclarationList([
- createVariableDeclaration(rhsReference, /*type*/ undefined, /*initializer*/ undefined, /*location*/ node.expression)
- ], /*location*/ node.expression), node.expression, body,
- /*location*/ node);
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
+ }
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
+ }
+ }
}
- else {
- forStatement = createFor(setEmitFlags(createVariableDeclarationList([
- createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
- createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
- ], /*location*/ node.expression), 16777216 /* NoHoisting */), createLessThan(counter, createPropertyAccess(rhsReference, "length"),
- /*location*/ node.expression), createPostfixIncrement(counter, /*location*/ node.expression), body,
- /*location*/ node);
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = true;
+ exportedNames = ts.append(exportedNames, decl.name);
+ }
}
- // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
- setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */);
- return forStatement;
+ return exportedNames;
}
- ts.convertForOf = convertForOf;
})(ts || (ts = {}));
/// <reference path="utilities.ts"/>
/// <reference path="scanner.ts"/>
@@ -14217,29 +14250,31 @@ var ts;
visitNode(cbNode, node.type);
case 278 /* JSDocComment */:
return visitNodes(cbNodes, node.tags);
- case 280 /* JSDocParameterTag */:
+ case 281 /* JSDocParameterTag */:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 281 /* JSDocReturnTag */:
+ case 282 /* JSDocReturnTag */:
return visitNode(cbNode, node.typeExpression);
- case 282 /* JSDocTypeTag */:
+ case 283 /* JSDocTypeTag */:
return visitNode(cbNode, node.typeExpression);
- case 283 /* JSDocTemplateTag */:
+ case 280 /* JSDocAugmentsTag */:
+ return visitNode(cbNode, node.typeExpression);
+ case 284 /* JSDocTemplateTag */:
return visitNodes(cbNodes, node.typeParameters);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 285 /* JSDocPropertyTag */:
+ case 286 /* JSDocPropertyTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
- case 287 /* JSDocLiteralType */:
+ case 288 /* JSDocLiteralType */:
return visitNode(cbNode, node.literal);
}
}
@@ -14462,7 +14497,7 @@ var ts;
return sourceFile;
}
function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ var comments = ts.getJSDocCommentRanges(node, sourceFile.text);
if (comments) {
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var comment = comments_2[_i];
@@ -14470,10 +14505,10 @@ var ts;
if (!jsDoc) {
continue;
}
- if (!node.jsDocComments) {
- node.jsDocComments = [];
+ if (!node.jsDoc) {
+ node.jsDoc = [];
}
- node.jsDocComments.push(jsDoc);
+ node.jsDoc.push(jsDoc);
}
}
return node;
@@ -14495,12 +14530,12 @@ var ts;
var saveParent = parent;
parent = n;
forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
+ if (n.jsDoc) {
+ for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ jsDoc.parent = n;
+ parent = jsDoc;
+ forEachChild(jsDoc, visitNode);
}
}
parent = saveParent;
@@ -18524,8 +18559,8 @@ var ts;
}
if (decorators || modifiers) {
// treat this as a property declaration with a missing name.
- var name_14 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, /*questionToken*/ undefined);
+ var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
ts.Debug.fail("Should not have attempted to parse class member declaration.");
@@ -19276,7 +19311,7 @@ var ts;
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(287 /* JSDocLiteralType */);
+ var result = createNode(288 /* JSDocLiteralType */);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -19486,6 +19521,9 @@ var ts;
var tag;
if (tagName) {
switch (tagName.text) {
+ case "augments":
+ tag = parseAugmentsTag(atToken, tagName);
+ break;
case "param":
tag = parseParamTag(atToken, tagName);
break;
@@ -19633,7 +19671,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(280 /* JSDocParameterTag */, atToken.pos);
+ var result = createNode(281 /* JSDocParameterTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -19644,20 +19682,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocReturnTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(281 /* JSDocReturnTag */, atToken.pos);
+ var result = createNode(282 /* JSDocReturnTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTypeTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(282 /* JSDocTypeTag */, atToken.pos);
+ var result = createNode(283 /* JSDocTypeTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -19672,17 +19710,25 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(285 /* JSDocPropertyTag */, atToken.pos);
+ var result = createNode(286 /* JSDocPropertyTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
return finishNode(result);
}
+ function parseAugmentsTag(atToken, tagName) {
+ var typeExpression = tryParseTypeExpression();
+ var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos);
+ result.atToken = atToken;
+ result.tagName = tagName;
+ result.typeExpression = typeExpression;
+ return finishNode(result);
+ }
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(284 /* JSDocTypedefTag */, atToken.pos);
+ var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0);
@@ -19699,8 +19745,8 @@ var ts;
if (typeExpression.type.kind === 272 /* JSDocTypeReference */) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70 /* Identifier */) {
- var name_15 = jsDocTypeReference.name;
- if (name_15.text === "Object") {
+ var name_14 = jsDocTypeReference.name;
+ if (name_14.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -19714,7 +19760,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(286 /* JSDocTypeLiteral */, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -19801,20 +19847,20 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTemplateTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
// Type parameter list looks like '@template T,U,V'
var typeParameters = createNodeArray();
while (true) {
- var name_16 = parseJSDocIdentifierName();
+ var name_15 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_16) {
+ if (!name_15) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(143 /* TypeParameter */, name_16.pos);
- typeParameter.name = name_16;
+ var typeParameter = createNode(143 /* TypeParameter */, name_15.pos);
+ typeParameter.name = name_15;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25 /* CommaToken */) {
@@ -19825,7 +19871,7 @@ var ts;
break;
}
}
- var result = createNode(283 /* JSDocTemplateTag */, atToken.pos);
+ var result = createNode(284 /* JSDocTemplateTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -19952,8 +19998,8 @@ var ts;
ts.Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
forEachChild(jsDocComment, visitNode, visitArray);
}
@@ -20530,7 +20576,7 @@ var ts;
if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
@@ -20580,7 +20626,7 @@ var ts;
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
if (parentNode && parentNode.kind === 205 /* VariableStatement */) {
@@ -20713,7 +20759,7 @@ var ts;
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
// and this case is specially handled. Module augmentations should only be merged with original module definition
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
- var isJSDocTypedefInJSDocNamespace = node.kind === 284 /* JSDocTypedefTag */ &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ &&
node.name &&
node.name.kind === 70 /* Identifier */ &&
node.name.isInJSDocNamespace;
@@ -20845,15 +20891,38 @@ var ts;
subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);
}
}
+ function bindEach(nodes) {
+ if (nodes === undefined) {
+ return;
+ }
+ if (skipTransformFlagAggregation) {
+ ts.forEach(nodes, bind);
+ }
+ else {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0 /* None */;
+ var nodeArrayFlags = 0 /* None */;
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
+ var node = nodes_2[_i];
+ bind(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
+ }
+ }
+ function bindEachChild(node) {
+ ts.forEachChild(node, bind, bindEach);
+ }
function bindChildrenWorker(node) {
// Binding of JsDocComment should be done before the current block scope container changes.
// because the scope of JsDocComment should not be affected by whether the current node is a
// container or not.
- if (ts.isInJavaScriptFile(node) && node.jsDocComments) {
- ts.forEach(node.jsDocComments, bind);
+ if (ts.isInJavaScriptFile(node) && node.jsDoc) {
+ ts.forEach(node.jsDoc, bind);
}
if (checkUnreachable(node)) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
return;
}
switch (node.kind) {
@@ -20918,7 +20987,7 @@ var ts;
bindCallExpressionFlow(node);
break;
default:
- ts.forEachChild(node, bind);
+ bindEachChild(node);
break;
}
}
@@ -21224,7 +21293,7 @@ var ts;
}
return undefined;
}
- function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
+ function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
@@ -21237,11 +21306,11 @@ var ts;
var activeLabel = findActiveLabel(node.label.text);
if (activeLabel) {
activeLabel.referenced = true;
- bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
+ bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
}
}
else {
- bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
+ bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
}
}
function bindTryStatement(node) {
@@ -21303,6 +21372,8 @@ var ts;
currentFlow = finishFlowLabel(postSwitchLabel);
}
function bindCaseBlock(node) {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
var clauses = node.clauses;
var fallthroughFlow = unreachableFlow;
for (var i = 0; i < clauses.length; i++) {
@@ -21322,13 +21393,15 @@ var ts;
errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);
}
}
+ clauses.transformFlags = subtreeTransformFlags | 536870912 /* HasComputedFlags */;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
}
function bindCaseClause(node) {
var saveCurrentFlow = currentFlow;
currentFlow = preSwitchCaseFlow;
bind(node.expression);
currentFlow = saveCurrentFlow;
- ts.forEach(node.statements, bind);
+ bindEach(node.statements);
}
function pushActiveLabel(name, breakTarget, continueTarget) {
var activeLabel = {
@@ -21415,19 +21488,19 @@ var ts;
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
- ts.forEachChild(node, bind);
+ bindEachChild(node);
currentFalseTarget = currentTrueTarget;
currentTrueTarget = saveTrueTarget;
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {
bindAssignmentTargetFlow(node.operand);
}
@@ -21445,7 +21518,7 @@ var ts;
}
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) {
@@ -21458,7 +21531,7 @@ var ts;
}
}
function bindDeleteExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.expression.kind === 177 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
@@ -21491,7 +21564,7 @@ var ts;
}
}
function bindVariableDeclarationFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) {
bindInitializedVariableFlow(node);
}
@@ -21505,12 +21578,12 @@ var ts;
expr = expr.expression;
}
if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) {
- ts.forEach(node.typeArguments, bind);
- ts.forEach(node.arguments, bind);
+ bindEach(node.typeArguments);
+ bindEach(node.arguments);
bind(node.expression);
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
}
if (node.expression.kind === 177 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
@@ -21526,7 +21599,7 @@ var ts;
case 229 /* EnumDeclaration */:
case 176 /* ObjectLiteralExpression */:
case 161 /* TypeLiteral */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 270 /* JSDocRecordType */:
return 1 /* IsContainer */;
case 227 /* InterfaceDeclaration */:
@@ -21616,7 +21689,7 @@ var ts;
case 176 /* ObjectLiteralExpression */:
case 227 /* InterfaceDeclaration */:
case 270 /* JSDocRecordType */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
@@ -21990,8 +22063,8 @@ var ts;
}
function updateStrictModeStatementList(statements) {
if (!inStrictMode) {
- for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
- var statement = statements_1[_i];
+ for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
+ var statement = statements_2[_i];
if (!ts.isPrologueDirective(statement)) {
return;
}
@@ -22018,7 +22091,7 @@ var ts;
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 284 /* JSDocTypedefTag */) {
+ while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
@@ -22089,7 +22162,7 @@ var ts;
case 146 /* PropertySignature */:
case 271 /* JSDocRecordMember */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
- case 285 /* JSDocPropertyTag */:
+ case 286 /* JSDocPropertyTag */:
return bindJSDocProperty(node);
case 257 /* PropertyAssignment */:
case 258 /* ShorthandPropertyAssignment */:
@@ -22137,7 +22210,7 @@ var ts;
return bindFunctionOrConstructorType(node);
case 161 /* TypeLiteral */:
case 170 /* MappedType */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 270 /* JSDocRecordType */:
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
case 176 /* ObjectLiteralExpression */:
@@ -22158,7 +22231,7 @@ var ts;
return bindClassLikeDeclaration(node);
case 227 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
if (!node.fullName || node.fullName.kind === 70 /* Identifier */) {
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
}
@@ -22238,12 +22311,12 @@ var ts;
return;
}
else {
- var parent_5 = node.parent;
- if (!ts.isExternalModule(parent_5)) {
+ var parent_4 = node.parent;
+ if (!ts.isExternalModule(parent_4)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_5.isDeclarationFile) {
+ if (!parent_4.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -22591,14 +22664,14 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */
+ if (subtreeFlags & 524288 /* ContainsSpread */
|| isSuperOrSuperProperty(expression, expressionKind)) {
// If the this node contains a SpreadExpression, or is a super call, then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
@@ -22617,13 +22690,13 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (subtreeFlags & 524288 /* ContainsSpread */) {
// If the this node contains a SpreadElementExpression then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22632,19 +22705,19 @@ var ts;
if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ESNext if they contain rest
- transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
+ transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
- transformFlags |= 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
+ transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */
|| operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
- transformFlags |= 768 /* AssertES2016 */;
+ transformFlags |= 32 /* AssertES2016 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22656,25 +22729,25 @@ var ts;
// syntax.
if (node.questionToken
|| node.type
- || subtreeFlags & 65536 /* ContainsDecorators */
+ || subtreeFlags & 4096 /* ContainsDecorators */
|| ts.isThisIdentifier(name)) {
transformFlags |= 3 /* AssertTypeScript */;
}
// If a parameter has an accessibility modifier, then it is TypeScript syntax.
if (modifierFlags & 92 /* ParameterPropertyModifier */) {
- transformFlags |= 3 /* AssertTypeScript */ | 4194304 /* ContainsParameterPropertyAssignments */;
+ transformFlags |= 3 /* AssertTypeScript */ | 262144 /* ContainsParameterPropertyAssignments */;
}
// parameters with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a parameter has an initializer, a binding pattern or a dotDotDot token, then
// it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel.
- if (subtreeFlags & 67108864 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
- transformFlags |= 3072 /* AssertES2015 */ | 2097152 /* ContainsDefaultValueAssignments */;
+ if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
+ transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~604001621 /* ParameterExcludes */;
+ return transformFlags & ~536872257 /* ParameterExcludes */;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22690,11 +22763,11 @@ var ts;
}
// If the expression of a ParenthesizedExpression is a destructuring assignment,
// then the ParenthesizedExpression is a destructuring assignment.
- if (expressionTransformFlags & 16384 /* DestructuringAssignment */) {
- transformFlags |= 16384 /* DestructuringAssignment */;
+ if (expressionTransformFlags & 1024 /* DestructuringAssignment */) {
+ transformFlags |= 1024 /* DestructuringAssignment */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -22705,47 +22778,47 @@ var ts;
}
else {
// A ClassDeclaration is ES6 syntax.
- transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
// An exported declaration may be TypeScript syntax, but is handled by the visitor
// for a namespace declaration.
- if ((subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */)
+ if ((subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */)
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~559895893 /* ClassExcludes */;
+ return transformFlags & ~539358529 /* ClassExcludes */;
}
function computeClassExpression(node, subtreeFlags) {
// A ClassExpression is ES6 syntax.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
- if (subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */
+ if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~559895893 /* ClassExcludes */;
+ return transformFlags & ~539358529 /* ClassExcludes */;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 107 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
@@ -22756,27 +22829,27 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~537920833 /* CatchClauseExcludes */;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
// An ExpressionWithTypeArguments is ES6 syntax, as it is used in the
// extends clause of a class.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// If an ExpressionWithTypeArguments contains type arguments, then it
// is TypeScript syntax.
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22785,12 +22858,16 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* ConstructorExcludes */;
+ return transformFlags & ~601015617 /* ConstructorExcludes */;
}
function computeMethod(node, subtreeFlags) {
// A MethodDeclaration is ES6 syntax.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// Decorators, TypeScript-specific modifiers, type parameters, type annotations, and
// overloads are TypeScript syntax.
if (node.decorators
@@ -22800,16 +22877,20 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
// An async method declaration is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// Currently, we only support generators that were originally async function bodies.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22821,8 +22902,12 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;
}
function computePropertyDeclaration(node, subtreeFlags) {
// A PropertyDeclaration is TypeScript syntax.
@@ -22830,10 +22915,10 @@ var ts;
// If the PropertyDeclaration has an initializer, we need to inform its ancestor
// so that it handle the transformation.
if (node.initializer) {
- transformFlags |= 131072 /* ContainsPropertyInitializer */;
+ transformFlags |= 8192 /* ContainsPropertyInitializer */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -22845,7 +22930,7 @@ var ts;
transformFlags = 3 /* AssertTypeScript */;
}
else {
- transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
+ transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (modifierFlags & 2270 /* TypeScriptModifier */
@@ -22855,29 +22940,29 @@ var ts;
}
// An async function declaration is ES2017 syntax.
if (modifierFlags & 256 /* Async */) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// function declarations with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a FunctionDeclaration's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a FunctionDeclaration is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
// Currently we do not support transforming any other generator fucntions
// down level.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~980243797 /* FunctionExcludes */;
+ return transformFlags & ~601281857 /* FunctionExcludes */;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22890,32 +22975,32 @@ var ts;
}
// An async function expression is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// function expressions with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a FunctionExpression's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a FunctionExpression is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
// Currently we do not support transforming any other generator fucntions
// down level.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~980243797 /* FunctionExcludes */;
+ return transformFlags & ~601281857 /* FunctionExcludes */;
}
function computeArrowFunction(node, subtreeFlags) {
// An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)
@@ -22925,18 +23010,18 @@ var ts;
}
// An async arrow function is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// arrow functions with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If an ArrowFunction contains a lexical this, its container must capture the lexical this.
- if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
- transformFlags |= 524288 /* ContainsCapturedLexicalThis */;
+ if (subtreeFlags & 16384 /* ContainsLexicalThis */) {
+ transformFlags |= 32768 /* ContainsCapturedLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~979719509 /* ArrowFunctionExcludes */;
+ return transformFlags & ~601249089 /* ArrowFunctionExcludes */;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22945,28 +23030,24 @@ var ts;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
if (expressionKind === 96 /* SuperKeyword */) {
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var nameKind = node.name.kind;
- // A VariableDeclaration with an object binding pattern is ES2015 syntax
- // and possibly ESNext syntax if it contains an object binding pattern
- if (nameKind === 172 /* ObjectBindingPattern */) {
- transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
- }
- else if (nameKind === 173 /* ArrayBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ // A VariableDeclaration containing ObjectRest is ESNext syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// Type annotations are TypeScript syntax.
if (node.type) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -22978,22 +23059,22 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- if (declarationListTransformFlags & 67108864 /* ContainsBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// A labeled statement containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */
+ if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */
&& ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) {
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -23002,18 +23083,18 @@ var ts;
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// If the expression of an expression statement is a destructuring assignment,
// then we treat the statement as ES6 so that we can indicate that we do not
// need to hold on to the right-hand side.
- if (node.expression.transformFlags & 16384 /* DestructuringAssignment */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3 /* AssertTypeScript */;
@@ -23022,29 +23103,29 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~839734613 /* ModuleExcludes */;
+ return transformFlags & ~574674241 /* ModuleExcludes */;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
- if (subtreeFlags & 67108864 /* ContainsBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
+ if (subtreeFlags & 8388608 /* ContainsBindingPattern */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax.
if (node.flags & 3 /* BlockScoped */) {
- transformFlags |= 3072 /* AssertES2015 */ | 33554432 /* ContainsBlockScopedBinding */;
+ transformFlags |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~604001621 /* VariableDeclarationListExcludes */;
+ return transformFlags & ~546309441 /* VariableDeclarationListExcludes */;
}
function computeOther(node, kind, subtreeFlags) {
// Mark transformations needed for each node
var transformFlags = subtreeFlags;
- var excludeFlags = 536892757 /* NodeExcludes */;
+ var excludeFlags = 536872257 /* NodeExcludes */;
switch (kind) {
case 119 /* AsyncKeyword */:
case 189 /* AwaitExpression */:
// async/await is ES2017 syntax
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
break;
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
@@ -23070,11 +23151,11 @@ var ts;
case 251 /* JsxSpreadAttribute */:
case 252 /* JsxExpression */:
// These nodes are Jsx syntax.
- transformFlags |= 12 /* AssertJsx */;
+ transformFlags |= 4 /* AssertJsx */;
break;
case 213 /* ForOfStatement */:
// for-of might be ESNext if it has a rest destructuring
- transformFlags |= 48 /* AssertESNext */;
+ transformFlags |= 8 /* AssertESNext */;
// FALLTHROUGH
case 12 /* NoSubstitutionTemplateLiteral */:
case 13 /* TemplateHead */:
@@ -23085,11 +23166,11 @@ var ts;
case 258 /* ShorthandPropertyAssignment */:
case 114 /* StaticKeyword */:
// These nodes are ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 195 /* YieldExpression */:
// This node is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */ | 134217728 /* ContainsYield */;
+ transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */;
break;
case 118 /* AnyKeyword */:
case 132 /* NumberKeyword */:
@@ -23130,8 +23211,8 @@ var ts;
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
- transformFlags |= 16777216 /* ContainsComputedPropertyName */;
- if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
+ transformFlags |= 2097152 /* ContainsComputedPropertyName */;
+ if (subtreeFlags & 16384 /* ContainsLexicalThis */) {
// A computed method name like `[this.getName()](x: string) { ... }` needs to
// distinguish itself from the normal case of a method body containing `this`:
// `this` inside a method doesn't need to be rewritten (the method provides `this`),
@@ -23140,66 +23221,69 @@ var ts;
// `_this = this; () => class K { [_this.getName()]() { ... } }`
// To make this distinction, use ContainsLexicalThisInComputedPropertyName
// instead of ContainsLexicalThis for computed property names
- transformFlags |= 1048576 /* ContainsLexicalThisInComputedPropertyName */;
+ transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */;
}
break;
case 196 /* SpreadElement */:
+ transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */;
+ break;
case 259 /* SpreadAssignment */:
- // This node is ES6 or ES next syntax, but is handled by a containing node.
- transformFlags |= 8388608 /* ContainsSpreadExpression */;
+ transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */;
break;
- case 174 /* BindingElement */:
- if (node.dotDotDotToken) {
- // this node is ES2015 or ES next syntax, but is handled by a containing node.
- transformFlags |= 8388608 /* ContainsSpreadExpression */;
- }
case 96 /* SuperKeyword */:
// This node is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 98 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
break;
case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- // These nodes are ES2015 or ES Next syntax.
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */ | 67108864 /* ContainsBindingPattern */;
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ if (subtreeFlags & 524288 /* ContainsRest */) {
+ transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */;
}
- else {
- transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ excludeFlags = 537396545 /* BindingPatternExcludes */;
+ break;
+ case 173 /* ArrayBindingPattern */:
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ excludeFlags = 537396545 /* BindingPatternExcludes */;
+ break;
+ case 174 /* BindingElement */:
+ transformFlags |= 192 /* AssertES2015 */;
+ if (node.dotDotDotToken) {
+ transformFlags |= 524288 /* ContainsRest */;
}
break;
case 145 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
- transformFlags |= 3 /* AssertTypeScript */ | 65536 /* ContainsDecorators */;
+ transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */;
break;
case 176 /* ObjectLiteralExpression */:
- excludeFlags = 554784085 /* ObjectLiteralExcludes */;
- if (subtreeFlags & 16777216 /* ContainsComputedPropertyName */) {
+ excludeFlags = 540087617 /* ObjectLiteralExcludes */;
+ if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
// is an ES6 node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (subtreeFlags & 1048576 /* ContainsObjectSpread */) {
// If an ObjectLiteralExpression contains a spread element, then it
// is an ES next node.
- transformFlags |= 48 /* AssertESNext */;
+ transformFlags |= 8 /* AssertESNext */;
}
break;
case 175 /* ArrayLiteralExpression */:
case 180 /* NewExpression */:
- excludeFlags = 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */;
+ if (subtreeFlags & 524288 /* ContainsSpread */) {
// If the this node contains a SpreadExpression, then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 209 /* DoStatement */:
@@ -23207,19 +23291,19 @@ var ts;
case 211 /* ForStatement */:
case 212 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 261 /* SourceFile */:
- if (subtreeFlags & 524288 /* ContainsCapturedLexicalThis */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 216 /* ReturnStatement */:
case 214 /* ContinueStatement */:
case 215 /* BreakStatement */:
- transformFlags |= 268435456 /* ContainsHoistedDeclarationOrCompletion */;
+ transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -23241,27 +23325,27 @@ var ts;
case 179 /* CallExpression */:
case 180 /* NewExpression */:
case 175 /* ArrayLiteralExpression */:
- return 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return 537396545 /* ArrayLiteralOrCallOrNewExcludes */;
case 230 /* ModuleDeclaration */:
- return 839734613 /* ModuleExcludes */;
+ return 574674241 /* ModuleExcludes */;
case 144 /* Parameter */:
- return 604001621 /* ParameterExcludes */;
+ return 536872257 /* ParameterExcludes */;
case 185 /* ArrowFunction */:
- return 979719509 /* ArrowFunctionExcludes */;
+ return 601249089 /* ArrowFunctionExcludes */;
case 184 /* FunctionExpression */:
case 225 /* FunctionDeclaration */:
- return 980243797 /* FunctionExcludes */;
+ return 601281857 /* FunctionExcludes */;
case 224 /* VariableDeclarationList */:
- return 604001621 /* VariableDeclarationListExcludes */;
+ return 546309441 /* VariableDeclarationListExcludes */;
case 226 /* ClassDeclaration */:
case 197 /* ClassExpression */:
- return 559895893 /* ClassExcludes */;
+ return 539358529 /* ClassExcludes */;
case 150 /* Constructor */:
- return 975983957 /* ConstructorExcludes */;
+ return 601015617 /* ConstructorExcludes */;
case 149 /* MethodDeclaration */:
case 151 /* GetAccessor */:
case 152 /* SetAccessor */:
- return 975983957 /* MethodOrAccessorExcludes */;
+ return 601015617 /* MethodOrAccessorExcludes */;
case 118 /* AnyKeyword */:
case 132 /* NumberKeyword */:
case 129 /* NeverKeyword */:
@@ -23279,9 +23363,14 @@ var ts;
case 228 /* TypeAliasDeclaration */:
return -3 /* TypeExcludes */;
case 176 /* ObjectLiteralExpression */:
- return 554784085 /* ObjectLiteralExcludes */;
+ return 540087617 /* ObjectLiteralExcludes */;
+ case 256 /* CatchClause */:
+ return 537920833 /* CatchClauseExcludes */;
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ return 537396545 /* BindingPatternExcludes */;
default:
- return 536892757 /* NodeExcludes */;
+ return 536872257 /* NodeExcludes */;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -23332,6 +23421,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -24100,6 +24190,7 @@ var ts;
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
isOptionalParameter: isOptionalParameter,
+ tryGetMemberInModuleExports: tryGetMemberInModuleExports,
tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
// we deliberately exclude augmentations
// since we are only interested in declarations of the module itself
@@ -24111,6 +24202,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var indexedAccessTypes = ts.createMap();
var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown");
var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__");
@@ -24130,7 +24222,6 @@ var ts;
var voidType = createIntrinsicType(1024 /* Void */, "void");
var neverType = createIntrinsicType(8192 /* Never */, "never");
var silentNeverType = createIntrinsicType(8192 /* Never */, "never");
- var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type");
emptyTypeLiteralSymbol.members = ts.createMap();
@@ -24853,6 +24944,7 @@ var ts;
if (!errorLocation ||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
!checkAndReportErrorForExtendingInterface(errorLocation) &&
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg));
}
@@ -24951,6 +25043,16 @@ var ts;
return undefined;
}
}
+ function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
+ if (meaning === 1920 /* Namespace */) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));
+ if (symbol) {
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);
+ return true;
+ }
+ }
+ return false;
+ }
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */)) {
var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));
@@ -25079,31 +25181,31 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_17 = specifier.propertyName || specifier.name;
- if (name_17.text) {
+ var name_16 = specifier.propertyName || specifier.name;
+ if (name_16.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
// First check if module was specified with "export=". If so, get the member from the resolved type
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);
}
// if symbolFromVariable is export - get its final target
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_17.text);
+ var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
- if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") {
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17));
+ error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));
}
return symbol;
}
@@ -25357,6 +25459,12 @@ var ts;
function getExportsOfModuleAsArray(moduleSymbol) {
return symbolsToArray(getExportsOfModule(moduleSymbol));
}
+ function tryGetMemberInModuleExports(memberName, moduleSymbol) {
+ var symbolTable = getExportsOfModule(moduleSymbol);
+ if (symbolTable) {
+ return symbolTable[memberName];
+ }
+ }
function getExportsOfSymbol(symbol) {
return symbol.flags & 1536 /* Module */ ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
@@ -25967,9 +26075,9 @@ var ts;
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
// Go up and add our parent.
- var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_6) {
- walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
+ var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_5) {
+ walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
}
}
if (accessibleSymbolChain) {
@@ -26119,14 +26227,14 @@ var ts;
while (i < length_1) {
// Find group of type arguments for type parameters with the same declaring container.
var start = i;
- var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);
// When type parameters are their own type arguments for the whole group (i.e. we have
// the default outer type arguments), we don't show the group.
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_7, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);
writePunctuation(writer, 22 /* DotToken */);
}
}
@@ -26565,14 +26673,14 @@ var ts;
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_8 = getDeclarationContainer(node);
+ var parent_7 = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_8.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_8))) {
- return isGlobalSourceFile(parent_8);
+ !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) {
+ return isGlobalSourceFile(parent_7);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
- return isDeclarationVisible(parent_8);
+ return isDeclarationVisible(parent_7);
case 147 /* PropertyDeclaration */:
case 146 /* PropertySignature */:
case 151 /* GetAccessor */:
@@ -26757,15 +26865,15 @@ var ts;
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression);
}
function getRestType(source, properties, symbol) {
ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now.");
var members = ts.createMap();
var names = ts.createMap();
for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var name_18 = properties_2[_i];
- names[ts.getTextOfPropertyName(name_18)] = true;
+ var name_17 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_17)] = true;
}
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
var prop = _b[_a];
@@ -26808,7 +26916,7 @@ var ts;
var literalMembers = [];
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 198 /* OmittedExpression */ && !element.dotDotDotToken) {
+ if (!element.dotDotDotToken) {
literalMembers.push(element.propertyName || element.name);
}
}
@@ -26816,8 +26924,8 @@ var ts;
}
else {
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
- var name_19 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_19)) {
+ var name_18 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_18)) {
// computed properties with non-literal names are treated as 'any'
return anyType;
}
@@ -26826,12 +26934,12 @@ var ts;
}
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
- var text = ts.getTextOfPropertyName(name_19);
+ var text = ts.getTextOfPropertyName(name_18);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) ||
getIndexTypeOfType(parentType, 0 /* String */);
if (!type) {
- error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19));
+ error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18));
return unknownType;
}
}
@@ -26872,33 +26980,9 @@ var ts;
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
- if (jsDocType) {
- return getTypeFromTypeNode(jsDocType);
- }
- }
- function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- // First, see if this node has an @type annotation on it directly.
- var typeTag = ts.getJSDocTypeTag(declaration);
- if (typeTag && typeTag.typeExpression) {
- return typeTag.typeExpression.type;
- }
- if (declaration.kind === 223 /* VariableDeclaration */ &&
- declaration.parent.kind === 224 /* VariableDeclarationList */ &&
- declaration.parent.parent.kind === 205 /* VariableStatement */) {
- // @type annotation might have been on the variable statement, try that instead.
- var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
- if (annotation && annotation.typeExpression) {
- return annotation.typeExpression.type;
- }
- }
- else if (declaration.kind === 144 /* Parameter */) {
- // If it's a parameter, see if the parent has a jsdoc comment with an @param
- // annotation.
- var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type;
- }
+ var jsdocType = ts.getJSDocType(declaration);
+ if (jsdocType) {
+ return getTypeFromTypeNode(jsdocType);
}
return undefined;
}
@@ -26924,9 +27008,11 @@ var ts;
return type;
}
}
- // A variable declared in a for..in statement is always of type string
+ // A variable declared in a for..in statement is of type string, or of type keyof T when the
+ // right hand expression is of a type parameter type.
if (declaration.parent.parent.kind === 212 /* ForInStatement */) {
- return stringType;
+ var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
+ return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType;
}
if (declaration.parent.parent.kind === 213 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
@@ -26942,9 +27028,11 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ if ((compilerOptions.noImplicitAny || declaration.flags & 2097152 /* JavaScriptFile */) &&
+ declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) {
- // Use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
+ // If --noImplicitAny is on or the declaration is in a Javascript file,
+ // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
// initializer or a 'null' or 'undefined' initializer.
if (!(ts.getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -27123,7 +27211,7 @@ var ts;
if (declaration.kind === 240 /* ExportAssignment */) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 285 /* JSDocPropertyTag */ && declaration.typeExpression) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
// Handle variable, parameter or property
@@ -27140,9 +27228,9 @@ var ts;
declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) {
// Use JS Doc type if present on parent expression statement
if (declaration.flags & 2097152 /* JavaScriptFile */) {
- var typeTag = ts.getJSDocTypeTag(declaration.parent);
- if (typeTag && typeTag.typeExpression) {
- return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
+ var jsdocType = ts.getJSDocType(declaration.parent);
+ if (jsdocType) {
+ return links.type = getTypeFromTypeNode(jsdocType);
}
}
var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ?
@@ -27477,6 +27565,14 @@ var ts;
}
baseType = getReturnTypeOfSignature(constructors[0]);
}
+ // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters
+ var valueDecl = type.symbol.valueDeclaration;
+ if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {
+ var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);
+ if (augTag) {
+ baseType = getTypeFromTypeNode(augTag.typeExpression.type);
+ }
+ }
if (baseType === unknownType) {
return;
}
@@ -27485,7 +27581,7 @@ var ts;
return;
}
if (type === baseType || hasBaseType(baseType, type)) {
- error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));
+ error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));
return;
}
if (type.resolvedBaseTypes === emptyArray) {
@@ -27599,7 +27695,7 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return unknownType;
}
- var declaration = ts.getDeclarationOfKind(symbol, 284 /* JSDocTypedefTag */);
+ var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -28123,6 +28219,8 @@ var ts;
var members = ts.createMap();
var stringIndexInfo;
var numberIndexInfo;
+ // Resolve upfront such that recursive references see an empty object type.
+ setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
// In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type,
// and T as the template type.
var typeParameter = getTypeParameterFromMappedType(type);
@@ -28180,6 +28278,9 @@ var ts;
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
unknownType);
}
+ function getErasedTemplateTypeFromMappedType(type) {
+ return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
+ }
function isGenericMappedType(type) {
if (getObjectFlags(type) & 32 /* Mapped */) {
var constraintType = getConstraintTypeFromMappedType(type);
@@ -28278,18 +28379,25 @@ var ts;
return type.resolvedApparentType;
}
/**
+ * The apparent type of an indexed access T[K] is the type of T's string index signature, if any.
+ */
+ function getApparentTypeOfIndexedAccess(type) {
+ return getIndexTypeOfType(getApparentType(type.objectType), 0 /* String */) || type;
+ }
+ /**
* For a type parameter, return the base constraint of the type parameter. For the string, number,
* boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : type;
- return t.flags & 34 /* StringLike */ ? globalStringType :
+ var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) :
+ type.flags & 524288 /* IndexedAccess */ ? getApparentTypeOfIndexedAccess(type) :
+ type;
+ return t.flags & 262178 /* StringLike */ ? globalStringType :
t.flags & 340 /* NumberLike */ ? globalNumberType :
t.flags & 136 /* BooleanLike */ ? globalBooleanType :
t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() :
- t.flags & 262144 /* Index */ ? stringOrNumberType :
- t;
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -28487,13 +28595,16 @@ var ts;
if (node.type && node.type.kind === 273 /* JSDocOptionalType */) {
return true;
}
- var paramTag = ts.getCorrespondingJSDocParameterTag(node);
- if (paramTag) {
- if (paramTag.isBracketed) {
- return true;
- }
- if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */;
+ var paramTags = ts.getJSDocParameterTags(node);
+ if (paramTags) {
+ for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {
+ var paramTag = paramTags_1[_i];
+ if (paramTag.isBracketed) {
+ return true;
+ }
+ if (paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */;
+ }
}
}
}
@@ -29408,10 +29519,14 @@ var ts;
}
function getIndexType(type) {
return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) :
- type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringOrNumberType :
- getIndexInfoOfType(type, 1 /* Number */) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType :
getLiteralTypeFromPropertyNames(type);
}
+ function getIndexTypeOrString(type) {
+ var indexType = getIndexType(type);
+ return indexType !== neverType ? indexType : stringType;
+ }
function getTypeFromTypeOperatorNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -29425,10 +29540,6 @@ var ts;
type.indexType = indexType;
return type;
}
- function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
- var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
- return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
- }
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ?
@@ -29451,7 +29562,7 @@ var ts;
return getTypeOfSymbol(prop);
}
}
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
if (isTypeAny(objectType)) {
return anyType;
}
@@ -29491,20 +29602,46 @@ var ts;
}
return unknownType;
}
+ function getIndexedAccessForMappedType(type, indexType, accessNode) {
+ var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
+ return unknownType;
+ }
+ var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);
+ var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
+ return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken);
+ }
function getIndexedAccessType(objectType, indexType, accessNode) {
- if (indexType.flags & 16384 /* TypeParameter */) {
- if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
- error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
- return unknownType;
+ if (indexType.flags & 16384 /* TypeParameter */ ||
+ objectType.flags & 16384 /* TypeParameter */ && indexType.flags & 262144 /* Index */ ||
+ isGenericMappedType(objectType)) {
+ // If either the object type or the index type are type parameters, or if the object type is a mapped
+ // type with a generic constraint, we are performing a higher-order index access where we cannot
+ // meaningfully access the properties of the object type. In those cases, we first check that the
+ // index type is assignable to 'keyof T' for the object type.
+ if (accessNode) {
+ if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
+ error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
+ return unknownType;
+ }
}
- return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes
+ // the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the
+ // type Box<T[X]>.
+ if (isGenericMappedType(objectType)) {
+ return getIndexedAccessForMappedType(objectType, indexType, accessNode);
+ }
+ // Otherwise we defer the operation by creating an indexed access type.
+ var id = objectType.id + "," + indexType.id;
+ return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
}
- var apparentType = getApparentType(objectType);
+ var apparentObjectType = getApparentType(objectType);
if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) {
var propTypes = [];
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false);
+ var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false);
if (propType === unknownType) {
return unknownType;
}
@@ -29512,7 +29649,7 @@ var ts;
}
return getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true);
+ return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -29529,6 +29666,9 @@ var ts;
type.aliasSymbol = getAliasSymbolForTypeNode(node);
type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
links.resolvedType = type;
+ // Eagerly resolve the constraint type which forces an error if the constraint type circularly
+ // references itself through one or more type aliases.
+ getConstraintTypeFromMappedType(type);
}
return links.resolvedType;
}
@@ -29705,18 +29845,18 @@ var ts;
return nullType;
case 129 /* NeverKeyword */:
return neverType;
- case 288 /* JSDocNullKeyword */:
+ case 289 /* JSDocNullKeyword */:
return nullType;
- case 289 /* JSDocUndefinedKeyword */:
+ case 290 /* JSDocUndefinedKeyword */:
return undefinedType;
- case 290 /* JSDocNeverKeyword */:
+ case 291 /* JSDocNeverKeyword */:
return neverType;
case 167 /* ThisType */:
case 98 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
case 171 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 287 /* JSDocLiteralType */:
+ case 288 /* JSDocLiteralType */:
return getTypeFromLiteralTypeNode(node.literal);
case 157 /* TypeReference */:
case 272 /* JSDocTypeReference */:
@@ -29749,7 +29889,7 @@ var ts;
case 158 /* FunctionType */:
case 159 /* ConstructorType */:
case 161 /* TypeLiteral */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 274 /* JSDocFunctionType */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 168 /* TypeOperator */:
@@ -29920,6 +30060,33 @@ var ts;
return result;
}
function instantiateMappedType(type, mapper) {
+ // Check if we have an isomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some
+ // type parameter T. If so, the mapped type is distributive over a union type and when T is instantiated
+ // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for
+ // isomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a
+ // union type A | undefined, we produce { [P in keyof A]: X } | undefined.
+ var constraintType = getConstraintTypeFromMappedType(type);
+ if (constraintType.flags & 262144 /* Index */) {
+ var typeParameter_1 = constraintType.type;
+ var mappedTypeParameter = mapper(typeParameter_1);
+ if (typeParameter_1 !== mappedTypeParameter) {
+ return mapType(mappedTypeParameter, function (t) {
+ if (isMappableType(t)) {
+ var replacementMapper = createUnaryTypeMapper(typeParameter_1, t);
+ var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);
+ combinedMapper.mappedTypes = mapper.mappedTypes;
+ return instantiateMappedObjectType(type, combinedMapper);
+ }
+ return t;
+ });
+ }
+ }
+ return instantiateMappedObjectType(type, mapper);
+ }
+ function isMappableType(type) {
+ return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */);
+ }
+ function instantiateMappedObjectType(type, mapper) {
var result = createObjectType(32 /* Mapped */ | 64 /* Instantiated */, type.symbol);
result.declaration = type.declaration;
result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
@@ -30337,7 +30504,7 @@ var ts;
return false;
if (target.flags & 1 /* Any */ || source.flags & 8192 /* Never */)
return true;
- if (source.flags & 34 /* StringLike */ && target.flags & 2 /* String */)
+ if (source.flags & 262178 /* StringLike */ && target.flags & 2 /* String */)
return true;
if (source.flags & 340 /* NumberLike */ && target.flags & 4 /* Number */)
return true;
@@ -30476,12 +30643,6 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
- if (source.flags & 262144 /* Index */) {
- // A keyof T is related to a union type containing both string and number
- if (maybeTypeOfKind(target, 2 /* String */) && maybeTypeOfKind(target, 4 /* Number */)) {
- return -1 /* True */;
- }
- }
if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
@@ -30541,12 +30702,24 @@ var ts;
}
}
if (target.flags & 16384 /* TypeParameter */) {
- // Given a type parameter K with a constraint keyof T, a type S is
- // assignable to K if S is assignable to keyof T.
- var constraint = getConstraintOfTypeParameter(target);
- if (constraint && constraint.flags & 262144 /* Index */) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
- return result;
+ // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P].
+ if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
+ if (!source.declaration.questionToken) {
+ var templateType = getTemplateTypeFromMappedType(source);
+ var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
+ if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else {
+ // Given a type parameter K with a constraint keyof T, a type S is
+ // assignable to K if S is assignable to keyof T.
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144 /* Index */) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
}
}
}
@@ -30566,18 +30739,37 @@ var ts;
}
}
}
+ else if (target.flags & 524288 /* IndexedAccess */) {
+ // if we have indexed access types with identical index types, see if relationship holds for
+ // the two object types.
+ if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) {
+ if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384 /* TypeParameter */) {
- var constraint = getConstraintOfTypeParameter(source);
- if (!constraint || constraint.flags & 1 /* Any */) {
- constraint = emptyObjectType;
- }
- // The constraint may need to be further instantiated with its 'this' type.
- constraint = getTypeWithThisArgument(constraint, source);
- // Report constraint errors only if the constraint is not the empty object type
- var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
- errorInfo = saveErrorInfo;
- return result;
+ // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X.
+ if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
+ var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
+ var templateType = getTemplateTypeFromMappedType(target);
+ if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
+ return result;
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(source);
+ if (!constraint || constraint.flags & 1 /* Any */) {
+ constraint = emptyObjectType;
+ }
+ // The constraint may need to be further instantiated with its 'this' type.
+ constraint = getTypeWithThisArgument(constraint, source);
+ // Report constraint errors only if the constraint is not the empty object type
+ var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
+ if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
+ }
}
}
else {
@@ -30587,29 +30779,18 @@ var ts;
return result;
}
}
- if (isGenericMappedType(target)) {
- // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.
- if (isGenericMappedType(source)) {
- if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) &&
- (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) {
- return result;
- }
- }
- }
- else {
- // Even if relationship doesn't hold for unions, intersections, or generic type references,
- // it may hold in a structural comparison.
- var apparentSource = getApparentType(source);
- // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
- // to X. Failing both of those we want to check if the aggregation of A and B's members structurally
- // relates to X. Thus, we include intersection types on the source side here.
- if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) {
- // Report structural errors only if we haven't reported any errors yet
- var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */);
- if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
- errorInfo = saveErrorInfo;
- return result;
- }
+ // Even if relationship doesn't hold for unions, intersections, or generic type references,
+ // it may hold in a structural comparison.
+ var apparentSource = getApparentType(source);
+ // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
+ // to X. Failing both of those we want to check if the aggregation of A and B's members structurally
+ // relates to X. Thus, we include intersection types on the source side here.
+ if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) {
+ // Report structural errors only if we haven't reported any errors yet
+ var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */);
+ if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
}
}
}
@@ -30832,6 +31013,9 @@ var ts;
if (expandingFlags === 3) {
result = 1 /* Maybe */;
}
+ else if (isGenericMappedType(source) || isGenericMappedType(target)) {
+ result = mappedTypeRelatedTo(source, target, reportErrors);
+ }
else {
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
@@ -30862,6 +31046,34 @@ var ts;
}
return result;
}
+ // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.
+ function mappedTypeRelatedTo(source, target, reportErrors) {
+ if (isGenericMappedType(target)) {
+ if (isGenericMappedType(source)) {
+ var result_2;
+ if (relation === identityRelation) {
+ var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;
+ var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;
+ if (readonlyMatches && optionalMatches) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ else {
+ if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ }
+ }
+ else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {
+ return -1 /* True */;
+ }
+ return 0 /* False */;
+ }
function propertiesRelatedTo(source, target, reportErrors) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target);
@@ -31401,7 +31613,7 @@ var ts;
return type;
}
var types = [type];
- if (flags & 34 /* StringLike */)
+ if (flags & 262178 /* StringLike */)
types.push(emptyStringType);
if (flags & 340 /* NumberLike */)
types.push(zeroType);
@@ -31791,19 +32003,6 @@ var ts;
}
}
else {
- if (getObjectFlags(target) & 32 /* Mapped */) {
- var constraintType = getConstraintTypeFromMappedType(target);
- if (getObjectFlags(source) & 32 /* Mapped */) {
- inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
- return;
- }
- if (constraintType.flags & 16384 /* TypeParameter */) {
- inferFromTypes(getIndexType(source), constraintType);
- inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
- return;
- }
- }
source = getApparentType(source);
if (source.flags & 32768 /* Object */) {
if (isInProcess(source, target)) {
@@ -31824,14 +32023,30 @@ var ts;
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
- inferFromProperties(source, target);
- inferFromSignatures(source, target, 0 /* Call */);
- inferFromSignatures(source, target, 1 /* Construct */);
- inferFromIndexTypes(source, target);
+ inferFromObjectTypes(source, target);
depth--;
}
}
}
+ function inferFromObjectTypes(source, target) {
+ if (getObjectFlags(target) & 32 /* Mapped */) {
+ var constraintType = getConstraintTypeFromMappedType(target);
+ if (getObjectFlags(source) & 32 /* Mapped */) {
+ inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ if (constraintType.flags & 16384 /* TypeParameter */) {
+ inferFromTypes(getIndexType(source), constraintType);
+ inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ }
+ inferFromProperties(source, target);
+ inferFromSignatures(source, target, 0 /* Call */);
+ inferFromSignatures(source, target, 1 /* Construct */);
+ inferFromIndexTypes(source, target);
+ }
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
@@ -32200,7 +32415,7 @@ var ts;
}
function getTypeWithDefault(type, defaultExpression) {
if (defaultExpression) {
- var defaultType = checkExpression(defaultExpression);
+ var defaultType = getTypeOfExpression(defaultExpression);
return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]);
}
return type;
@@ -32223,7 +32438,7 @@ var ts;
function getAssignedTypeOfBinaryExpression(node) {
return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ?
getTypeWithDefault(getAssignedType(node), node.right) :
- checkExpression(node.right);
+ getTypeOfExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
@@ -32274,7 +32489,7 @@ var ts;
// from its initializer, we'll already have cached the type. Otherwise we compute it now
// without caching such that transient types are reflected.
var links = getNodeLinks(node);
- return links.resolvedType || checkExpression(node);
+ return links.resolvedType || getTypeOfExpression(node);
}
function getInitialTypeOfVariableDeclaration(node) {
if (node.initializer) {
@@ -32327,7 +32542,7 @@ var ts;
}
function getTypeOfSwitchClause(clause) {
if (clause.kind === 253 /* CaseClause */) {
- var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
+ var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@@ -32419,7 +32634,7 @@ var ts;
// we defer subtype reduction until the evolving array type is finalized into a manifest
// array type.
function addEvolvingArrayElementType(evolvingArrayType, node) {
- var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
}
function createFinalArrayType(elementType) {
@@ -32473,7 +32688,7 @@ var ts;
parent.parent.operatorToken.kind === 57 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
- isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */);
+ isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */);
return isLengthPushOrUnshift || isElementAssignment;
}
function maybeTypePredicateCall(node) {
@@ -32630,7 +32845,7 @@ var ts;
}
}
else {
- var indexType = checkExpression(node.left.argumentExpression);
+ var indexType = getTypeOfExpression(node.left.argumentExpression);
if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) {
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
}
@@ -32848,7 +33063,7 @@ var ts;
if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) {
assumeTrue = !assumeTrue;
}
- var valueType = checkExpression(value);
+ var valueType = getTypeOfExpression(value);
if (valueType.flags & 6144 /* Nullable */) {
if (!strictNullChecks) {
return type;
@@ -32930,7 +33145,7 @@ var ts;
return type;
}
// Check that right operand is a function type with a prototype property
- var rightType = checkExpression(expr.right);
+ var rightType = getTypeOfExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
@@ -32961,18 +33176,18 @@ var ts;
}
}
if (targetType) {
- return getNarrowedType(type, targetType, assumeTrue);
+ return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);
}
return type;
}
- function getNarrowedType(type, candidate, assumeTrue) {
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
if (!assumeTrue) {
- return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); });
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
}
// If the current type is a union type, remove all constituents that couldn't be instances of
// the candidate type. If one or more constituents remain, return a union of those.
if (type.flags & 65536 /* Union */) {
- var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); });
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
if (!(assignableType.flags & 8192 /* Never */)) {
return assignableType;
}
@@ -33005,7 +33220,7 @@ var ts;
var predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, predicateArgument)) {
return declaredType;
@@ -33018,7 +33233,7 @@ var ts;
var accessExpression = invokedExpression;
var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, possibleReference)) {
return declaredType;
@@ -33060,7 +33275,7 @@ var ts;
location = location.parent;
}
if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {
- var type = checkExpression(location);
+ var type = getTypeOfExpression(location);
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
return type;
}
@@ -33473,9 +33688,9 @@ var ts;
return anyType;
}
function getTypeForThisExpressionFromJSDoc(node) {
- var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274 /* JSDocFunctionType */) {
- var jsDocFunctionType = typeTag.typeExpression.type;
+ var jsdocType = ts.getJSDocType(node);
+ if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) {
+ var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
@@ -33745,11 +33960,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_20 = declaration.propertyName || declaration.name;
+ var name_19 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_20)) {
- var text = ts.getTextOfPropertyName(name_20);
+ !ts.isBindingPattern(name_19)) {
+ var text = ts.getTextOfPropertyName(name_19);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -33835,7 +34050,7 @@ var ts;
}
// In an assignment expression, the right operand is contextually typed by the type of the left operand.
if (node === binaryExpression.right) {
- return checkExpression(binaryExpression.left);
+ return getTypeOfExpression(binaryExpression.left);
}
}
else if (operator === 53 /* BarBarToken */) {
@@ -33843,7 +34058,7 @@ var ts;
// expression has no contextual type, the right operand is contextually typed by the type of the left operand.
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
- type = checkExpression(binaryExpression.left);
+ type = getTypeOfExpression(binaryExpression.left);
}
return type;
}
@@ -34261,7 +34476,7 @@ var ts;
links.resolvedType = checkExpression(node.expression);
// This will allow types number, string, symbol or any. It will also allow enums, the unknown
// type, and any union of these types (like string | number).
- if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 34 /* StringLike */ | 512 /* ESSymbol */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 262178 /* StringLike */ | 512 /* ESSymbol */)) {
error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
@@ -34270,10 +34485,10 @@ var ts;
}
return links.resolvedType;
}
- function getObjectLiteralIndexInfo(node, properties, kind) {
+ function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {
var propTypes = [];
for (var i = 0; i < properties.length; i++) {
- if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) {
+ if (kind === 0 /* String */ || isNumericName(propertyNodes[i + offset].name)) {
propTypes.push(getTypeOfSymbol(properties[i]));
}
}
@@ -34295,8 +34510,9 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var memberDecl = _a[_i];
+ var offset = 0;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
var member = memberDecl.symbol;
if (memberDecl.kind === 257 /* PropertyAssignment */ ||
memberDecl.kind === 258 /* ShorthandPropertyAssignment */ ||
@@ -34361,6 +34577,7 @@ var ts;
return unknownType;
}
spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);
+ offset = i + 1;
continue;
}
else {
@@ -34388,8 +34605,8 @@ var ts;
// If object literal is contextually typed by the implied type of a binding pattern, augment the result
// type with those properties for which the binding pattern specifies a default value.
if (contextualTypeHasPattern) {
- for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) {
- var prop = _c[_b];
+ for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {
+ var prop = _a[_i];
if (!propertiesTable[prop.name]) {
if (!(prop.flags & 536870912 /* Optional */)) {
error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
@@ -34409,8 +34626,8 @@ var ts;
}
return createObjectLiteralType();
function createObjectLiteralType() {
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined;
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined;
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */;
result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);
@@ -35085,7 +35302,7 @@ var ts;
if (node.kind === 212 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
- hasNumericPropertyNames(checkExpression(node.expression))) {
+ hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
return true;
}
child = node;
@@ -35191,13 +35408,13 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_9 = signature.declaration && signature.declaration.parent;
+ var parent_8 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_9 === lastParent) {
+ if (lastParent && parent_8 === lastParent) {
index++;
}
else {
- lastParent = parent_9;
+ lastParent = parent_8;
index = cutoffIndex;
}
}
@@ -35205,7 +35422,7 @@ var ts;
// current declaration belongs to a different symbol
// set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex
index = cutoffIndex = result.length;
- lastParent = parent_9;
+ lastParent = parent_8;
}
lastSymbol = symbol;
// specialized signatures always need to be placed before non-specialized signatures regardless
@@ -36537,7 +36754,7 @@ var ts;
if (!node.possiblyExhaustive) {
return false;
}
- var type = checkExpression(node.expression);
+ var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
return false;
}
@@ -36944,10 +37161,10 @@ var ts;
// The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,
// and the right operand to be of type Any, an object type, or a type parameter type.
// The result is always of the Boolean primitive type.
- if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
+ if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) {
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) {
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -36956,20 +37173,21 @@ var ts;
var properties = node.properties;
for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
+ /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {
if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) {
- var name_21 = property.name;
- if (name_21.kind === 142 /* ComputedPropertyName */) {
- checkComputedPropertyName(name_21);
+ var name_20 = property.name;
+ if (name_20.kind === 142 /* ComputedPropertyName */) {
+ checkComputedPropertyName(name_20);
}
- if (isComputedNonLiteralName(name_21)) {
+ if (isComputedNonLiteralName(name_20)) {
return undefined;
}
- var text = ts.getTextOfPropertyName(name_21);
+ var text = ts.getTextOfPropertyName(name_20);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -36985,13 +37203,18 @@ var ts;
}
}
else {
- error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21));
+ error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));
}
}
else if (property.kind === 259 /* SpreadAssignment */) {
- if (property.expression.kind !== 70 /* Identifier */) {
- error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier);
+ var nonRestNames = [];
+ if (allProperties) {
+ for (var i = 0; i < allProperties.length - 1; i++) {
+ nonRestNames.push(allProperties[i].name);
+ }
}
+ var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
+ return checkDestructuringAssignment(property.expression, type);
}
else {
error(property, ts.Diagnostics.Property_assignment_expected);
@@ -37083,7 +37306,10 @@ var ts;
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ var error = target.parent.kind === 259 /* SpreadAssignment */ ?
+ ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
+ ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
+ if (checkReferenceExpression(target, error)) {
checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined);
}
return sourceType;
@@ -37246,7 +37472,7 @@ var ts;
resultType = numberType;
}
else {
- if (isTypeOfKind(leftType, 34 /* StringLike */) || isTypeOfKind(rightType, 34 /* StringLike */)) {
+ if (isTypeOfKind(leftType, 262178 /* StringLike */) || isTypeOfKind(rightType, 262178 /* StringLike */)) {
// If one or both operands are of the String primitive type, the result is of the String primitive type.
resultType = stringType;
}
@@ -37273,6 +37499,8 @@ var ts;
case 29 /* LessThanEqualsToken */:
case 30 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
+ leftType = getBaseTypeOfLiteralType(leftType);
+ rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -37469,7 +37697,7 @@ var ts;
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ ||
- ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ ||
+ ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) ||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
}
function isLiteralContextualType(contextualType) {
@@ -37484,7 +37712,7 @@ var ts;
}
contextualType = apparentType;
}
- return maybeTypeOfKind(contextualType, 480 /* Literal */);
+ return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */));
}
return false;
}
@@ -37528,6 +37756,23 @@ var ts;
}
return type;
}
+ // Returns the type of an expression. Unlike checkExpression, this function is simply concerned
+ // with computing the type and may not fully check all contained sub-expressions for errors.
+ function getTypeOfExpression(node) {
+ // Optimize for the common case of a call to a function with a single non-generic call
+ // signature where we can just fetch the return type without checking the arguments.
+ if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) {
+ var funcType = checkNonNullExpression(node.expression);
+ var signature = getSingleCallSignature(funcType);
+ if (signature && !signature.typeParameters) {
+ return getReturnTypeOfSignature(signature);
+ }
+ }
+ // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions
+ // should have a parameter that indicates whether full error checking is required such that
+ // we can perform the optimizations locally.
+ return checkExpression(node);
+ }
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
// contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
// expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in
@@ -37730,9 +37975,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_22 = _a[_i].name;
- if (ts.isBindingPattern(name_22) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) {
+ var name_21 = _a[_i].name;
+ if (ts.isBindingPattern(name_21) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -37752,9 +37997,9 @@ var ts;
case 158 /* FunctionType */:
case 149 /* MethodDeclaration */:
case 148 /* MethodSignature */:
- var parent_10 = node.parent;
- if (node === parent_10.type) {
- return parent_10;
+ var parent_9 = node.parent;
+ if (node === parent_9.type) {
+ return parent_9;
}
}
}
@@ -37764,15 +38009,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_23 = element.name;
- if (name_23.kind === 70 /* Identifier */ &&
- name_23.text === predicateVariableName) {
+ var name_22 = element.name;
+ if (name_22.kind === 70 /* Identifier */ &&
+ name_22.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_23.kind === 173 /* ArrayBindingPattern */ ||
- name_23.kind === 172 /* ObjectBindingPattern */) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) {
+ else if (name_22.kind === 173 /* ArrayBindingPattern */ ||
+ name_22.kind === 172 /* ObjectBindingPattern */) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -38040,8 +38285,8 @@ var ts;
if (superCallShouldBeFirst) {
var statements = node.body.statements;
var superCallStatement = void 0;
- for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
- var statement = statements_2[_i];
+ for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
+ var statement = statements_3[_i];
if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
@@ -38194,7 +38439,7 @@ var ts;
var type = getTypeFromMappedTypeNode(node);
var constraintType = getConstraintTypeFromMappedType(type);
var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
- checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint);
+ checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
}
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node);
@@ -38475,10 +38720,10 @@ var ts;
case 229 /* EnumDeclaration */:
return 2097152 /* ExportType */ | 1048576 /* ExportValue */;
case 234 /* ImportEqualsDeclaration */:
- var result_2 = 0;
+ var result_3 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
- return result_2;
+ ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });
+ return result_3;
default:
return 1048576 /* ExportValue */;
}
@@ -39211,8 +39456,8 @@ var ts;
// otherwise if variable has an initializer - show error that initialization will fail
// since LHS will be block scoped name instead of function scoped
if (!namesShareScope) {
- var name_24 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24);
+ var name_23 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);
}
}
}
@@ -39303,13 +39548,13 @@ var ts;
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
- var parent_11 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_11);
- var name_25 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25));
+ var parent_10 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_10);
+ var name_24 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24));
markPropertyAsReferenced(property);
- if (parent_11.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property);
+ if (parent_10.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);
}
}
// For a binding pattern, check contained binding elements
@@ -39501,6 +39746,7 @@ var ts;
function checkForInStatement(node) {
// Grammar checking
checkGrammarForInOrForOfStatement(node);
+ var rightType = checkNonNullExpression(node.expression);
// TypeScript 1.0 spec (April 2014): 5.4
// In a 'for-in' statement of the form
// for (let VarDecl in Expr) Statement
@@ -39523,7 +39769,7 @@ var ts;
if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
- else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */)) {
+ else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
@@ -39531,10 +39777,9 @@ var ts;
checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
- var rightType = checkNonNullExpression(node.expression);
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
// in this case error about missing name is already reported - do not report extra one
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) {
error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
checkSourceElement(node.statement);
@@ -39724,12 +39969,12 @@ var ts;
// After we remove all types that are StringLike, we will know if there was a string constituent
// based on whether the result of filter is a new array.
var arrayTypes = arrayOrStringType.types;
- var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34 /* StringLike */); });
+ var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); });
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true);
}
}
- else if (arrayOrStringType.flags & 34 /* StringLike */) {
+ else if (arrayOrStringType.flags & 262178 /* StringLike */) {
arrayType = neverType;
}
var hasStringConstituent = arrayOrStringType !== arrayType;
@@ -39761,7 +40006,7 @@ var ts;
var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType;
if (hasStringConstituent) {
// This is just an optimization for the case where arrayOrStringType is string | string[]
- if (arrayElementType.flags & 34 /* StringLike */) {
+ if (arrayElementType.flags & 262178 /* StringLike */) {
return stringType;
}
return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true);
@@ -40532,7 +40777,7 @@ var ts;
return undefined;
}
}
- enumType_1 = checkExpression(expression);
+ enumType_1 = getTypeOfExpression(expression);
// allow references to constant members of other enums
if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) {
return undefined;
@@ -40753,9 +40998,9 @@ var ts;
break;
case 174 /* BindingElement */:
case 223 /* VariableDeclaration */:
- var name_26 = node.name;
- if (ts.isBindingPattern(name_26)) {
- for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) {
+ var name_25 = node.name;
+ if (ts.isBindingPattern(name_25)) {
+ for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {
var el = _c[_b];
// mark individual names in binding pattern
checkModuleAugmentationElement(el, isGlobalAugmentation);
@@ -41587,7 +41832,7 @@ var ts;
}
// fallthrough
case 96 /* SuperKeyword */:
- var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
+ var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case 167 /* ThisType */:
return getTypeFromTypeNode(node).symbol;
@@ -41613,7 +41858,7 @@ var ts;
case 8 /* NumericLiteral */:
// index access
if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) {
- var objectType = checkExpression(node.parent.expression);
+ var objectType = getTypeOfExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
var apparentType = getApparentType(objectType);
@@ -41649,7 +41894,7 @@ var ts;
return getTypeFromTypeNode(node);
}
if (ts.isPartOfExpression(node)) {
- return getTypeOfExpression(node);
+ return getRegularTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
// A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the
@@ -41702,7 +41947,7 @@ var ts;
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
if (expr.parent.kind === 192 /* BinaryExpression */) {
- var iteratedType = checkExpression(expr.parent.right);
+ var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
// If this is from nested object binding pattern
@@ -41729,11 +41974,11 @@ var ts;
var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);
}
- function getTypeOfExpression(expr) {
+ function getRegularTypeOfExpression(expr) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
- return getRegularTypeOfLiteralType(checkExpression(expr));
+ return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
/**
* Gets either the static or instance type of a class element, based on
@@ -41762,9 +42007,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456 /* SyntheticProperty */) {
var symbols_3 = [];
- var name_27 = symbol.name;
+ var name_26 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_27);
+ var symbol = getPropertyOfType(t, name_26);
if (symbol) {
symbols_3.push(symbol);
}
@@ -41823,7 +42068,7 @@ var ts;
}
function isNameOfModuleOrEnumDeclaration(node) {
var parent = node.parent;
- return ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
+ return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
}
// When resolved as an expression identifier, if the given node references an exported entity, return the declaration
// node of the exported entity's container. Otherwise, return undefined.
@@ -42084,7 +42329,7 @@ var ts;
else if (isTypeOfKind(type, 340 /* NumberLike */)) {
return ts.TypeReferenceSerializationKind.NumberLikeType;
}
- else if (isTypeOfKind(type, 34 /* StringLike */)) {
+ else if (isTypeOfKind(type, 262178 /* StringLike */)) {
return ts.TypeReferenceSerializationKind.StringLikeType;
}
else if (isTupleType(type)) {
@@ -42116,7 +42361,7 @@ var ts;
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
}
function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {
- var type = getWidenedType(getTypeOfExpression(expr));
+ var type = getWidenedType(getRegularTypeOfExpression(expr));
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
}
function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {
@@ -42137,9 +42382,9 @@ var ts;
if (startInDeclarationContainer) {
// When resolving the name of a declaration as a value, we need to start resolution
// at a point outside of the declaration.
- var parent_12 = reference.parent;
- if (ts.isDeclaration(parent_12) && reference === parent_12.name) {
- location = getDeclarationContainer(parent_12);
+ var parent_11 = reference.parent;
+ if (ts.isDeclaration(parent_11) && reference === parent_11.name) {
+ location = getDeclarationContainer(parent_11);
}
}
return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
@@ -42268,9 +42513,9 @@ var ts;
// external modules cannot define or contribute to type declaration files
var current = symbol;
while (true) {
- var parent_13 = getParentOfSymbol(current);
- if (parent_13) {
- current = parent_13;
+ var parent_12 = getParentOfSymbol(current);
+ if (parent_12) {
+ current = parent_12;
}
else {
break;
@@ -42973,10 +43218,10 @@ var ts;
if (prop.kind === 259 /* SpreadAssignment */) {
continue;
}
- var name_28 = prop.name;
- if (name_28.kind === 142 /* ComputedPropertyName */) {
+ var name_27 = prop.name;
+ if (name_27.kind === 142 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
- checkGrammarComputedPropertyName(name_28);
+ checkGrammarComputedPropertyName(name_27);
}
if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
@@ -43004,8 +43249,8 @@ var ts;
if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) {
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_28.kind === 8 /* NumericLiteral */) {
- checkGrammarNumericLiteral(name_28);
+ if (name_27.kind === 8 /* NumericLiteral */) {
+ checkGrammarNumericLiteral(name_27);
}
currentKind = Property;
}
@@ -43021,7 +43266,7 @@ var ts;
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27);
if (effectiveName === undefined) {
continue;
}
@@ -43031,18 +43276,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));
+ grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -43055,12 +43300,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_29 = jsxAttr.name;
- if (!seen[name_29.text]) {
- seen[name_29.text] = true;
+ var name_28 = jsxAttr.name;
+ if (!seen[name_28.text]) {
+ seen[name_28.text] = true;
}
else {
- return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) {
@@ -43577,19 +43822,24 @@ var ts;
function reduceNode(node, f, initial) {
return node ? f(initial, node) : initial;
}
+ function reduceNodeArray(nodes, f, initial) {
+ return nodes ? f(initial, nodes) : initial;
+ }
/**
* Similar to `reduceLeft`, performs a reduction against each child of a node.
* NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the
* `nodeEdgeTraversalMap` above will be visited.
*
* @param node The node containing the children to reduce.
- * @param f The callback function
* @param initial The initial value to supply to the reduction.
+ * @param f The callback function
*/
- function reduceEachChild(node, f, initial) {
+ function reduceEachChild(node, initial, cbNode, cbNodeArray) {
if (node === undefined) {
return initial;
}
+ var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
+ var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {
@@ -43606,114 +43856,114 @@ var ts;
case 206 /* EmptyStatement */:
case 198 /* OmittedExpression */:
case 222 /* DebuggerStatement */:
- case 292 /* NotEmittedStatement */:
+ case 293 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
case 142 /* ComputedPropertyName */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
case 144 /* Parameter */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 145 /* Decorator */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Type member
case 147 /* PropertyDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 149 /* MethodDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 150 /* Constructor */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 151 /* GetAccessor */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 152 /* SetAccessor */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
case 172 /* ObjectBindingPattern */:
case 173 /* ArrayBindingPattern */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 174 /* BindingElement */:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
case 175 /* ArrayLiteralExpression */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 176 /* ObjectLiteralExpression */:
- result = ts.reduceLeft(node.properties, f, result);
+ result = reduceNodes(node.properties, cbNodes, result);
break;
case 177 /* PropertyAccessExpression */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 178 /* ElementAccessExpression */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.argumentExpression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.argumentExpression, cbNode, result);
break;
case 179 /* CallExpression */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 180 /* NewExpression */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 181 /* TaggedTemplateExpression */:
- result = reduceNode(node.tag, f, result);
- result = reduceNode(node.template, f, result);
+ result = reduceNode(node.tag, cbNode, result);
+ result = reduceNode(node.template, cbNode, result);
break;
case 184 /* FunctionExpression */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 185 /* ArrowFunction */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 183 /* ParenthesizedExpression */:
case 186 /* DeleteExpression */:
@@ -43723,212 +43973,212 @@ var ts;
case 195 /* YieldExpression */:
case 196 /* SpreadElement */:
case 201 /* NonNullExpression */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 190 /* PrefixUnaryExpression */:
case 191 /* PostfixUnaryExpression */:
- result = reduceNode(node.operand, f, result);
+ result = reduceNode(node.operand, cbNode, result);
break;
case 192 /* BinaryExpression */:
- result = reduceNode(node.left, f, result);
- result = reduceNode(node.right, f, result);
+ result = reduceNode(node.left, cbNode, result);
+ result = reduceNode(node.right, cbNode, result);
break;
case 193 /* ConditionalExpression */:
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.whenTrue, f, result);
- result = reduceNode(node.whenFalse, f, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.whenTrue, cbNode, result);
+ result = reduceNode(node.whenFalse, cbNode, result);
break;
case 194 /* TemplateExpression */:
- result = reduceNode(node.head, f, result);
- result = ts.reduceLeft(node.templateSpans, f, result);
+ result = reduceNode(node.head, cbNode, result);
+ result = reduceNodes(node.templateSpans, cbNodes, result);
break;
case 197 /* ClassExpression */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 199 /* ExpressionWithTypeArguments */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
break;
// Misc
case 202 /* TemplateSpan */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.literal, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.literal, cbNode, result);
break;
// Element
case 204 /* Block */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 205 /* VariableStatement */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.declarationList, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.declarationList, cbNode, result);
break;
case 207 /* ExpressionStatement */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 208 /* IfStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.thenStatement, f, result);
- result = reduceNode(node.elseStatement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.thenStatement, cbNode, result);
+ result = reduceNode(node.elseStatement, cbNode, result);
break;
case 209 /* DoStatement */:
- result = reduceNode(node.statement, f, result);
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.statement, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 210 /* WhileStatement */:
case 217 /* WithStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 211 /* ForStatement */:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.incrementor, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.incrementor, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 212 /* ForInStatement */:
case 213 /* ForOfStatement */:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 216 /* ReturnStatement */:
case 220 /* ThrowStatement */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 218 /* SwitchStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.caseBlock, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.caseBlock, cbNode, result);
break;
case 219 /* LabeledStatement */:
- result = reduceNode(node.label, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.label, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 221 /* TryStatement */:
- result = reduceNode(node.tryBlock, f, result);
- result = reduceNode(node.catchClause, f, result);
- result = reduceNode(node.finallyBlock, f, result);
+ result = reduceNode(node.tryBlock, cbNode, result);
+ result = reduceNode(node.catchClause, cbNode, result);
+ result = reduceNode(node.finallyBlock, cbNode, result);
break;
case 223 /* VariableDeclaration */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 224 /* VariableDeclarationList */:
- result = ts.reduceLeft(node.declarations, f, result);
+ result = reduceNodes(node.declarations, cbNodes, result);
break;
case 225 /* FunctionDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 226 /* ClassDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 232 /* CaseBlock */:
- result = ts.reduceLeft(node.clauses, f, result);
+ result = reduceNodes(node.clauses, cbNodes, result);
break;
case 235 /* ImportDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.importClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.importClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 236 /* ImportClause */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 237 /* NamespaceImport */:
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 238 /* NamedImports */:
case 242 /* NamedExports */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 239 /* ImportSpecifier */:
case 243 /* ExportSpecifier */:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 240 /* ExportAssignment */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.expression, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 241 /* ExportDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.exportClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.exportClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// JSX
case 246 /* JsxElement */:
- result = reduceNode(node.openingElement, f, result);
- result = ts.reduceLeft(node.children, f, result);
- result = reduceNode(node.closingElement, f, result);
+ result = reduceNode(node.openingElement, cbNode, result);
+ result = ts.reduceLeft(node.children, cbNode, result);
+ result = reduceNode(node.closingElement, cbNode, result);
break;
case 247 /* JsxSelfClosingElement */:
case 248 /* JsxOpeningElement */:
- result = reduceNode(node.tagName, f, result);
- result = ts.reduceLeft(node.attributes, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
+ result = reduceNodes(node.attributes, cbNodes, result);
break;
case 249 /* JsxClosingElement */:
- result = reduceNode(node.tagName, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
break;
case 250 /* JsxAttribute */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 251 /* JsxSpreadAttribute */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 252 /* JsxExpression */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
case 253 /* CaseClause */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
// fall-through
case 254 /* DefaultClause */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 255 /* HeritageClause */:
- result = ts.reduceLeft(node.types, f, result);
+ result = reduceNodes(node.types, cbNodes, result);
break;
case 256 /* CatchClause */:
- result = reduceNode(node.variableDeclaration, f, result);
- result = reduceNode(node.block, f, result);
+ result = reduceNode(node.variableDeclaration, cbNode, result);
+ result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
case 257 /* PropertyAssignment */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 258 /* ShorthandPropertyAssignment */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.objectAssignmentInitializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
case 259 /* SpreadAssignment */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Top-level nodes
case 261 /* SourceFile */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
- case 293 /* PartiallyEmittedExpression */:
- result = reduceNode(node.expression, f, result);
+ case 294 /* PartiallyEmittedExpression */:
+ result = reduceNode(node.expression, cbNode, result);
break;
default:
var edgeTraversalPath = nodeEdgeTraversalMap[kind];
@@ -43938,8 +44188,8 @@ var ts;
var value = node[edge.name];
if (value !== undefined) {
result = ts.isArray(value)
- ? ts.reduceLeft(value, f, result)
- : f(result, value);
+ ? reduceNodes(value, cbNodes, result)
+ : cbNode(result, value);
}
}
}
@@ -43949,8 +44199,8 @@ var ts;
}
ts.reduceEachChild = reduceEachChild;
function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {
- if (node === undefined) {
- return undefined;
+ if (node === undefined || visitor === undefined) {
+ return node;
}
aggregateTransformFlags(node);
var visited = visitor(node);
@@ -44034,6 +44284,43 @@ var ts;
return updated || nodes;
}
ts.visitNodes = visitNodes;
+ /**
+ * Starts a new lexical environment and visits a statement list, ending the lexical environment
+ * and merging hoisted declarations upon completion.
+ */
+ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
+ context.startLexicalEnvironment();
+ statements = visitNodes(statements, visitor, ts.isStatement, start);
+ if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
+ statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements);
+ }
+ var declarations = context.endLexicalEnvironment();
+ return ts.createNodeArray(ts.concatenate(statements, declarations), statements);
+ }
+ ts.visitLexicalEnvironment = visitLexicalEnvironment;
+ /**
+ * Starts a new lexical environment and visits a parameter list, suspending the lexical
+ * environment upon completion.
+ */
+ function visitParameterList(nodes, visitor, context) {
+ context.startLexicalEnvironment();
+ var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);
+ context.suspendLexicalEnvironment();
+ return updated;
+ }
+ ts.visitParameterList = visitParameterList;
+ function visitFunctionBody(node, visitor, context) {
+ context.resumeLexicalEnvironment();
+ var updated = visitNode(node, visitor, ts.isConciseBody);
+ var declarations = context.endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(updated);
+ var statements = mergeLexicalEnvironment(block.statements, declarations);
+ return ts.updateBlock(block, statements);
+ }
+ return updated;
+ }
+ ts.visitFunctionBody = visitFunctionBody;
function visitEachChild(node, visitor, context) {
if (node === undefined) {
return undefined;
@@ -44059,25 +44346,25 @@ var ts;
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
case 144 /* Parameter */:
- return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Type member
case 147 /* PropertyDeclaration */:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
case 149 /* MethodDeclaration */:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 150 /* Constructor */:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 151 /* GetAccessor */:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 152 /* SetAccessor */:
- return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
// Binding patterns
case 172 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 173 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 174 /* BindingElement */:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
+ return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Expression
case 175 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
@@ -44096,9 +44383,9 @@ var ts;
case 183 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 184 /* FunctionExpression */:
- return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 185 /* ArrowFunction */:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 186 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 187 /* TypeOfExpression */:
@@ -44168,7 +44455,7 @@ var ts;
case 224 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 225 /* FunctionDeclaration */:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 226 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
case 232 /* CaseBlock */:
@@ -44224,10 +44511,9 @@ var ts;
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Top-level nodes
case 261 /* SourceFile */:
- context.startLexicalEnvironment();
- return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
+ return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -44256,6 +44542,15 @@ var ts;
// return node;
}
ts.visitEachChild = visitEachChild;
+ function mergeLexicalEnvironment(statements, declarations) {
+ if (!ts.some(declarations)) {
+ return statements;
+ }
+ return ts.isNodeArray(statements)
+ ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)
+ : ts.addRange(statements, declarations);
+ }
+ ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function mergeFunctionBodyLexicalEnvironment(body, declarations) {
if (body && declarations !== undefined && declarations.length > 0) {
if (ts.isBlock(body)) {
@@ -44308,13 +44603,25 @@ var ts;
if (node === undefined) {
return 0 /* None */;
}
- else if (node.transformFlags & 536870912 /* HasComputedFlags */) {
+ if (node.transformFlags & 536870912 /* HasComputedFlags */) {
return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);
}
- else {
- var subtreeFlags = aggregateTransformFlagsForSubtree(node);
- return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ var subtreeFlags = aggregateTransformFlagsForSubtree(node);
+ return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ }
+ function aggregateTransformFlagsForNodeArray(nodes) {
+ if (nodes === undefined) {
+ return 0 /* None */;
+ }
+ var subtreeFlags = 0 /* None */;
+ var nodeArrayFlags = 0 /* None */;
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
+ var node = nodes_3[_i];
+ subtreeFlags |= aggregateTransformFlagsForNode(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;
}
+ nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;
+ return subtreeFlags;
}
/**
* Aggregates the transform flags for the subtree of a node.
@@ -44326,14 +44633,17 @@ var ts;
return 0 /* None */;
}
// Aggregate the transform flags of each child.
- return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0 /* None */);
+ return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
}
/**
* Aggregates the TransformFlags of a child node with the TransformFlags of its
* siblings.
*/
- function aggregateTransformFlagsForChildNode(transformFlags, child) {
- return transformFlags | aggregateTransformFlagsForNode(child);
+ function aggregateTransformFlagsForChildNode(transformFlags, node) {
+ return transformFlags | aggregateTransformFlagsForNode(node);
+ }
+ function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
+ return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
var Debug;
(function (Debug) {
@@ -44343,9 +44653,21 @@ var ts;
Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
: ts.noop;
+ Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
: ts.noop;
+ Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
+ Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); }
+ : ts.noop;
+ Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); }
+ : ts.noop;
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -44367,504 +44689,348 @@ var ts;
/*@internal*/
var ts;
(function (ts) {
+ var FlattenLevel;
+ (function (FlattenLevel) {
+ FlattenLevel[FlattenLevel["All"] = 0] = "All";
+ FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest";
+ })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {}));
/**
- * Flattens a destructuring assignment expression.
+ * Flattens a DestructuringAssignment or a VariableDeclaration to an expression.
*
- * @param root The destructuring assignment expression.
- * @param needsValue Indicates whether the value from the right-hand-side of the
- * destructuring assignment is needed as part of a larger expression.
- * @param recordTempVariable A callback used to record new temporary variables.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param node The node to flatten.
+ * @param visitor An optional visitor used to visit initializers.
+ * @param context The transformation context.
+ * @param level Indicates the extent to which flattening should occur.
+ * @param needsValue An optional value indicating whether the value from the right-hand-side of
+ * the destructuring assignment is needed as part of a larger expression.
+ * @param createAssignmentCallback An optional callback used to create the assignment expression.
*/
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
- if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
- var right = node.right;
- if (ts.isDestructuringAssignment(right)) {
- return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor);
- }
- else {
- return node.right;
- }
- }
+ function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
var location = node;
- var value = node.right;
- var expressions = [];
- if (needsValue) {
- // If the right-hand value of the destructuring assignment needs to be preserved (as
- // is the case when the destructuring assignmen) is part of a larger expression),
- // then we need to cache the right-hand value.
- //
- // The source map location for the assignment should point to the entire binary
- // expression.
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment, visitor);
+ var value;
+ if (ts.isDestructuringAssignment(node)) {
+ value = node.right;
+ while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
+ if (ts.isDestructuringAssignment(value)) {
+ location = node = value;
+ value = node.right;
+ }
+ else {
+ return value;
+ }
+ }
}
- else if (ts.nodeIsSynthesized(node)) {
- // Generally, the source map location for a destructuring assignment is the root
- // expression.
- //
- // However, if the root expression is synthesized (as in the case
- // of the initializer when transforming a ForOfStatement), then the source map
- // location should point to the right-hand value of the expression.
- location = value;
+ var expressions;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: true,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,
+ createArrayBindingOrAssignmentElement: makeAssignmentElement,
+ visitor: visitor
+ };
+ if (value) {
+ value = ts.visitNode(value, visitor, ts.isExpression);
+ if (needsValue) {
+ // If the right-hand value of the destructuring assignment needs to be preserved (as
+ // is the case when the destructuring assignment is part of a larger expression),
+ // then we need to cache the right-hand value.
+ //
+ // The source map location for the assignment should point to the entire binary
+ // expression.
+ value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);
+ }
+ else if (ts.nodeIsSynthesized(node)) {
+ // Generally, the source map location for a destructuring assignment is the root
+ // expression.
+ //
+ // However, if the root expression is synthesized (as in the case
+ // of the initializer when transforming a ForOfStatement), then the source map
+ // location should point to the right-hand value of the expression.
+ location = value;
+ }
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- if (needsValue) {
+ flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node));
+ if (value && needsValue) {
+ if (!ts.some(expressions)) {
+ return value;
+ }
expressions.push(value);
}
- var expression = ts.inlineExpressions(expressions);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location) {
- var expression = ts.createAssignment(name, value, location);
+ return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();
+ function emitExpression(expression) {
// NOTE: this completely disables source maps, but aligns with the behavior of
// `emitAssignment` in the old emitter.
- ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */);
+ ts.setEmitFlags(expression, 64 /* NoNestedSourceMaps */);
ts.aggregateTransformFlags(expression);
- expressions.push(expression);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitAssignment(name, value, location);
- return name;
+ expressions = ts.append(expressions, expression);
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectLiteral(elements), value, location);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(target, value, location)
+ : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);
+ expression.original = original;
+ emitExpression(expression);
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
/**
- * Flattens binding patterns in a parameter declaration.
+ * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations.
*
- * @param node The ParameterDeclaration to flatten.
- * @param value The rhs value for the binding pattern.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param node The node to flatten.
+ * @param visitor An optional visitor used to visit initializers.
+ * @param context The transformation context.
+ * @param boundValue The value bound to the declaration.
+ * @param skipInitializer A value indicating whether to ignore the initializer of `node`.
+ * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line.
+ * @param level Indicates the extent to which flattening should occur.
*/
- function flattenParameterDestructuring(node, value, visitor, transformRest) {
+ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
+ var pendingExpressions;
+ var pendingDeclarations = [];
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location) {
- var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location);
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */);
- ts.aggregateTransformFlags(declaration);
- declarations.push(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(/*recordTempVariable*/ undefined);
- emitAssignment(name, value, location);
- return name;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: hoistTempVariables,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,
+ createArrayBindingOrAssignmentElement: makeBindingElement,
+ visitor: visitor
+ };
+ flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
+ if (pendingExpressions) {
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (hoistTempVariables) {
+ var value = ts.inlineExpressions(pendingExpressions);
+ pendingExpressions = undefined;
+ emitBindingOrAssignment(temp, value, /*location*/ undefined, /*original*/ undefined);
+ }
+ else {
+ context.hoistVariableDeclaration(temp);
+ var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);
+ pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));
+ ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
+ pendingDeclaration.value = temp;
+ }
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location);
+ for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
+ var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;
+ var variable = ts.createVariableDeclaration(name_29,
+ /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);
+ variable.original = original;
+ if (ts.isIdentifier(name_29)) {
+ ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */);
+ }
+ ts.aggregateTransformFlags(variable);
+ declarations.push(variable);
}
- }
- ts.flattenParameterDestructuring = flattenParameterDestructuring;
- /**
- * Flattens binding patterns in a variable declaration.
- *
- * @param node The VariableDeclaration to flatten.
- * @param value An optional rhs value for the binding pattern.
- * @param visitor An optional visitor to use to visit expressions.
- */
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
- var declarations = [];
- var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
return declarations;
- function emitAssignment(name, value, location, original) {
- if (pendingAssignments) {
- pendingAssignments.push(value);
- value = ts.inlineExpressions(pendingAssignments);
- pendingAssignments = undefined;
- }
- var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location);
- declaration.original = original;
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */);
- declarations.push(declaration);
- ts.aggregateTransformFlags(declaration);
+ function emitExpression(value) {
+ pendingExpressions = ts.append(pendingExpressions, value);
}
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- if (recordTempVariable) {
- var assignment = ts.createAssignment(name, value, location);
- if (pendingAssignments) {
- pendingAssignments.push(assignment);
- }
- else {
- pendingAssignments = [assignment];
- }
- }
- else {
- emitAssignment(name, value, location, /*original*/ undefined);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, ts.isBindingName);
+ if (pendingExpressions) {
+ value = ts.inlineExpressions(ts.append(pendingExpressions, value));
+ pendingExpressions = undefined;
}
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
+ pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
}
}
- ts.flattenVariableDestructuring = flattenVariableDestructuring;
+ ts.flattenDestructuringBinding = flattenDestructuringBinding;
/**
- * Flattens binding patterns in a variable declaration and transforms them into an expression.
+ * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments.
*
- * @param node The VariableDeclaration to flatten.
- * @param recordTempVariable A callback used to record new temporary variables.
- * @param createAssignmentCallback An optional callback used to create assignment expressions
- * for non-temporary variables.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param flattenContext Options used to control flattening.
+ * @param element The element to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ * @param skipInitializer An optional value indicating whether to include the initializer
+ * for the element.
*/
- function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
- var pendingAssignments = [];
- flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, /*transformRest*/ false, visitor);
- var expression = ts.inlineExpressions(pendingAssignments);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location, original) {
- var expression = createAssignmentCallback
- ? createAssignmentCallback(name.kind === 70 /* Identifier */ ? name : emitTempVariableAssignment(name, location), value, location)
- : ts.createAssignment(name, value, location);
- emitPendingAssignment(expression, original);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(ts.createAssignment(name, value, location), /*original*/ undefined);
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectLiteral(elements), value, location, original);
- }
- function emitPendingAssignment(expression, original) {
- expression.original = original;
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */);
- pendingAssignments.push(expression);
- }
- }
- ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
- if (value && visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
- }
- if (ts.isBinaryExpression(root)) {
- emitDestructuringAssignment(root.left, value, location);
- }
- else {
- emitBindingElement(root, value);
- }
- function emitDestructuringAssignment(bindingTarget, value, location) {
- // When emitting target = value use source map node to highlight, including any temporary assignments needed for this
- var target;
- if (ts.isShorthandPropertyAssignment(bindingTarget)) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression)
- : bindingTarget.objectAssignmentInitializer;
- if (initializer) {
- value = createDefaultValueCheck(value, initializer, location);
- }
- target = bindingTarget.name;
- }
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57 /* EqualsToken */) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
- : bindingTarget.right;
- value = createDefaultValueCheck(value, initializer, location);
- target = bindingTarget.left;
- }
- else {
- target = bindingTarget;
- }
- if (target.kind === 176 /* ObjectLiteralExpression */) {
- emitObjectLiteralAssignment(target, value, location);
- }
- else if (target.kind === 175 /* ArrayLiteralExpression */) {
- emitArrayLiteralAssignment(target, value, location);
+ function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
+ if (!skipInitializer) {
+ var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
+ if (initializer) {
+ // Combine value and initializer
+ value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;
}
- else {
- var name_30 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_30, target);
- ts.setCommentRange(name_30, target);
- emitAssignment(name_30, value, location, /*original*/ undefined);
+ else if (!value) {
+ // Use 'void 0' in absence of value and initializer
+ value = ts.createVoidZero();
}
}
- function emitObjectLiteralAssignment(target, value, location) {
- var properties = target.properties;
- if (properties.length !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- var bindingElements = [];
- for (var i = 0; i < properties.length; i++) {
- var p = properties[i];
- if (p.kind === 257 /* PropertyAssignment */ || p.kind === 258 /* ShorthandPropertyAssignment */) {
- if (!transformRest ||
- p.transformFlags & 8388608 /* ContainsSpreadExpression */ ||
- (p.kind === 257 /* PropertyAssignment */ && p.initializer.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.name;
- var bindingTarget = p.kind === 258 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName;
- // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
- emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
- }
- else {
- bindingElements.push(p);
- }
- }
- else if (i === properties.length - 1 &&
- p.kind === 259 /* SpreadAssignment */ &&
- p.expression.kind === 70 /* Identifier */) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.expression;
- var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
- emitDestructuringAssignment(propName, restCall, p);
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
+ var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
+ if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
+ flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitArrayLiteralAssignment(target, value, location) {
- if (transformRest) {
- emitESNextArrayLiteralAssignment(target, value, location);
- }
- else {
- emitES2015ArrayLiteralAssignment(target, value, location);
- }
+ else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
+ flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitESNextArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- var expressions = [];
- var spreadContainingExpressions = [];
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind === 198 /* OmittedExpression */) {
- continue;
- }
- if (e.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
- var tmp = ts.createTempVariable(recordTempVariable);
- spreadContainingExpressions.push([e, tmp]);
- expressions.push(tmp);
+ else {
+ flattenContext.emitBindingOrAssignment(bindingTarget, value, location, /*original*/ element);
+ }
+ }
+ /**
+ * Flattens an ObjectBindingOrAssignmentPattern into zero or more bindings or assignments.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param parent The parent element of the pattern.
+ * @param pattern The ObjectBindingOrAssignmentPattern to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ */
+ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ // For anything other than a single-element destructuring we need to generate a temporary
+ // to ensure value is evaluated exactly once. Additionally, if we have zero elements
+ // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
+ // so in that case, we'll intentionally create that temporary.
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var computedTempVariables;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
+ if (flattenContext.level >= 1 /* ObjectRest */
+ && !(element.transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))
+ && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))
+ && !ts.isComputedPropertyName(propertyName)) {
+ bindingElements = ts.append(bindingElements, element);
}
else {
- expressions.push(e);
- }
- }
- emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
- for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
- var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
- emitDestructuringAssignment(e, tmp, e);
- }
- }
- function emitES2015ArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind !== 198 /* OmittedExpression */) {
- // Assignment for target = value.propName should highligh whole property, hence use e as source map node
- if (e.kind !== 196 /* SpreadElement */) {
- emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- else if (i === numElements - 1) {
- emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e);
+ var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
+ if (ts.isComputedPropertyName(propertyName)) {
+ computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
}
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
}
- }
- /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
- * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
- function createRestCall(value, elements, getPropertyName, location) {
- var propertyNames = [];
- for (var i = 0; i < elements.length - 1; i++) {
- if (ts.isOmittedExpression(elements[i])) {
- continue;
+ else if (i === numElements - 1) {
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- var str = ts.createSynthesizedNode(9 /* StringLiteral */);
- str.pos = location.pos;
- str.end = location.end;
- str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
- propertyNames.push(str);
+ var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
- return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
}
- function emitBindingElement(target, value) {
- // Any temporary assignments needed to emit target = value should point to target
- var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (transformRest) {
- value = value || initializer;
- }
- else if (initializer) {
- // Combine value and initializer
- value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
- }
- else if (!value) {
- // Use 'void 0' in absence of value and initializer
- value = ts.createVoidZero();
- }
- var name = target.name;
- if (!ts.isBindingPattern(name)) {
- emitAssignment(name, value, target, target);
- }
- else {
- var numElements = name.elements.length;
- if (numElements !== 1) {
- // For anything other than a single-element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once. Additionally, if we have zero elements
- // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
- // so in that case, we'll intentionally create that temporary.
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target, emitTempVariableAssignment);
- }
- if (name.kind === 173 /* ArrayBindingPattern */) {
- emitArrayBindingElement(name, value);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ }
+ }
+ /**
+ * Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param parent The parent element of the pattern.
+ * @param pattern The ArrayBindingOrAssignmentPattern to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ */
+ function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) {
+ // For anything other than a single-element destructuring we need to generate a temporary
+ // to ensure value is evaluated exactly once. Additionally, if we have zero elements
+ // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
+ // so in that case, we'll intentionally create that temporary.
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var restContainingElements;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (flattenContext.level >= 1 /* ObjectRest */) {
+ // If an array pattern contains an ObjectRest, we must cache the result so that we
+ // can perform the ObjectRest destructuring in a different declaration
+ if (element.transformFlags & 1048576 /* ContainsObjectRest */) {
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ }
+ restContainingElements = ts.append(restContainingElements, [temp, element]);
+ bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
}
else {
- emitObjectBindingElement(target, value);
+ bindingElements = ts.append(bindingElements, element);
}
}
- }
- function emitArrayBindingElement(name, value) {
- if (transformRest) {
- emitESNextArrayBindingElement(name, value);
+ else if (ts.isOmittedExpression(element)) {
+ continue;
}
- else {
- emitES2015ArrayBindingElement(name, value);
+ else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var rhsValue = ts.createElementAccess(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
- }
- function emitES2015ArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (!element.dotDotDotToken) {
- // Rewrite element to a declaration that accesses array element at index i
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
+ else if (i === numElements - 1) {
+ var rhsValue = ts.createArraySlice(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
}
- function emitESNextArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- var spreadContainingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (element.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
- spreadContainingElements.push(element);
- bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
- }
- else {
- bindingElements.push(element);
- }
- }
- emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
- for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
- var element = spreadContainingElements_1[_i];
- emitBindingElement(element, ts.getGeneratedNameForNode(element));
- }
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function emitObjectBindingElement(target, value) {
- var name = target.name;
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (i === numElements - 1 && element.dotDotDotToken) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
- emitBindingElement(element, restCall);
- }
- else if (transformRest && !(element.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
- // do not emit until we have a complete bundle of ES2015 syntax
- bindingElements.push(element);
- }
- else {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- // Rewrite element to a declaration with an initializer that fetches property
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
+ if (restContainingElements) {
+ for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
+ var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
+ flattenBindingOrAssignmentElement(flattenContext, element, id, element);
}
}
- function createDefaultValueCheck(value, defaultValue, location) {
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54 /* QuestionToken */), defaultValue, ts.createToken(55 /* ColonToken */), value);
+ }
+ /**
+ * Creates an expression used to provide a default value if a value is `undefined` at runtime.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param value The RHS value to test.
+ * @param defaultValue The default value to use if `value` is `undefined` at runtime.
+ * @param location The location to use for source maps and comments.
+ */
+ function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
+ value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);
+ return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value);
+ }
+ /**
+ * Creates either a PropertyAccessExpression or an ElementAccessExpression for the
+ * right-hand side of a transformed destructuring assignment.
+ *
+ * @link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param value The RHS value that is the source of the property.
+ * @param propertyName The destructuring property name.
+ */
+ function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName);
+ return ts.createElementAccess(value, argumentExpression);
}
- /**
- * Creates either a PropertyAccessExpression or an ElementAccessExpression for the
- * right-hand side of a transformed destructuring assignment.
- *
- * @param expression The right-hand expression that is the source of the property.
- * @param propertyName The destructuring property name.
- */
- function createDestructuringPropertyAccess(expression, propertyName) {
- if (ts.isComputedPropertyName(propertyName)) {
- return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName, emitTempVariableAssignment));
- }
- else if (ts.isLiteralExpression(propertyName)) {
- var clone_2 = ts.getSynthesizedClone(propertyName);
- clone_2.text = ts.unescapeIdentifier(clone_2.text);
- return ts.createElementAccess(expression, clone_2);
- }
- else {
- if (ts.isGeneratedIdentifier(propertyName)) {
- var clone_3 = ts.getSynthesizedClone(propertyName);
- clone_3.text = ts.unescapeIdentifier(clone_3.text);
- return ts.createPropertyAccess(expression, clone_3);
- }
- else {
- return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)));
- }
- }
+ else if (ts.isStringOrNumericLiteral(propertyName)) {
+ var argumentExpression = ts.getSynthesizedClone(propertyName);
+ argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else {
+ var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));
+ return ts.createPropertyAccess(value, name_30);
}
}
/**
@@ -44872,23 +45038,74 @@ var ts;
* This function is useful to ensure that the expression's value can be read from in subsequent expressions.
* Unless 'reuseIdentifierExpressions' is false, 'value' will be returned if it is just an identifier.
*
+ * @param flattenContext Options used to control flattening.
* @param value the expression whose value needs to be bound.
* @param reuseIdentifierExpressions true if identifier expressions can simply be returned;
- * false if it is necessary to always emit an identifier.
+ * false if it is necessary to always emit an identifier.
* @param location The location to use for source maps and comments.
- * @param emitTempVariableAssignment A callback used to emit a temporary variable.
- * @param visitor An optional callback used to visit the value.
*/
- function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) {
+ function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
return value;
}
else {
- if (visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ flattenContext.emitExpression(ts.createAssignment(temp, value, location));
+ }
+ else {
+ flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined);
+ }
+ return temp;
+ }
+ }
+ function makeArrayBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
+ return ts.createArrayBindingPattern(elements);
+ }
+ function makeArrayAssignmentPattern(elements) {
+ return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));
+ }
+ function makeObjectBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isBindingElement);
+ return ts.createObjectBindingPattern(elements);
+ }
+ function makeObjectAssignmentPattern(elements) {
+ return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));
+ }
+ function makeBindingElement(name) {
+ return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name);
+ }
+ function makeAssignmentElement(name) {
+ return name;
+ }
+ var restHelper = {
+ name: "typescript:rest",
+ scoped: false,
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ };
+ /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
+ * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
+ function createRestCall(context, value, elements, computedTempVariables, location) {
+ context.requestEmitHelper(restHelper);
+ var propertyNames = [];
+ var computedTempVariableOffset = 0;
+ for (var i = 0; i < elements.length - 1; i++) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
+ if (propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var temp = computedTempVariables[computedTempVariableOffset];
+ computedTempVariableOffset++;
+ // typeof _tmp === "symbol" ? _tmp : _tmp + ""
+ propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral(""))));
+ }
+ else {
+ propertyNames.push(ts.createLiteral(propertyName));
+ }
}
- return emitTempVariableAssignment(value, location);
}
+ return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);
}
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
@@ -44911,7 +45128,7 @@ var ts;
TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers";
})(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {}));
function transformTypeScript(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -44931,7 +45148,6 @@ var ts;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentExternalHelpersModuleName;
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
* They are persisted between each SourceFile transformation and should not be reset.
@@ -44957,7 +45173,11 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ currentSourceFile = node;
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
/**
* Visits a node, saving and restoring state variables on the stack.
@@ -44979,6 +45199,29 @@ var ts;
return visited;
}
/**
+ * Performs actions that should always occur immediately before visiting a node.
+ *
+ * @param node The node to visit.
+ */
+ function onBeforeVisitNode(node) {
+ switch (node.kind) {
+ case 261 /* SourceFile */:
+ case 232 /* CaseBlock */:
+ case 231 /* ModuleBlock */:
+ case 204 /* Block */:
+ currentScope = node;
+ currentScopeFirstDeclarationsOfName = undefined;
+ break;
+ case 226 /* ClassDeclaration */:
+ case 225 /* FunctionDeclaration */:
+ if (ts.hasModifier(node, 2 /* Ambient */)) {
+ break;
+ }
+ recordEmittedDeclarationInScope(node);
+ break;
+ }
+ }
+ /**
* General-purpose node visitor.
*
* @param node The node to visit.
@@ -44992,10 +45235,7 @@ var ts;
* @param node The node to visit.
*/
function visitorWorker(node) {
- if (node.kind === 261 /* SourceFile */) {
- return visitSourceFile(node);
- }
- else if (node.transformFlags & 1 /* TypeScript */) {
+ if (node.transformFlags & 1 /* TypeScript */) {
// This node is explicitly marked as TypeScript, so we should transform the node.
return visitTypeScript(node);
}
@@ -45265,67 +45505,9 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- /**
- * Performs actions that should always occur immediately before visiting a node.
- *
- * @param node The node to visit.
- */
- function onBeforeVisitNode(node) {
- switch (node.kind) {
- case 261 /* SourceFile */:
- case 232 /* CaseBlock */:
- case 231 /* ModuleBlock */:
- case 204 /* Block */:
- currentScope = node;
- currentScopeFirstDeclarationsOfName = undefined;
- break;
- case 226 /* ClassDeclaration */:
- case 225 /* FunctionDeclaration */:
- if (ts.hasModifier(node, 2 /* Ambient */)) {
- break;
- }
- recordEmittedDeclarationInScope(node);
- break;
- }
- }
function visitSourceFile(node) {
- currentSourceFile = node;
- // ensure "use strict" is emitted in all scenarios in alwaysStrict mode
- // There is no need to emit "use strict" in the following cases:
- // 1. The file is an external module and target is es2015 or higher
- // or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower
- if (compilerOptions.alwaysStrict &&
- !(ts.isExternalModule(node) && (compilerOptions.target >= 2 /* ES2015 */ || compilerOptions.module === ts.ModuleKind.ES2015))) {
- node = ts.ensureUseStrict(node);
- }
- // If the source file requires any helpers and is an external module, and
- // the importHelpers compiler option is enabled, emit a synthesized import
- // statement for the helpers library.
- if (node.flags & 64512 /* EmitHelperFlags */
- && compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor);
- var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText);
- var externalHelpersModuleImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- externalHelpersModuleImport.parent = node;
- externalHelpersModuleImport.flags &= ~8 /* Synthesized */;
- statements.push(externalHelpersModuleImport);
- currentExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- currentExternalHelpersModuleName = undefined;
- node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
- node.externalHelpersModuleName = externalHelpersModuleName;
- }
- else {
- node = ts.visitEachChild(node, sourceElementVisitor, context);
- }
- ts.setEmitFlags(node, 1 /* EmitEmitHelpers */ | ts.getEmitFlags(node));
- return node;
+ var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);
+ return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));
}
/**
* Tests whether we should emit a __decorate call for a class declaration.
@@ -45402,7 +45584,7 @@ var ts;
if (statements.length > 1) {
// Add a DeclarationMarker as a marker for the end of the declaration
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152 /* HasEndOfDeclarationMarker */);
}
return ts.singleOrMany(statements);
}
@@ -45425,7 +45607,7 @@ var ts;
// To better align with the old emitter, we should not emit a trailing source map
// entry if the class has static properties.
if (hasStaticProperties) {
- emitFlags |= 1024 /* NoTrailingSourceMap */;
+ emitFlags |= 32 /* NoTrailingSourceMap */;
}
ts.setOriginalNode(classDeclaration, node);
ts.setEmitFlags(classDeclaration, emitFlags);
@@ -45570,7 +45752,7 @@ var ts;
}
// To preserve the behavior of the old emitter, we explicitly indent
// the body of a class with static initializers.
- ts.setEmitFlags(classExpression, 524288 /* Indented */ | ts.getEmitFlags(classExpression));
+ ts.setEmitFlags(classExpression, 32768 /* Indented */ | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
@@ -45604,7 +45786,7 @@ var ts;
// If there is a property assignment, we need to emit constructor whether users define it or not
// If there is no property assignment, we can omit constructor if users do not define it
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 4194304 /* ContainsParameterPropertyAssignments */;
+ var hasParameterPropertyAssignments = node.transformFlags & 262144 /* ContainsParameterPropertyAssignments */;
var constructor = ts.getFirstConstructorWithBody(node);
// If the class does not contain nodes that require a synthesized constructor,
// accept the current constructor if it exists.
@@ -45644,9 +45826,8 @@ var ts;
// downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
// Instead, we'll avoid using a rest parameter and spread into the super call as
// 'super(...arguments)' instead of 'super(...args)', as you can see in "transformConstructorBody".
- return constructor
- ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
- : [];
+ return ts.visitParameterList(constructor && constructor.parameters, visitor, context)
+ || [];
}
/**
* Transforms (or creates) a constructor body for a class with parameter property
@@ -45659,8 +45840,7 @@ var ts;
function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
- // The body of a constructor is a new lexical environment
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
if (constructor) {
indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);
// Add parameters with property assignments. Transforms this:
@@ -45704,9 +45884,10 @@ var ts;
}
// End the lexical environment.
ts.addRange(statements, endLexicalEnvironment());
- return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements,
+ return ts.createBlock(ts.createNodeArray(statements,
/*location*/ constructor ? constructor.body.statements : node.members),
- /*location*/ constructor ? constructor.body : undefined), true);
+ /*location*/ constructor ? constructor.body : undefined,
+ /*multiLine*/ true);
}
/**
* Adds super call and preceding prologue directives into the list of statements.
@@ -45758,9 +45939,9 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name));
var name = node.name;
var propertyName = ts.getMutableClone(name);
- ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 1536 /* NoSourceMap */);
+ ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */);
var localName = ts.getMutableClone(name);
- ts.setEmitFlags(localName, 49152 /* NoComments */);
+ ts.setEmitFlags(localName, 1536 /* NoComments */);
return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName,
/*location*/ node.name), localName),
/*location*/ ts.moveRangePos(node, -1)));
@@ -46072,13 +46253,13 @@ var ts;
// __metadata("design:type", Function),
// __metadata("design:paramtypes", [Object]),
// __metadata("design:returntype", void 0)
- // ], C.prototype, "method", undefined);
+ // ], C.prototype, "method", null);
//
// The emit for an accessor is:
//
// __decorate([
// dec
- // ], C.prototype, "accessor", undefined);
+ // ], C.prototype, "accessor", null);
//
// The emit for a property is:
//
@@ -46093,8 +46274,8 @@ var ts;
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
- ts.setEmitFlags(helper, 49152 /* NoComments */);
+ var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ ts.setEmitFlags(helper, 1536 /* NoComments */);
return helper;
}
/**
@@ -46121,9 +46302,9 @@ var ts;
}
var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
- var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var decorate = createDecorateHelper(context, decoratorExpressions, localName);
var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
- ts.setEmitFlags(expression, 49152 /* NoComments */);
+ ts.setEmitFlags(expression, 1536 /* NoComments */);
ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
return expression;
}
@@ -46147,9 +46328,9 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset,
+ var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset,
/*location*/ decorator.expression);
- ts.setEmitFlags(helper, 49152 /* NoComments */);
+ ts.setEmitFlags(helper, 1536 /* NoComments */);
expressions.push(helper);
}
}
@@ -46172,13 +46353,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -46195,7 +46376,7 @@ var ts;
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
}
}
}
@@ -46435,7 +46616,7 @@ var ts;
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
- return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object"));
+ return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object"));
case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false);
case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
@@ -46511,7 +46692,7 @@ var ts;
* available.
*/
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54 /* QuestionToken */), ts.createIdentifier("Symbol"), ts.createToken(55 /* ColonToken */), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
/**
* Gets an expression that represents a property name. For a computed property, a
@@ -46613,17 +46794,17 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
- var method = ts.createMethod(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ var updated = ts.updateMethod(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Determines whether to emit an accessor declaration. We should not emit the
@@ -46647,16 +46828,16 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createGetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateGetAccessor(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Visits a set accessor declaration of a class.
@@ -46671,15 +46852,15 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createSetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateSetAccessor(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Visits a function declaration.
@@ -46695,18 +46876,16 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return ts.createNotEmittedStatement(node);
}
- var func = ts.createFunctionDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
+ var updated = ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
if (isNamespaceExport(node)) {
- var statements = [func];
+ var statements = [updated];
addExportMemberAssignment(statements, node);
return statements;
}
- return func;
+ return updated;
}
/**
* Visits a function expression node.
@@ -46720,12 +46899,10 @@ var ts;
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
/**
* @remarks
@@ -46733,51 +46910,10 @@ var ts;
* - The node has type annotations
*/
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformFunctionBodyWorker(node.body);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- currentScope = body;
- currentScopeFirstDeclarationsOfName = ts.createMap();
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- }
- function transformConciseBody(node) {
- return transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ false);
- }
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
- if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
- }
- else {
- startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
- var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
- }
+ var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
/**
* Visits a parameter declaration node.
@@ -46804,7 +46940,7 @@ var ts;
ts.setOriginalNode(parameter, node);
ts.setCommentRange(parameter, node);
ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));
- ts.setEmitFlags(parameter.name, 1024 /* NoTrailingSourceMap */);
+ ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */);
return parameter;
}
/**
@@ -46830,7 +46966,8 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */,
+ /*needsValue*/ false, createNamespaceExportExpression);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression),
@@ -46910,14 +47047,14 @@ var ts;
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
// us to set up the correct state for later substitutions.
- var emitFlags = 64 /* AdviseOnEmitNode */;
+ var emitFlags = 2 /* AdviseOnEmitNode */;
// If needed, we should emit a variable declaration for the enum. If we emit
// a leading variable declaration, we should not emit leading comments for the
// enum body.
if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384 /* NoLeadingComments */;
+ emitFlags |= 512 /* NoLeadingComments */;
}
}
// `parameterName` is the declaration name used inside of the enum.
@@ -47094,7 +47231,7 @@ var ts;
// })(m1 || (m1 = {})); // trailing comment module
//
ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 /* NoTrailingComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */);
statements.push(statement);
return true;
}
@@ -47104,7 +47241,7 @@ var ts;
// begin/end semantics of the declararation and to properly handle exports
// we wrap the leading variable declaration in a `MergeDeclarationMarker`.
var mergeMarker = ts.createMergeDeclarationMarker(statement);
- ts.setEmitFlags(mergeMarker, 49152 /* NoComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(mergeMarker, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */);
statements.push(mergeMarker);
return false;
}
@@ -47125,14 +47262,14 @@ var ts;
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
// us to set up the correct state for later substitutions.
- var emitFlags = 64 /* AdviseOnEmitNode */;
+ var emitFlags = 2 /* AdviseOnEmitNode */;
// If needed, we should emit a variable declaration for the module. If we emit
// a leading variable declaration, we should not emit leading comments for the
// module body.
if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384 /* NoLeadingComments */;
+ emitFlags |= 512 /* NoLeadingComments */;
}
}
// `parameterName` is the declaration name used inside of the namespace.
@@ -47235,7 +47372,7 @@ var ts;
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
if (body.kind !== 231 /* ModuleBlock */) {
- ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152 /* NoComments */);
+ ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
@@ -47384,7 +47521,7 @@ var ts;
return undefined;
}
var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);
- ts.setEmitFlags(moduleReference, 49152 /* NoComments */ | 65536 /* NoNestedComments */);
+ ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */);
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
// export var ${name} = ${moduleReference};
// var ${name} = ${moduleReference};
@@ -47602,10 +47739,10 @@ var ts;
if (declaration) {
var classAlias = classAliases[declaration.id];
if (classAlias) {
- var clone_4 = ts.getSynthesizedClone(classAlias);
- ts.setSourceMapRange(clone_4, node);
- ts.setCommentRange(clone_4, node);
- return clone_4;
+ var clone_2 = ts.getSynthesizedClone(classAlias);
+ ts.setSourceMapRange(clone_2, node);
+ ts.setCommentRange(clone_2, node);
+ return clone_2;
}
}
}
@@ -47614,7 +47751,7 @@ var ts;
}
function trySubstituteNamespaceExportedName(node) {
// If this is explicitly a local name, do not substitute.
- if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
@@ -47661,13 +47798,335 @@ var ts;
}
}
ts.transformTypeScript = transformTypeScript;
+ var paramHelper = {
+ name: "typescript:param",
+ scoped: false,
+ priority: 4,
+ text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
+ };
+ function createParamHelper(context, expression, parameterOffset, location) {
+ context.requestEmitHelper(paramHelper);
+ return ts.createCall(ts.getHelperName("__param"),
+ /*typeArguments*/ undefined, [
+ ts.createLiteral(parameterOffset),
+ expression
+ ], location);
+ }
+ var metadataHelper = {
+ name: "typescript:metadata",
+ scoped: false,
+ priority: 3,
+ text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
+ };
+ function createMetadataHelper(context, metadataKey, metadataValue) {
+ context.requestEmitHelper(metadataHelper);
+ return ts.createCall(ts.getHelperName("__metadata"),
+ /*typeArguments*/ undefined, [
+ ts.createLiteral(metadataKey),
+ metadataValue
+ ]);
+ }
+ var decorateHelper = {
+ name: "typescript:decorate",
+ scoped: false,
+ priority: 2,
+ text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
+ };
+ function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {
+ context.requestEmitHelper(decorateHelper);
+ var argumentsArray = [];
+ argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
+ }
+ return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
+ }
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
/*@internal*/
var ts;
(function (ts) {
- var entities = createEntitiesMap();
+ function transformESNext(context) {
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ return visited;
+ }
+ function visitor(node) {
+ return visitorWorker(node, /*noDestructuringValue*/ false);
+ }
+ function visitorNoDestructuringValue(node) {
+ return visitorWorker(node, /*noDestructuringValue*/ true);
+ }
+ function visitorWorker(node, noDestructuringValue) {
+ if ((node.transformFlags & 8 /* ContainsESNext */) === 0) {
+ return node;
+ }
+ switch (node.kind) {
+ case 176 /* ObjectLiteralExpression */:
+ return visitObjectLiteralExpression(node);
+ case 192 /* BinaryExpression */:
+ return visitBinaryExpression(node, noDestructuringValue);
+ case 223 /* VariableDeclaration */:
+ return visitVariableDeclaration(node);
+ case 213 /* ForOfStatement */:
+ return visitForOfStatement(node);
+ case 211 /* ForStatement */:
+ return visitForStatement(node);
+ case 188 /* VoidExpression */:
+ return visitVoidExpression(node);
+ case 150 /* Constructor */:
+ return visitConstructorDeclaration(node);
+ case 149 /* MethodDeclaration */:
+ return visitMethodDeclaration(node);
+ case 151 /* GetAccessor */:
+ return visitGetAccessorDeclaration(node);
+ case 152 /* SetAccessor */:
+ return visitSetAccessorDeclaration(node);
+ case 225 /* FunctionDeclaration */:
+ return visitFunctionDeclaration(node);
+ case 184 /* FunctionExpression */:
+ return visitFunctionExpression(node);
+ case 185 /* ArrowFunction */:
+ return visitArrowFunction(node);
+ case 144 /* Parameter */:
+ return visitParameter(node);
+ case 207 /* ExpressionStatement */:
+ return visitExpressionStatement(node);
+ case 183 /* ParenthesizedExpression */:
+ return visitParenthesizedExpression(node, noDestructuringValue);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 259 /* SpreadAssignment */) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 257 /* PropertyAssignment */) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ if (node.transformFlags & 1048576 /* ContainsObjectSpread */) {
+ // spread elements emit like so:
+ // non-spread elements are chunked together into object literals, and then all are passed to __assign:
+ // { a, ...o, b } => __assign({a}, o, {b});
+ // If the first element is a spread element, then the first argument to __assign is {}:
+ // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return createAssignHelper(context, objects);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitExpressionStatement(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitParenthesizedExpression(node, noDestructuringValue) {
+ return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);
+ }
+ /**
+ * Visits a BinaryExpression that contains a destructuring assignment.
+ *
+ * @param node A BinaryExpression node.
+ */
+ function visitBinaryExpression(node, noDestructuringValue) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576 /* ContainsObjectRest */) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 1 /* ObjectRest */, !noDestructuringValue);
+ }
+ else if (node.operatorToken.kind === 25 /* CommaToken */) {
+ return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ /**
+ * Visits a VariableDeclaration node with a binding pattern.
+ *
+ * @param node A VariableDeclaration node.
+ */
+ function visitVariableDeclaration(node) {
+ // If we are here it is because the name contains a binding pattern with a rest somewhere in it.
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576 /* ContainsObjectRest */) {
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitForStatement(node) {
+ return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));
+ }
+ function visitVoidExpression(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ /**
+ * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.
+ *
+ * @param node A ForOfStatement.
+ */
+ function visitForOfStatement(node) {
+ var leadingStatements;
+ var temp;
+ var initializer = ts.skipParentheses(node.initializer);
+ if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var firstDeclaration = ts.firstOrUndefined(initializer.declarations);
+ var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp,
+ /*doNotRecordTempVariablesInLine*/ false,
+ /*skipInitializer*/ true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations),
+ /*location*/ initializer);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ else if (ts.isAssignmentPattern(initializer)) {
+ temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */);
+ leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer));
+ }
+ }
+ if (temp) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var block = ts.isBlock(statement)
+ ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))
+ : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true);
+ return ts.updateForOf(node, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer)
+ ], node.initializer, 1 /* Let */), expression, block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParameter(node) {
+ if (node.transformFlags & 1048576 /* ContainsObjectRest */) {
+ // Binding patterns are converted into a generated name and are
+ // evaluated inside the function body.
+ return ts.updateParameter(node,
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node),
+ /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitConstructorDeclaration(node) {
+ return ts.updateConstructor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitGetAccessorDeclaration(node) {
+ return ts.updateGetAccessor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitSetAccessorDeclaration(node) {
+ return ts.updateSetAccessor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitMethodDeclaration(node) {
+ return ts.updateMethod(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitFunctionDeclaration(node) {
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitArrowFunction(node) {
+ return ts.updateArrowFunction(node, node.modifiers,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitFunctionExpression(node) {
+ return ts.updateFunctionExpression(node, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function transformFunctionBody(node) {
+ resumeLexicalEnvironment();
+ var leadingStatements;
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1 /* ObjectRest */, temp,
+ /*doNotRecordTempVariablesInLine*/ false,
+ /*skipInitializer*/ true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations));
+ ts.setEmitFlags(statement, 524288 /* CustomPrologue */);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ }
+ var body = ts.visitNode(node.body, visitor, ts.isConciseBody);
+ var trailingStatements = endLexicalEnvironment();
+ if (ts.some(leadingStatements) || ts.some(trailingStatements)) {
+ var block = ts.convertToFunctionBody(body, /*multiLine*/ true);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
+ }
+ return body;
+ }
+ }
+ ts.transformESNext = transformESNext;
+ var assignHelper = {
+ name: "typescript:assign",
+ scoped: false,
+ priority: 1,
+ text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
+ };
+ function createAssignHelper(context, attributesSegments) {
+ context.requestEmitHelper(assignHelper);
+ return ts.createCall(ts.getHelperName("__assign"),
+ /*typeArguments*/ undefined, attributesSegments);
+ }
+ ts.createAssignHelper = createAssignHelper;
+})(ts || (ts = {}));
+/// <reference path="../factory.ts" />
+/// <reference path="../visitor.ts" />
+/// <reference path="./esnext.ts" />
+/*@internal*/
+var ts;
+(function (ts) {
function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
var currentSourceFile;
@@ -47682,17 +48141,15 @@ var ts;
return node;
}
currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined;
- return node;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 4 /* Jsx */) {
+ if (node.transformFlags & 4 /* ContainsJsx */) {
return visitorWorker(node);
}
- else if (node.transformFlags & 8 /* ContainsJsx */) {
- return ts.visitEachChild(node, visitor, context);
- }
else {
return node;
}
@@ -47706,8 +48163,7 @@ var ts;
case 252 /* JsxExpression */:
return visitJsxExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ return ts.visitEachChild(node, visitor, context);
}
}
function transformJsxChildToExpression(node) {
@@ -47752,8 +48208,10 @@ var ts;
}
// Either emit one big object literal (no spread attribs), or
// a call to the __assign helper.
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
+ objectProperties = ts.singleOrUndefined(segments);
+ if (!objectProperties) {
+ objectProperties = ts.createAssignHelper(context, segments);
+ }
}
var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
@@ -47891,519 +48349,285 @@ var ts;
}
}
ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-/// <reference path="../factory.ts" />
-/// <reference path="../visitor.ts" />
-/*@internal*/
-var ts;
-(function (ts) {
- function transformESNext(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
- function visitor(node) {
- if (node.transformFlags & 16 /* ESNext */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 32 /* ContainsESNext */) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 176 /* ObjectLiteralExpression */:
- return visitObjectLiteralExpression(node);
- case 192 /* BinaryExpression */:
- return visitBinaryExpression(node);
- case 223 /* VariableDeclaration */:
- return visitVariableDeclaration(node);
- case 213 /* ForOfStatement */:
- return visitForOfStatement(node);
- case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- return node;
- case 225 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
- case 184 /* FunctionExpression */:
- return visitFunctionExpression(node);
- case 185 /* ArrowFunction */:
- return visitArrowFunction(node);
- case 144 /* Parameter */:
- return visitParameter(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
- }
- }
- function chunkObjectLiteralElements(elements) {
- var chunkObject;
- var objects = [];
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
- var e = elements_3[_i];
- if (e.kind === 259 /* SpreadAssignment */) {
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- chunkObject = undefined;
- }
- var target = e.expression;
- objects.push(ts.visitNode(target, visitor, ts.isExpression));
- }
- else {
- if (!chunkObject) {
- chunkObject = [];
- }
- if (e.kind === 257 /* PropertyAssignment */) {
- var p = e;
- chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
- }
- else {
- chunkObject.push(e);
- }
- }
- }
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- }
- return objects;
- }
- function visitObjectLiteralExpression(node) {
- // spread elements emit like so:
- // non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
- // If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
- if (ts.forEach(node.properties, function (p) { return p.kind === 259 /* SpreadAssignment */; })) {
- var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) {
- objects.unshift(ts.createObjectLiteral());
- }
- return ts.aggregateTransformFlags(ts.createCall(ts.createIdentifier("__assign"), undefined, objects));
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a BinaryExpression that contains a destructuring assignment.
- *
- * @param node A BinaryExpression node.
- */
- function visitBinaryExpression(node) {
- if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48 /* AssertESNext */) {
- return ts.flattenDestructuringAssignment(context, node, /*needsDestructuringValue*/ true, hoistVariableDeclaration, visitor, /*transformRest*/ true);
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a VariableDeclaration node with a binding pattern.
- *
- * @param node A VariableDeclaration node.
- */
- function visitVariableDeclaration(node) {
- // If we are here it is because the name contains a binding pattern with a rest somewhere in it.
- if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48 /* AssertESNext */) {
- var result = ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, /*recordTempVariable*/ undefined, /*transformRest*/ true);
- return result;
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.
- *
- * @param node A ForOfStatement.
- */
- function visitForOfStatement(node) {
- // The following ESNext code:
- //
- // for (let { x, y, ...rest } of expr) { }
- //
- // should be emitted as
- //
- // for (var _a of expr) {
- // let { x, y } = _a, rest = __rest(_a, ["x", "y"]);
- // }
- //
- // where _a is a temp emitted to capture the RHS.
- // When the left hand side is an expression instead of a let declaration,
- // the `let` before the `{ x, y }` is not emitted.
- // When the left hand side is a let/const, the v is renamed if there is
- // another v in scope.
- // Note that all assignments to the LHS are emitted in the body, including
- // all destructuring.
- // Note also that because an extra statement is needed to assign to the LHS,
- // for-of bodies are always emitted as blocks.
- // for (<init> of <expression>) <statement>
- // where <init> is [let] variabledeclarationlist | expression
- var initializer = node.initializer;
- if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
- return ts.visitEachChild(node, visitor, context);
- }
- return ts.convertForOf(node, undefined, visitor, ts.noop, context, /*transformRest*/ true);
- }
- function isRestBindingPattern(initializer) {
- if (ts.isVariableDeclarationList(initializer)) {
- var declaration = ts.firstOrUndefined(initializer.declarations);
- return declaration && declaration.name &&
- declaration.name.kind === 172 /* ObjectBindingPattern */ &&
- !!(declaration.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
- }
- return false;
- }
- function isRestAssignment(initializer) {
- return initializer.kind === 176 /* ObjectLiteralExpression */ &&
- initializer.transformFlags & 8388608 /* ContainsSpreadExpression */;
- }
- function visitParameter(node) {
- if (isObjectRestParameter(node)) {
- // Binding patterns are converted into a generated name and are
- // evaluated inside the function body.
- return ts.setOriginalNode(ts.createParameter(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node),
- /*questionToken*/ undefined,
- /*type*/ undefined, node.initializer,
- /*location*/ node),
- /*original*/ node);
- }
- else {
- return node;
- }
- }
- function isObjectRestParameter(node) {
- return node.name &&
- node.name.kind === 172 /* ObjectBindingPattern */ &&
- !!(node.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
- }
- function visitFunctionDeclaration(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, body,
- /*location*/ node),
- /*original*/ node);
- }
- function visitArrowFunction(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- var func = ts.setOriginalNode(ts.createArrowFunction(node.modifiers,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, body,
- /*location*/ node),
- /*original*/ node);
- ts.setEmitFlags(func, 256 /* CapturesThis */);
- return func;
- }
- function visitFunctionExpression(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionExpression(node.modifiers, node.asteriskToken, name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, body,
- /*location*/ node),
- /*original*/ node);
- }
- }
- ts.transformESNext = transformESNext;
+ var entities = ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
/*@internal*/
var ts;
(function (ts) {
+ var ES2017SubstitutionFlags;
+ (function (ES2017SubstitutionFlags) {
+ /** Enables substitutions for async methods with `super` calls. */
+ ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
+ })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
function transformES2017(context) {
- var ES2017SubstitutionFlags;
- (function (ES2017SubstitutionFlags) {
- /** Enables substitutions for async methods with `super` calls. */
- ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
- })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
// These variables contain state that changes as we descend into the tree.
- var currentSourceFileExternalHelpersModuleName;
+ var currentSourceFile;
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
* They are persisted between each SourceFile transformation and should not be reset.
*/
var enabledSubstitutions;
/**
- * Keeps track of whether we are within any containing namespaces when performing
- * just-in-time substitution while printing an expression identifier.
- */
- var applicableSubstitutions;
- /**
* This keeps track of containers where `super` is valid, for use with
* just-in-time substitution for `super` expressions inside of async methods.
*/
@@ -48414,25 +48638,21 @@ var ts;
// Set new transformation hooks.
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
- return ts.visitEachChild(node, visitor, context);
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 64 /* ES2017 */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 128 /* ContainsES2017 */) {
- return ts.visitEachChild(node, visitor, context);
+ if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) {
+ return node;
}
- return node;
- }
- function visitorWorker(node) {
switch (node.kind) {
case 119 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
@@ -48453,16 +48673,15 @@ var ts;
// ES2017 arrow functions may be 'async'
return visitArrowFunction(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return node;
+ return ts.visitEachChild(node, visitor, context);
}
}
/**
- * Visits an await expression.
+ * Visits an AwaitExpression node.
*
* This function will be called any time a ES2017 await expression is encountered.
*
- * @param node The await expression node.
+ * @param node The node to visit.
*/
function visitAwaitExpression(node) {
return ts.setOriginalNode(ts.createYield(
@@ -48470,106 +48689,73 @@ var ts;
/*location*/ node), node);
}
/**
- * Visits a method declaration of a class.
+ * Visits a MethodDeclaration node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked as async
*
- * @param node The method node.
+ * @param node The node to visit.
*/
function visitMethodDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var method = ts.createMethod(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ return ts.updateMethod(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * Visits a function declaration.
+ * Visits a FunctionDeclaration node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked async
*
- * @param node The function node.
+ * @param node The node to visit.
*/
function visitFunctionDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createFunctionDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * Visits a function expression node.
+ * Visits a FunctionExpression node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked async
*
- * @param node The function expression node.
+ * @param node The node to visit.
*/
function visitFunctionExpression(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(
- /*modifiers*/ undefined, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionExpression(node,
+ /*modifiers*/ undefined, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * @remarks
+ * Visits an ArrowFunction.
+ *
* This function will be called when one of the following conditions are met:
* - The node is marked async
+ *
+ * @param node The node to visit.
*/
function visitArrowFunction(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformConciseBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- currentScope = body;
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformAsyncFunctionBody(node) {
+ resumeLexicalEnvironment();
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
@@ -48583,54 +48769,51 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true);
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
if (languageVersion >= 2 /* ES2015 */) {
if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8 /* EmitAdvancedSuperHelper */);
+ ts.addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4 /* EmitSuperHelper */);
+ ts.addEmitHelper(block, asyncSuperHelper);
}
}
return block;
}
else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ true));
+ var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));
+ var declarations = endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(expression);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));
+ }
+ return expression;
}
}
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ function transformFunctionBodyWorker(body, start) {
if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
+ return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));
}
else {
startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));
var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
+ return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));
}
}
function getPromiseConstructor(type) {
- if (type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
+ var typeName = type && ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
}
return undefined;
@@ -48714,16 +48897,17 @@ var ts;
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(emitContext, node, emitCallback) {
- var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
// If we need to support substitutions for `super` in an async method,
// we should track it here.
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
+ var savedCurrentSuperContainer = currentSuperContainer;
currentSuperContainer = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- previousOnEmitNode(emitContext, node, emitCallback);
- applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
/**
* Hooks node substitutions.
@@ -48755,6 +48939,40 @@ var ts;
}
}
ts.transformES2017 = transformES2017;
+ function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ context.requestEmitHelper(awaiterHelper);
+ var generatorFunc = ts.createFunctionExpression(
+ /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */),
+ /*name*/ undefined,
+ /*typeParameters*/ undefined,
+ /*parameters*/ [],
+ /*type*/ undefined, body);
+ // Mark this node as originally an async function
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */;
+ return ts.createCall(ts.getHelperName("__awaiter"),
+ /*typeArguments*/ undefined, [
+ ts.createThis(),
+ hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
+ promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
+ generatorFunc
+ ]);
+ }
+ var awaiterHelper = {
+ name: "typescript:awaiter",
+ scoped: false,
+ priority: 5,
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };"
+ };
+ var asyncSuperHelper = {
+ name: "typescript:async-super",
+ scoped: true,
+ text: "\n const _super = name => super[name];"
+ };
+ var advancedAsyncSuperHelper = {
+ name: "typescript:advanced-async-super",
+ scoped: true,
+ text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"
+ };
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
@@ -48771,64 +48989,60 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 256 /* ES2016 */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 512 /* ContainsES2016 */) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
+ if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) {
return node;
}
- }
- function visitorWorker(node) {
switch (node.kind) {
case 192 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
return ts.visitEachChild(node, visitor, context);
}
}
function visitBinaryExpression(node) {
- // We are here because ES2016 adds support for the exponentiation operator.
+ switch (node.operatorToken.kind) {
+ case 61 /* AsteriskAsteriskEqualsToken */:
+ return visitExponentiationAssignmentExpression(node);
+ case 39 /* AsteriskAsteriskToken */:
+ return visitExponentiationExpression(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitExponentiationAssignmentExpression(node) {
+ var target;
+ var value;
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 61 /* AsteriskAsteriskEqualsToken */) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)`
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression),
- /*location*/ left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp,
- /*location*/ left);
- }
- else if (ts.isPropertyAccessExpression(left)) {
- // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)`
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name,
- /*location*/ left);
- value = ts.createPropertyAccess(expressionTemp, left.name,
- /*location*/ left);
- }
- else {
- // Transforms `a **= b` into `a = Math.pow(a, b)`
- target = left;
- value = left;
- }
- return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node);
- }
- else if (node.operatorToken.kind === 39 /* AsteriskAsteriskToken */) {
- // Transforms `a ** b` into `Math.pow(a, b)`
- return ts.createMathPow(left, right, /*location*/ node);
+ if (ts.isElementAccessExpression(left)) {
+ // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)`
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression),
+ /*location*/ left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp,
+ /*location*/ left);
+ }
+ else if (ts.isPropertyAccessExpression(left)) {
+ // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)`
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name,
+ /*location*/ left);
+ value = ts.createPropertyAccess(expressionTemp, left.name,
+ /*location*/ left);
}
else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ // Transforms `a **= b` into `a = Math.pow(a, b)`
+ target = left;
+ value = left;
}
+ return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node);
+ }
+ function visitExponentiationExpression(node) {
+ // Transforms `a ** b` into `Math.pow(a, b)`
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return ts.createMathPow(left, right, /*location*/ node);
}
}
ts.transformES2016 = transformES2016;
@@ -48881,7 +49095,7 @@ var ts;
SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn";
})(SuperCaptureResult || (SuperCaptureResult = {}));
function transformES2015(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
@@ -48915,7 +49129,11 @@ var ts;
}
currentSourceFile = node;
currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ currentText = undefined;
+ return visited;
}
function visitor(node) {
return saveStateAndInvoke(node, dispatcher);
@@ -48955,6 +49173,41 @@ var ts;
currentNode = savedCurrentNode;
return visited;
}
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 185 /* ArrowFunction */) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ // keep track of the enclosing variable statement when in the context of
+ // variable statements, variable declarations, binding elements, and binding
+ // patterns.
+ switch (currentNode.kind) {
+ case 205 /* VariableStatement */:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 224 /* VariableDeclarationList */:
+ case 223 /* VariableDeclaration */:
+ case 174 /* BindingElement */:
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
+ }
+ currentParent = currentNode;
+ currentNode = node;
+ }
function returnCapturedThis(node) {
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
@@ -48962,7 +49215,7 @@ var ts;
return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 1024 /* ES2015 */) !== 0 ||
+ return (node.transformFlags & 64 /* ES2015 */) !== 0 ||
node.kind === 219 /* LabeledStatement */ ||
(ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node));
}
@@ -48973,7 +49226,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 2048 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
// we want to dive in this branch either if node has children with ES2015 specific syntax
// or we are inside constructor that captures result of the super call so all returns without expression should be
// rewritten. Note: we skip expressions since returns should never appear there
@@ -49076,6 +49329,8 @@ var ts;
return visitTemplateExpression(node);
case 195 /* YieldExpression */:
return visitYieldExpression(node);
+ case 196 /* SpreadElement */:
+ return visitSpreadElement(node);
case 96 /* SuperKeyword */:
return visitSuperKeyword();
case 195 /* YieldExpression */:
@@ -49083,8 +49338,6 @@ var ts;
return ts.visitEachChild(node, visitor, context);
case 149 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 261 /* SourceFile */:
- return visitSourceFileNode(node);
case 205 /* VariableStatement */:
return visitVariableStatement(node);
default:
@@ -49092,40 +49345,14 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 185 /* ArrowFunction */) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152 /* AsyncFunctionBody */)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- // keep track of the enclosing variable statement when in the context of
- // variable statements, variable declarations, binding elements, and binding
- // patterns.
- switch (currentNode.kind) {
- case 205 /* VariableStatement */:
- enclosingVariableStatement = currentNode;
- break;
- case 224 /* VariableDeclarationList */:
- case 223 /* VariableDeclaration */:
- case 174 /* BindingElement */:
- case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
- }
- currentParent = currentNode;
- currentNode = node;
+ function visitSourceFile(node) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
}
function visitSwitchStatement(node) {
ts.Debug.assert(convertedLoopState !== undefined);
@@ -49250,10 +49477,10 @@ var ts;
statements.push(exportStatement);
}
var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 33554432 /* HasEndOfDeclarationMarker */) === 0) {
+ if ((emitFlags & 2097152 /* HasEndOfDeclarationMarker */) === 0) {
// Add a DeclarationMarker as a marker for the end of the declaration
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(statement, emitFlags | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(statement, emitFlags | 2097152 /* HasEndOfDeclarationMarker */);
}
return ts.singleOrMany(statements);
}
@@ -49315,17 +49542,17 @@ var ts;
// To preserve the behavior of the old emitter, we explicitly indent
// the body of the function here if it was requested in an earlier
// transformation.
- if (ts.getEmitFlags(node) & 524288 /* Indented */) {
- ts.setEmitFlags(classFunction, 524288 /* Indented */);
+ if (ts.getEmitFlags(node) & 32768 /* Indented */) {
+ ts.setEmitFlags(classFunction, 32768 /* Indented */);
}
// "inner" and "outer" below are added purely to preserve source map locations from
// the old emitter
var inner = ts.createPartiallyEmittedExpression(classFunction);
inner.end = node.end;
- ts.setEmitFlags(inner, 49152 /* NoComments */);
+ ts.setEmitFlags(inner, 1536 /* NoComments */);
var outer = ts.createPartiallyEmittedExpression(inner);
outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152 /* NoComments */);
+ ts.setEmitFlags(outer, 1536 /* NoComments */);
return ts.createParen(ts.createCall(outer,
/*typeArguments*/ undefined, extendsClauseElement
? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
@@ -49350,14 +49577,14 @@ var ts;
// emit with the original emitter.
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152 /* NoComments */);
+ ts.setEmitFlags(outer, 1536 /* NoComments */);
var statement = ts.createReturn(outer);
statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 /* NoComments */ | 12288 /* NoTokenSourceMaps */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */);
statements.push(statement);
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true);
- ts.setEmitFlags(block, 49152 /* NoComments */);
+ ts.setEmitFlags(block, 1536 /* NoComments */);
return block;
}
/**
@@ -49369,7 +49596,7 @@ var ts;
*/
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)),
+ statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)),
/*location*/ extendsClauseElement));
}
}
@@ -49391,7 +49618,7 @@ var ts;
/*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper),
/*location*/ constructor || node);
if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256 /* CapturesThis */);
+ ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
}
@@ -49408,10 +49635,8 @@ var ts;
// `super` call.
// If this is the case, we do not include the synthetic `...args` parameter and
// will instead use the `arguments` object in ES5/3.
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)
+ || [];
}
/**
* Transforms the body of a constructor declaration of a class.
@@ -49424,21 +49649,21 @@ var ts;
*/
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
var statements = [];
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = -1;
if (hasSynthesizedSuper) {
// If a super call has already been synthesized,
// we're going to assume that we should just transform everything after that.
// The assumption is that no prior step in the pipeline has added any prologue directives.
- statementOffset = 1;
+ statementOffset = 0;
}
else if (constructor) {
// Otherwise, try to emit all potential prologue directives first.
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor);
}
if (constructor) {
- ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, /*convertObjectRest*/ false);
- ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -49466,7 +49691,7 @@ var ts;
/*location*/ constructor ? constructor.body : node,
/*multiLine*/ true);
if (!constructor) {
- ts.setEmitFlags(block, 49152 /* NoComments */);
+ ts.setEmitFlags(block, 1536 /* NoComments */);
}
return block;
}
@@ -49504,7 +49729,7 @@ var ts;
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (ctor) {
- ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
+ addCaptureThisForNodeIfNeeded(statements, ctor);
}
return 0 /* NoReplacement */;
}
@@ -49519,7 +49744,7 @@ var ts;
// for something like property initializers.
// Create a captured '_this' variable and assume it will subsequently be used.
if (hasSynthesizedSuper) {
- ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1 /* ReplaceSuperCapture */;
}
@@ -49558,12 +49783,12 @@ var ts;
ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
// Shift comments from the original super call to the return statement.
- ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 49152 /* NoComments */)));
+ ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536 /* NoComments */)));
statements.push(returnStatement);
return 2 /* ReplaceWithReturn */;
}
// Perform the capture.
- ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return 1 /* ReplaceSuperCapture */;
@@ -49572,7 +49797,7 @@ var ts;
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128 /* NoSubstitution */);
+ ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
}
@@ -49616,6 +49841,160 @@ var ts;
}
}
/**
+ * Gets a value indicating whether we need to add default value assignments for a
+ * function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 131072 /* ContainsDefaultValueAssignments */) !== 0;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains parameters with
+ * binding patterns or initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ */
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ // A rest parameter cannot have a binding pattern or an initializer,
+ // so let's just ignore it.
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_35)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer);
+ }
+ }
+ }
+ /**
+ * Adds statements to the body of a function-like node for parameters with binding patterns
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ // In cases where a binding pattern is simply '[]' or '{}',
+ // we usually don't want to emit a var declaration; however, in the presence
+ // of an initializer, we must emit that expression to preserve side effects.
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, temp))), 524288 /* CustomPrologue */));
+ }
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288 /* CustomPrologue */));
+ }
+ }
+ /**
+ * Adds statements to the body of a function-like node for parameters with initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)),
+ /*location*/ parameter))
+ ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */),
+ /*elseStatement*/ undefined,
+ /*location*/ parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */);
+ statements.push(statement);
+ }
+ /**
+ * Gets a value indicating whether we need to add statements to handle a rest parameter.
+ *
+ * @param node A ParameterDeclaration node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains a rest parameter.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ // `declarationName` is the name of the local declaration for the parameter.
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
+ // `expressionName` is the name of the parameter used in expressions.
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ // var param = [];
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName,
+ /*type*/ undefined, ts.createArrayLiteral([]))
+ ]),
+ /*location*/ parameter), 524288 /* CustomPrologue */));
+ // for (var _i = restIndex; _i < arguments.length; _i++) {
+ // param[_i - restIndex] = arguments[_i];
+ // }
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex))
+ ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"),
+ /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0
+ ? temp
+ : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)),
+ /*location*/ parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ /**
+ * Adds a statement to capture the `this` of a function declaration if it is needed.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A node.
+ */
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) {
+ captureThisForNode(statements, node, ts.createThis());
+ }
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this",
+ /*type*/ undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
+ /**
* Adds statements to the class body function for a class to define the members of the
* class.
*
@@ -49665,18 +50044,18 @@ var ts;
function transformClassMethodDeclarationToStatement(receiver, member) {
var commentRange = ts.getCommentRange(member);
var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined);
- ts.setEmitFlags(func, 49152 /* NoComments */);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName),
- /*location*/ member.name), func),
+ var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name);
+ var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined);
+ ts.setEmitFlags(memberFunction, 1536 /* NoComments */);
+ ts.setSourceMapRange(memberFunction, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction),
/*location*/ member);
ts.setOriginalNode(statement, member);
ts.setCommentRange(statement, commentRange);
// The location for the statement is used to emit comments only.
// No source map should be emitted for this statement to align with the
// old emitter.
- ts.setEmitFlags(statement, 1536 /* NoSourceMap */);
+ ts.setEmitFlags(statement, 48 /* NoSourceMap */);
return statement;
}
/**
@@ -49691,7 +50070,7 @@ var ts;
// The location for the statement is used to emit source maps only.
// No comments should be emitted for this statement to align with the
// old emitter.
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
return statement;
}
/**
@@ -49705,16 +50084,16 @@ var ts;
// To align with source maps in the old emitter, the receiver and property name
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 /* NoComments */ | 1024 /* NoTrailingSourceMap */);
+ ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 512 /* NoLeadingSourceMap */);
+ ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
var properties = [];
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- ts.setEmitFlags(getterFunction, 16384 /* NoLeadingComments */);
+ ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -49722,7 +50101,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- ts.setEmitFlags(setterFunction, 16384 /* NoLeadingComments */);
+ ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -49745,11 +50124,17 @@ var ts;
* @param node An ArrowFunction node.
*/
function visitArrowFunction(node) {
- if (node.transformFlags & 262144 /* ContainsLexicalThis */) {
+ if (node.transformFlags & 16384 /* ContainsLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
- var func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined);
- ts.setEmitFlags(func, 256 /* CapturesThis */);
+ var func = ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ ts.setEmitFlags(func, 8 /* CapturesThis */);
return func;
}
/**
@@ -49758,7 +50143,12 @@ var ts;
* @param node a FunctionExpression node.
*/
function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, /*location*/ node, node.name);
+ return ts.updateFunctionExpression(node,
+ /*modifiers*/ undefined, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, node.transformFlags & 64 /* ES2015 */
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
* Visits a FunctionDeclaration node.
@@ -49766,12 +50156,12 @@ var ts;
* @param node a FunctionDeclaration node.
*/
function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis),
- /*location*/ node),
- /*original*/ node);
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, node.transformFlags & 64 /* ES2015 */
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
* Transforms a function-like node into a FunctionExpression.
@@ -49787,13 +50177,87 @@ var ts;
}
var expression = ts.setOriginalNode(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location),
/*original*/ node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
/**
+ * Transforms the body of a function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function transformFunctionBody(node) {
+ var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
+ var singleLine = false; // indicates whether the block *may* be emitted as a single line
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ resumeLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ // ensureUseStrict is false because no new prologue-directive should be added.
+ // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
+ // If we added any generated statements, this must be a multi-line block.
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ // If the original body was a multi-line block, this must be a multi-line block.
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 185 /* ArrowFunction */);
+ // To align with the old emitter, we use a synthetic end position on the location
+ // for the statement list we synthesize when we down-level an arrow function with
+ // an expression function body. This prevents both comments and source maps from
+ // being emitted for the end position only.
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, /*location*/ body);
+ ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);
+ statements.push(returnStatement);
+ // To align with the source map emit for the old emitter, we set a custom
+ // source map location for the close brace.
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ // If we added any final generated statements, this must be a multi-line block
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 1 /* SingleLine */);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
+ }
+ /**
* Visits an ExpressionStatement that contains a destructuring assignment.
*
* @param node An ExpressionStatement node.
@@ -49817,14 +50281,12 @@ var ts;
*/
function visitParenthesizedExpression(node, needsDestructuringValue) {
// If we are here it is most likely because our expression is a destructuring assignment.
- if (needsDestructuringValue) {
+ if (!needsDestructuringValue) {
switch (node.expression.kind) {
case 183 /* ParenthesizedExpression */:
- return ts.createParen(visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ true),
- /*location*/ node);
+ return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
case 192 /* BinaryExpression */:
- return ts.createParen(visitBinaryExpression(node.expression, /*needsDestructuringValue*/ true),
- /*location*/ node);
+ return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
return ts.visitEachChild(node, visitor, context);
@@ -49838,8 +50300,9 @@ var ts;
*/
function visitBinaryExpression(node, needsDestructuringValue) {
// If we are here it is because this is a destructuring assignment.
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ if (ts.isDestructuringAssignment(node)) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue);
+ }
}
function visitVariableStatement(node) {
if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) {
@@ -49851,7 +50314,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*createAssignmentCallback*/ undefined, visitor);
+ assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -49884,7 +50347,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 67108864 /* ContainsBindingPattern */
+ if (node.transformFlags & 8388608 /* ContainsBindingPattern */
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
// If the first or last declaration is a binding pattern, we need to modify
@@ -49972,9 +50435,9 @@ var ts;
return visitVariableDeclaration(node);
}
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_5 = ts.getMutableClone(node);
- clone_5.initializer = ts.createVoidZero();
- return clone_5;
+ var clone_3 = ts.getMutableClone(node);
+ clone_3.initializer = ts.createVoidZero();
+ return clone_3;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -49986,9 +50449,10 @@ var ts;
function visitVariableDeclaration(node) {
// If we are here it is because the name contains a binding pattern.
if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1 /* Export */);
- return ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ var hoistTempVariables = enclosingVariableStatement
+ && ts.hasModifier(enclosingVariableStatement, 1 /* Export */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */,
+ /*value*/ undefined, hoistTempVariables);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -50032,7 +50496,118 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, /*transformRest*/ false);
+ // The following ES6 code:
+ //
+ // for (let v of expr) { }
+ //
+ // should be emitted as
+ //
+ // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
+ // var v = _a[_i];
+ // }
+ //
+ // where _a and _i are temps emitted to capture the RHS and the counter,
+ // respectively.
+ // When the left hand side is an expression instead of a let declaration,
+ // the "let v" is not emitted.
+ // When the left hand side is a let/const, the v is renamed if there is
+ // another v in scope.
+ // Note that all assignments to the LHS are emitted in the body, including
+ // all destructuring.
+ // Note also that because an extra statement is needed to assign to the LHS,
+ // for-of bodies are always emitted as blocks.
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ // In the case where the user wrote an identifier as the RHS, like this:
+ //
+ // for (let v of arr) { }
+ //
+ // we don't want to emit a temporary variable for the RHS, just use it directly.
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70 /* Identifier */
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var elementAccess = ts.createElementAccess(rhsReference, counter);
+ // Initialize LHS
+ // var v = _a[_i];
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3 /* BlockScoped */) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ // This works whether the declaration is a var, let, or const.
+ // It will use rhsIterationValue _a[_i] as the initializer.
+ var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess);
+ var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ // Adjust the source map range for the first declaration to align with the old
+ // emitter.
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, declarationList));
+ }
+ else {
+ // The following call does not include the initializer, so we have
+ // to emit it separately.
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined),
+ /*type*/ undefined, ts.createElementAccess(rhsReference, counter))
+ ], /*location*/ ts.moveRangePos(initializer, -1)), initializer),
+ /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ // Initializer is an expression. Emit the expression in the body, so that it's
+ // evaluated on every iteration.
+ var assignment = ts.createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ // This is a destructuring pattern, so we flatten the destructuring instead.
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */)));
+ }
+ else {
+ // Currently there is not way to check that assignment is binary expression of destructing assignment
+ // so we have to cast never type to binaryExpression
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ // The old emitter does not emit source maps for the expression
+ ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression));
+ // The old emitter does not emit source maps for the block.
+ // We add the location to preserve comments.
+ var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation),
+ /*location*/ bodyLocation);
+ ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */);
+ var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
+ ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"),
+ /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body,
+ /*location*/ node);
+ // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
+ ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */);
+ return forStatement;
}
/**
* Visits an ObjectLiteralExpression with computed propety names.
@@ -50048,7 +50623,7 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 134217728 /* ContainsYield */
+ if (property.transformFlags & 16777216 /* ContainsYield */
|| property.name.kind === 142 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
@@ -50061,7 +50636,7 @@ var ts;
// Write out the first non-computed properties, then emit the rest through indexing on the temp variable.
var expressions = [];
var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties),
- /*location*/ undefined, node.multiLine), 524288 /* Indented */));
+ /*location*/ undefined, node.multiLine), 32768 /* Indented */));
if (node.multiLine) {
assignment.startsOnNewLine = true;
}
@@ -50159,22 +50734,22 @@ var ts;
var currentState = convertedLoopState;
convertedLoopState = outerConvertedLoopState;
if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_3);
- loopBody = ts.createBlock(statements_3, /*location*/ undefined, /*multiline*/ true);
+ var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4);
+ loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true);
}
if (!ts.isBlock(loopBody)) {
loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true);
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152 /* AsyncFunctionBody */) !== 0
- && (node.statement.transformFlags & 134217728 /* ContainsYield */) !== 0;
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0
+ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256 /* CapturesThis */;
+ loopBodyFlags |= 8 /* CapturesThis */;
}
if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152 /* AsyncFunctionBody */;
+ loopBodyFlags |= 131072 /* AsyncFunctionBody */;
}
var convertedLoopVariable = ts.createVariableStatement(
/*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
@@ -50184,7 +50759,7 @@ var ts;
/*name*/ undefined,
/*typeParameters*/ undefined, loopParameters,
/*type*/ undefined, loopBody), loopBodyFlags))
- ]), 16777216 /* NoHoisting */));
+ ]), 1048576 /* NoHoisting */));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
// propagate state from the inner loop to the outer loop if necessary
@@ -50465,7 +51040,7 @@ var ts;
ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));
var temp = ts.createTempVariable(undefined);
var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);
- var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor);
+ var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp);
var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags);
var destructure = ts.createVariableStatement(undefined, list);
return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
@@ -50486,7 +51061,7 @@ var ts;
// Methods with computed property names are handled in visitObjectLiteralExpression.
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined);
- ts.setEmitFlags(functionExpression, 16384 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression));
+ ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression));
return ts.createPropertyAssignment(node.name, functionExpression,
/*location*/ node);
}
@@ -50533,10 +51108,10 @@ var ts;
// because we contain a SpreadElementExpression.
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
if (node.expression.kind === 96 /* SuperKeyword */) {
- ts.setEmitFlags(thisArg, 128 /* NoSubstitution */);
+ ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall;
- if (node.transformFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (node.transformFlags & 524288 /* ContainsSpread */) {
// [source]
// f(...a, b)
// x.m(...a, b)
@@ -50567,7 +51142,7 @@ var ts;
}
if (node.expression.kind === 96 /* SuperKeyword */) {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128 /* NoSubstitution */);
+ ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
return assignToCapturedThis
? ts.createAssignment(ts.createIdentifier("_this"), initializer)
@@ -50582,7 +51157,7 @@ var ts;
*/
function visitNewExpression(node) {
// We are here because we contain a SpreadElementExpression.
- ts.Debug.assert((node.transformFlags & 8388608 /* ContainsSpreadExpression */) !== 0);
+ ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0);
// [source]
// new C(...a)
//
@@ -50632,6 +51207,9 @@ var ts;
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression),
/*location*/ undefined, multiLine);
}
+ function visitSpreadElement(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
/**
* Transforms the expression of a SpreadExpression node.
*
@@ -50798,18 +51376,6 @@ var ts;
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, /*location*/ node.statements);
- return clone;
- }
/**
* Called by the printer just before a node is printed.
*
@@ -50935,7 +51501,7 @@ var ts;
function substituteThisKeyword(node) {
if (enabledSubstitutions & 1 /* CapturedThis */
&& enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256 /* CapturesThis */) {
+ && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) {
return ts.createIdentifier("_this", /*location*/ node);
}
return node;
@@ -50948,8 +51514,7 @@ var ts;
if (!constructor || !hasExtendsClause) {
return false;
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ if (ts.some(constructor.parameters)) {
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
@@ -50969,10 +51534,24 @@ var ts;
return false;
}
var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ return ts.isIdentifier(expression) && expression.text === "arguments";
}
}
ts.transformES2015 = transformES2015;
+ function createExtendsHelper(context, name) {
+ context.requestEmitHelper(extendsHelper);
+ return ts.createCall(ts.getHelperName("__extends"),
+ /*typeArguments*/ undefined, [
+ name,
+ ts.createIdentifier("_super")
+ ]);
+ }
+ var extendsHelper = {
+ name: "typescript:extends",
+ scoped: false,
+ priority: 0,
+ text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };"
+ };
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
@@ -51154,7 +51733,7 @@ var ts;
_a[7 /* Endfinally */] = "endfinally",
_a));
function transformGenerators(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var resolver = context.getEmitResolver();
@@ -51204,15 +51783,15 @@ var ts;
var withBlockStack; // A stack containing `with` blocks.
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
+ if (ts.isDeclarationFile(node)
+ || (node.transformFlags & 512 /* ContainsGenerator */) === 0) {
return node;
}
- if (node.transformFlags & 8192 /* ContainsGenerator */) {
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- }
- return node;
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
/**
* Visits a node.
@@ -51227,10 +51806,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 4096 /* Generator */) {
+ else if (transformFlags & 256 /* Generator */) {
return visitGenerator(node);
}
- else if (transformFlags & 8192 /* ContainsGenerator */) {
+ else if (transformFlags & 512 /* ContainsGenerator */) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51283,10 +51862,10 @@ var ts;
case 216 /* ReturnStatement */:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 134217728 /* ContainsYield */) {
+ if (node.transformFlags & 16777216 /* ContainsYield */) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (8192 /* ContainsGenerator */ | 268435456 /* ContainsHoistedDeclarationOrCompletion */)) {
+ else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51348,12 +51927,11 @@ var ts;
*/
function visitFunctionDeclaration(node) {
// Currently, we only support generators that were originally async functions.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
node = ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
+ /*decorators*/ undefined, node.modifiers,
/*asteriskToken*/ undefined, node.name,
- /*typeParameters*/ undefined, node.parameters,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
/*type*/ undefined, transformGeneratorFunctionBody(node.body),
/*location*/ node), node);
}
@@ -51387,11 +51965,11 @@ var ts;
*/
function visitFunctionExpression(node) {
// Currently, we only support generators that were originally async functions.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
node = ts.setOriginalNode(ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined, node.name,
- /*typeParameters*/ undefined, node.parameters,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
/*type*/ undefined, transformGeneratorFunctionBody(node.body),
/*location*/ node), node);
}
@@ -51460,7 +52038,7 @@ var ts;
operationLocations = undefined;
state = ts.createTempVariable(/*recordTempVariable*/ undefined);
// Build the generator
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
@@ -51491,13 +52069,13 @@ var ts;
* @param node The node to visit.
*/
function visitVariableStatement(node) {
- if (node.transformFlags & 134217728 /* ContainsYield */) {
+ if (node.transformFlags & 16777216 /* ContainsYield */) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
else {
// Do not hoist custom prologues.
- if (ts.getEmitFlags(node) & 8388608 /* CustomPrologue */) {
+ if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) {
return node;
}
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
@@ -51614,10 +52192,10 @@ var ts;
// _a = a();
// .yield resumeLabel
// _a + %sent% + c()
- var clone_6 = ts.getMutableClone(node);
- clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_6;
+ var clone_4 = ts.getMutableClone(node);
+ clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_4;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -51770,7 +52348,7 @@ var ts;
* @param node The node to visit.
*/
function visitArrayLiteralExpression(node) {
- return visitElements(node.elements, node.multiLine);
+ return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine);
}
/**
* Visits an array of expressions containing one or more YieldExpression nodes
@@ -51779,7 +52357,7 @@ var ts;
* @param elements The elements to visit.
* @param multiLine Whether array literals created should be emitted on multiple lines.
*/
- function visitElements(elements, _multiLine) {
+ function visitElements(elements, leadingElement, location, multiLine) {
// [source]
// ar = [1, yield, 2];
//
@@ -51793,19 +52371,24 @@ var ts;
var temp = declareLocal();
var hasAssignedTemp = false;
if (numInitialElements > 0) {
- emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements)));
+ var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
+ emitAssignment(temp, ts.createArrayLiteral(leadingElement
+ ? [leadingElement].concat(initialElements) : initialElements));
+ leadingElement = undefined;
hasAssignedTemp = true;
}
var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
return hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions);
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);
function reduceElement(expressions, element) {
if (containsYield(element) && expressions.length > 0) {
emitAssignment(temp, hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions));
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions,
+ /*location*/ undefined, multiLine));
hasAssignedTemp = true;
+ leadingElement = undefined;
expressions = [];
}
expressions.push(ts.visitNode(element, visitor, ts.isExpression));
@@ -51871,10 +52454,10 @@ var ts;
// .yield resumeLabel
// .mark resumeLabel
// a = _a[%sent%]
- var clone_7 = ts.getMutableClone(node);
- clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_7;
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_5;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -51909,7 +52492,8 @@ var ts;
// .mark resumeLabel
// new (_b.apply(_a, _c.concat([%sent%, 2])));
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)),
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments,
+ /*leadingElement*/ ts.createVoidZero())),
/*typeArguments*/ undefined, [],
/*location*/ node), node);
}
@@ -52532,7 +53116,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 134217728 /* ContainsYield */) !== 0;
+ return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -52562,12 +53146,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_35) {
- var clone_8 = ts.getMutableClone(name_35);
- ts.setSourceMapRange(clone_8, node);
- ts.setCommentRange(clone_8, node);
- return clone_8;
+ var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_36) {
+ var clone_6 = ts.getMutableClone(name_36);
+ ts.setSourceMapRange(clone_6, node);
+ ts.setCommentRange(clone_6, node);
+ return clone_6;
}
}
}
@@ -53153,18 +53737,14 @@ var ts;
currentExceptionBlock = undefined;
withBlockStack = undefined;
var buildResult = buildStatements();
- return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"),
- /*typeArguments*/ undefined, [
- ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)],
- /*type*/ undefined, ts.createBlock(buildResult,
- /*location*/ undefined,
- /*multiLine*/ buildResult.length > 0)), 4194304 /* ReuseTempVariableScope */)
- ]);
+ return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)],
+ /*type*/ undefined, ts.createBlock(buildResult,
+ /*location*/ undefined,
+ /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */));
}
/**
* Builds the statements for the generator function body.
@@ -53535,6 +54115,76 @@ var ts;
}
}
ts.transformGenerators = transformGenerators;
+ function createGeneratorHelper(context, body) {
+ context.requestEmitHelper(generatorHelper);
+ return ts.createCall(ts.getHelperName("__generator"),
+ /*typeArguments*/ undefined, [ts.createThis(), body]);
+ }
+ // The __generator helper is used by down-level transformations to emulate the runtime
+ // semantics of an ES2015 generator function. When called, this helper returns an
+ // object that implements the Iterator protocol, in that it has `next`, `return`, and
+ // `throw` methods that step through the generator when invoked.
+ //
+ // parameters:
+ // thisArg The value to use as the `this` binding for the transformed generator body.
+ // body A function that acts as the transformed generator body.
+ //
+ // variables:
+ // _ Persistent state for the generator that is shared between the helper and the
+ // generator body. The state object has the following members:
+ // sent() - A method that returns or throws the current completion value.
+ // label - The next point at which to resume evaluation of the generator body.
+ // trys - A stack of protected regions (try/catch/finally blocks).
+ // ops - A stack of pending instructions when inside of a finally block.
+ // f A value indicating whether the generator is executing.
+ // y An iterator to delegate for a yield*.
+ // t A temporary variable that holds one of the following values (note that these
+ // cases do not overlap):
+ // - The completion value when resuming from a `yield` or `yield*`.
+ // - The error value for a catch block.
+ // - The current protected region (array of try/catch/finally/end labels).
+ // - The verb (`next`, `throw`, or `return` method) to delegate to the expression
+ // of a `yield*`.
+ // - The result of evaluating the verb delegated to the expression of a `yield*`.
+ //
+ // functions:
+ // verb(n) Creates a bound callback to the `step` function for opcode `n`.
+ // step(op) Evaluates opcodes in a generator body until execution is suspended or
+ // completed.
+ //
+ // The __generator helper understands a limited set of instructions:
+ // 0: next(value?) - Start or resume the generator with the specified value.
+ // 1: throw(error) - Resume the generator with an exception. If the generator is
+ // suspended inside of one or more protected regions, evaluates
+ // any intervening finally blocks between the current label and
+ // the nearest catch block or function boundary. If uncaught, the
+ // exception is thrown to the caller.
+ // 2: return(value?) - Resume the generator as if with a return. If the generator is
+ // suspended inside of one or more protected regions, evaluates any
+ // intervening finally blocks.
+ // 3: break(label) - Jump to the specified label. If the label is outside of the
+ // current protected region, evaluates any intervening finally
+ // blocks.
+ // 4: yield(value?) - Yield execution to the caller with an optional value. When
+ // resumed, the generator will continue at the next label.
+ // 5: yield*(value) - Delegates evaluation to the supplied iterator. When
+ // delegation completes, the generator will continue at the next
+ // label.
+ // 6: catch(error) - Handles an exception thrown from within the generator body. If
+ // the current label is inside of one or more protected regions,
+ // evaluates any intervening finally blocks between the current
+ // label and the nearest catch block or function boundary. If
+ // uncaught, the exception is thrown to the caller.
+ // 7: endfinally - Ends a finally block, resuming the last instruction prior to
+ // entering a finally block.
+ //
+ // For examples of how these are used, see the comments in ./transformers/generators.ts
+ var generatorHelper = {
+ name: "typescript:generator",
+ scoped: false,
+ priority: 6,
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
+ };
var _a;
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
@@ -53623,13 +54273,32 @@ var ts;
(function (ts) {
function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableEmitNotification(261 /* SourceFile */);
+ context.enableSubstitution(70 /* Identifier */);
+ var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
+ var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
+ if (externalHelpersModuleName) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements);
+ ts.append(statements, ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ }
+ else {
+ return ts.visitEachChild(node, visitor, context);
+ }
}
return node;
}
@@ -53647,6 +54316,51 @@ var ts;
// Elide `export=` as it is not legal with --module ES6
return node.isExportEquals ? undefined : node;
}
+ //
+ // Emit Notification
+ //
+ /**
+ * Hook for node emit.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to emit.
+ * @param emit A callback used to emit the node in the printer.
+ */
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (ts.isSourceFile(node)) {
+ currentSourceFile = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ //
+ // Substitutions
+ //
+ /**
+ * Hooks node substitutions.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to substitute.
+ */
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) {
+ return substituteExpressionIdentifier(node);
+ }
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ }
+ return node;
+ }
}
ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
@@ -53708,13 +54422,14 @@ var ts;
// The only exception in this rule is postfix unary operators,
// see comment to 'substitutePostfixUnaryExpression' for more details
// Collect information about the external module and dependency groups.
- moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
// Make sure that the name of the 'exports' function does not conflict with
// existing identifiers.
exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
contextObject = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -53723,7 +54438,7 @@ var ts;
ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction),
ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject)
],
- /*type*/ undefined, createSystemModuleBody(node, dependencyGroups));
+ /*type*/ undefined, moduleBodyBlock);
// Write the call to `System.register`
// Clear the emit-helpers flag for later passes since we'll have already used it in the module body
// So the helper will be emit at the correct position instead of at the top of the source-file
@@ -53735,7 +54450,9 @@ var ts;
? [moduleName, dependencies, moduleBodyFunction]
: [dependencies, moduleBodyFunction]))
], node.statements));
- ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1 /* EmitEmitHelpers */);
+ if (!(compilerOptions.outFile || compilerOptions.out)) {
+ ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
+ }
if (noSubstitution) {
noSubstitutionMap[id] = noSubstitution;
noSubstitution = undefined;
@@ -53835,6 +54552,8 @@ var ts;
ts.createVariableDeclaration("__moduleName",
/*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
])));
+ // Visit the synthetic external helpers import declaration if present
+ ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true);
// Visit the statements of the source file, emitting any transformations into
// the `executeStatements` array. We do this *before* we fill the `setters` array
// as we both emit transformations as well as aggregate some data used when creating
@@ -53861,9 +54580,7 @@ var ts;
/*multiLine*/ true)))
]),
/*multiLine*/ true)));
- var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
- ts.setEmitFlags(body, 1 /* EmitEmitHelpers */);
- return body;
+ return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
}
/**
* Adds an exportStar function to a statement list if it is needed for the file.
@@ -53948,7 +54665,8 @@ var ts;
var exports = ts.createIdentifier("exports");
var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"),
+ /*typeArguments*/ undefined, [n])));
}
return ts.createFunctionDeclaration(
/*decorators*/ undefined,
@@ -53964,7 +54682,7 @@ var ts;
ts.createForIn(ts.createVariableDeclarationList([
ts.createVariableDeclaration(n, /*type*/ undefined)
]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */)
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */)
])),
ts.createStatement(ts.createCall(exportFunction,
/*typeArguments*/ undefined, [exports]))
@@ -54237,7 +54955,7 @@ var ts;
*/
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
- return (ts.getEmitFlags(node) & 16777216 /* NoHoisting */) === 0
+ return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0
&& (enclosingBlockScopedContainer.kind === 261 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
@@ -54250,7 +54968,8 @@ var ts;
function transformInitializedVariable(node, isExportedDeclaration) {
var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
return ts.isBindingPattern(node.name)
- ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */,
+ /*needsValue*/ false, createAssignment)
: createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
}
/**
@@ -54314,7 +55033,7 @@ var ts;
* @param node The node to test.
*/
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;
}
/**
* Visits a DeclarationMarker used as a placeholder for the end of a transformed
@@ -54515,7 +55234,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value));
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
}
return statement;
}
@@ -54573,9 +55292,9 @@ var ts;
return visitCatchClause(node);
case 204 /* Block */:
return visitBlock(node);
- case 294 /* MergeDeclarationMarker */:
+ case 295 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 295 /* EndOfDeclarationMarker */:
+ case 296 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringVisitor(node);
@@ -54754,11 +55473,11 @@ var ts;
* @param node The node to visit.
*/
function destructuringVisitor(node) {
- if (node.transformFlags & 16384 /* DestructuringAssignment */
+ if (node.transformFlags & 1024 /* DestructuringAssignment */
&& node.kind === 192 /* BinaryExpression */) {
return visitDestructuringAssignment(node);
}
- else if (node.transformFlags & 32768 /* ContainsDestructuringAssignment */) {
+ else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) {
return ts.visitEachChild(node, destructuringVisitor, context);
}
else {
@@ -54772,7 +55491,8 @@ var ts;
*/
function visitDestructuringAssignment(node) {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
- return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration, destructuringVisitor);
+ return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */,
+ /*needsValue*/ true);
}
return ts.visitEachChild(node, destructuringVisitor, context);
}
@@ -54896,6 +55616,13 @@ var ts;
* @param node The node to substitute.
*/
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
// When we see an identifier in an expression position that
// points to an imported symbol, we should substitute a qualified
// reference to the imported symbol if one is needed.
@@ -55043,7 +55770,7 @@ var ts;
_a[ts.ModuleKind.AMD] = transformAMDModule,
_a[ts.ModuleKind.UMD] = transformUMDModule,
_a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
@@ -55077,7 +55804,7 @@ var ts;
return node;
}
currentSourceFile = node;
- currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
// Perform the transformation.
var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule(node);
@@ -55094,12 +55821,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node));
+ ts.addEmitHelper(updated, exportStarHelper);
}
return updated;
}
@@ -55119,8 +55847,7 @@ var ts;
* @param node The SourceFile node.
*/
function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16 /* UMDDefine */);
+ var define = ts.createRawExpression(umdHelper);
return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false);
}
/**
@@ -55217,7 +55944,7 @@ var ts;
if (includeNonAmdDependencies && importAliasName) {
// Set emitFlags on the name of the classDeclaration
// This is so that when printer will not substitute the identifier
- ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */);
+ ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName));
}
@@ -55237,6 +55964,7 @@ var ts;
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
// Visit each statement of the module body.
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
// End the lexical environment for the module body
// and merge any new lexical declarations.
@@ -55247,7 +55975,7 @@ var ts;
if (currentModuleInfo.hasExportStarsToExportValues) {
// If we have any `export * from ...` declarations
// we need to inform the emitter to add the __export helper.
- ts.setEmitFlags(body, 2 /* EmitExportStar */);
+ ts.addEmitHelper(body, exportStarHelper);
}
return body;
}
@@ -55264,13 +55992,13 @@ var ts;
if (emitAsReturn) {
var statement = ts.createReturn(currentModuleInfo.exportEquals.expression,
/*location*/ currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */);
statements.push(statement);
}
else {
var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression),
/*location*/ currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
statements.push(statement);
}
}
@@ -55299,9 +56027,9 @@ var ts;
return visitFunctionDeclaration(node);
case 226 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 294 /* MergeDeclarationMarker */:
+ case 295 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 295 /* EndOfDeclarationMarker */:
+ case 296 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
// This visitor does not descend into the tree, as export/import statements
@@ -55590,7 +56318,9 @@ var ts;
*/
function transformInitializedVariable(node) {
if (ts.isBindingPattern(node.name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ return ts.flattenDestructuringAssignment(node,
+ /*visitor*/ undefined, context, 0 /* All */,
+ /*needsValue*/ false, createExportExpression);
}
else {
return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name,
@@ -55623,7 +56353,7 @@ var ts;
* @param node The node to test.
*/
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;
}
/**
* Visits a DeclarationMarker used as a placeholder for the end of a transformed
@@ -55826,7 +56556,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value), location);
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
}
return statement;
}
@@ -55947,6 +56677,13 @@ var ts;
* @param node The node to substitute.
*/
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
if (exportContainer && exportContainer.kind === 261 /* SourceFile */) {
@@ -55960,8 +56697,8 @@ var ts;
/*location*/ node);
}
else if (ts.isImportSpecifier(importDeclaration)) {
- var name_36 = importDeclaration.propertyName || importDeclaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36),
+ var name_37 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37),
/*location*/ node);
}
}
@@ -56057,6 +56794,14 @@ var ts;
var _a;
}
ts.transformModule = transformModule;
+ // emit output for the __export helper function
+ var exportStarHelper = {
+ name: "typescript:export-star",
+ scoped: true,
+ text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }"
+ };
+ // emit output for the UMD helper function.
+ var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })";
})(ts || (ts = {}));
/// <reference path="visitor.ts" />
/// <reference path="transformers/ts.ts" />
@@ -56126,23 +56871,29 @@ var ts;
* @param transforms An array of Transformers.
*/
function transformFiles(resolver, host, sourceFiles, transformers) {
+ var enabledSyntaxKindFeatures = new Array(298 /* Count */);
+ var lexicalEnvironmentDisabled = false;
+ var lexicalEnvironmentVariableDeclarations;
+ var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(296 /* Count */);
var lexicalEnvironmentStackOffset = 0;
- var hoistedVariableDeclarations;
- var hoistedFunctionDeclarations;
- var lexicalEnvironmentDisabled;
+ var lexicalEnvironmentSuspended = false;
+ var emitHelpers;
// The transformation context is provided to each transformer as part of transformer
// initialization.
var context = {
getCompilerOptions: function () { return host.getCompilerOptions(); },
getEmitResolver: function () { return resolver; },
getEmitHost: function () { return host; },
- hoistVariableDeclaration: hoistVariableDeclaration,
- hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
+ suspendLexicalEnvironment: suspendLexicalEnvironment,
+ resumeLexicalEnvironment: resumeLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
+ hoistVariableDeclaration: hoistVariableDeclaration,
+ hoistFunctionDeclaration: hoistFunctionDeclaration,
+ requestEmitHelper: requestEmitHelper,
+ readEmitHelpers: readEmitHelpers,
onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
@@ -56183,7 +56934,7 @@ var ts;
*/
function isSubstitutionEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0
- && (ts.getEmitFlags(node) & 128 /* NoSubstitution */) === 0;
+ && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0;
}
/**
* Emits a node with possible substitution.
@@ -56216,7 +56967,7 @@ var ts;
*/
function isEmitNotificationEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0
- || (ts.getEmitFlags(node) & 64 /* AdviseOnEmitNode */) !== 0;
+ || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0;
}
/**
* Emits a node with possible emit notification.
@@ -56241,11 +56992,11 @@ var ts;
function hoistVariableDeclaration(name) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
var decl = ts.createVariableDeclaration(name);
- if (!hoistedVariableDeclarations) {
- hoistedVariableDeclarations = [decl];
+ if (!lexicalEnvironmentVariableDeclarations) {
+ lexicalEnvironmentVariableDeclarations = [decl];
}
else {
- hoistedVariableDeclarations.push(decl);
+ lexicalEnvironmentVariableDeclarations.push(decl);
}
}
/**
@@ -56253,11 +57004,11 @@ var ts;
*/
function hoistFunctionDeclaration(func) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
- if (!hoistedFunctionDeclarations) {
- hoistedFunctionDeclarations = [func];
+ if (!lexicalEnvironmentFunctionDeclarations) {
+ lexicalEnvironmentFunctionDeclarations = [func];
}
else {
- hoistedFunctionDeclarations.push(func);
+ lexicalEnvironmentFunctionDeclarations.push(func);
}
}
/**
@@ -56266,15 +57017,28 @@ var ts;
*/
function startLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
// Save the current lexical environment. Rather than resizing the array we adjust the
// stack size variable. This allows us to reuse existing array slots we've
// already allocated between transformations to avoid allocation and GC overhead during
// transformation.
- lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations;
- lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations;
+ lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
+ lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStackOffset++;
- hoistedVariableDeclarations = undefined;
- hoistedFunctionDeclarations = undefined;
+ lexicalEnvironmentVariableDeclarations = undefined;
+ lexicalEnvironmentFunctionDeclarations = undefined;
+ }
+ /** Suspends the current lexical environment, usually after visiting a parameter list. */
+ function suspendLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
+ lexicalEnvironmentSuspended = true;
+ }
+ /** Resumes a suspended lexical environment, usually before visiting a function body. */
+ function resumeLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase.");
+ ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
+ lexicalEnvironmentSuspended = false;
}
/**
* Ends a lexical environment. The previous set of hoisted declarations are restored and
@@ -56282,14 +57046,15 @@ var ts;
*/
function endLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
var statements;
- if (hoistedVariableDeclarations || hoistedFunctionDeclarations) {
- if (hoistedFunctionDeclarations) {
- statements = hoistedFunctionDeclarations.slice();
+ if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
+ if (lexicalEnvironmentFunctionDeclarations) {
+ statements = lexicalEnvironmentFunctionDeclarations.slice();
}
- if (hoistedVariableDeclarations) {
+ if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations));
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
if (!statements) {
statements = [statement];
}
@@ -56300,10 +57065,25 @@ var ts;
}
// Restore the previous lexical environment.
lexicalEnvironmentStackOffset--;
- hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
- hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ if (lexicalEnvironmentStackOffset === 0) {
+ lexicalEnvironmentVariableDeclarationsStack = [];
+ lexicalEnvironmentFunctionDeclarationsStack = [];
+ }
return statements;
}
+ function requestEmitHelper(helper) {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
+ emitHelpers = ts.append(emitHelpers, helper);
+ }
+ function readEmitHelpers() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ var helpers = emitHelpers;
+ emitHelpers = undefined;
+ return helpers;
+ }
}
ts.transformFiles = transformFiles;
var _a;
@@ -56528,12 +57308,12 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 292 /* NotEmittedStatement */
- && (emitFlags & 512 /* NoLeadingSourceMap */) === 0
+ if (node.kind !== 293 /* NotEmittedStatement */
+ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
}
- if (emitFlags & 2048 /* NoNestedSourceMaps */) {
+ if (emitFlags & 64 /* NoNestedSourceMaps */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56541,8 +57321,8 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 292 /* NotEmittedStatement */
- && (emitFlags & 1024 /* NoTrailingSourceMap */) === 0
+ if (node.kind !== 293 /* NotEmittedStatement */
+ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitPos(end);
}
@@ -56564,13 +57344,13 @@ var ts;
var emitFlags = emitNode && emitNode.flags;
var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);
- if ((emitFlags & 4096 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
tokenPos = emitCallback(token, tokenPos);
if (range)
tokenPos = range.end;
- if ((emitFlags & 8192 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
return tokenPos;
@@ -56707,7 +57487,7 @@ var ts;
var emitFlags = ts.getEmitFlags(node);
if ((pos < 0 && end < 0) || (pos === end)) {
// Both pos and end are synthesized, so just emit the node without comments.
- if (emitFlags & 65536 /* NoNestedComments */) {
+ if (emitFlags & 2048 /* NoNestedComments */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56720,9 +57500,9 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 292 /* NotEmittedStatement */;
- var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0;
- var skipTrailingComments = end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0;
+ var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;
+ var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;
// Emit leading comments if the position is not synthesized and the node
// has not opted out from emitting leading comments.
if (!skipLeadingComments) {
@@ -56746,7 +57526,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitNodeWithComment");
}
- if (emitFlags & 65536 /* NoNestedComments */) {
+ if (emitFlags & 2048 /* NoNestedComments */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56778,15 +57558,15 @@ var ts;
}
var pos = detachedRange.pos, end = detachedRange.end;
var emitFlags = ts.getEmitFlags(node);
- var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0;
- var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;
+ var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;
if (!skipLeadingComments) {
emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
}
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments");
}
- if (emitFlags & 65536 /* NoNestedComments */ && !disabled) {
+ if (emitFlags & 2048 /* NoNestedComments */ && !disabled) {
disabled = true;
emitCallback(node);
disabled = false;
@@ -57241,15 +58021,15 @@ var ts;
}
}
function emitLines(nodes) {
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
emit(node);
}
}
function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {
var currentWriterPos = writer.getTextPos();
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (!canEmitFn || canEmitFn(node)) {
if (currentWriterPos !== writer.getTextPos()) {
write(separator);
@@ -57264,7 +58044,7 @@ var ts;
}
function writeJsDocComments(declaration) {
if (declaration) {
- var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText);
+ var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);
ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);
// jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space
ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, ts.writeCommentRange);
@@ -57459,9 +58239,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_37 = baseName + "_" + count;
- if (!(name_37 in currentIdentifiers)) {
- return name_37;
+ var name_38 = baseName + "_" + count;
+ if (!(name_38 in currentIdentifiers)) {
+ return name_38;
}
}
}
@@ -57872,6 +58652,9 @@ var ts;
case 225 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
+ case 228 /* TypeAliasDeclaration */:
+ diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
+ break;
default:
ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
@@ -57968,7 +58751,10 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
- emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false);
+ var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });
+ if (interfaceExtendsTypes && interfaceExtendsTypes.length) {
+ emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false);
+ }
write(" {");
writeLine();
increaseIndent();
@@ -58619,87 +59405,6 @@ var ts;
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
- // emit output for the __extends helper function
- var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};";
- // Emit output for the __assign helper function.
- // This is typically used for JSX spread attributes,
- // and can be used for object literal spread properties.
- var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
- var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
- // emit output for the __decorate helper function
- var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
- // emit output for the __metadata helper function
- var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};";
- // emit output for the __param helper function
- var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};";
- // emit output for the __awaiter helper function
- var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};";
- // The __generator helper is used by down-level transformations to emulate the runtime
- // semantics of an ES2015 generator function. When called, this helper returns an
- // object that implements the Iterator protocol, in that it has `next`, `return`, and
- // `throw` methods that step through the generator when invoked.
- //
- // parameters:
- // thisArg The value to use as the `this` binding for the transformed generator body.
- // body A function that acts as the transformed generator body.
- //
- // variables:
- // _ Persistent state for the generator that is shared between the helper and the
- // generator body. The state object has the following members:
- // sent() - A method that returns or throws the current completion value.
- // label - The next point at which to resume evaluation of the generator body.
- // trys - A stack of protected regions (try/catch/finally blocks).
- // ops - A stack of pending instructions when inside of a finally block.
- // f A value indicating whether the generator is executing.
- // y An iterator to delegate for a yield*.
- // t A temporary variable that holds one of the following values (note that these
- // cases do not overlap):
- // - The completion value when resuming from a `yield` or `yield*`.
- // - The error value for a catch block.
- // - The current protected region (array of try/catch/finally/end labels).
- // - The verb (`next`, `throw`, or `return` method) to delegate to the expression
- // of a `yield*`.
- // - The result of evaluating the verb delegated to the expression of a `yield*`.
- //
- // functions:
- // verb(n) Creates a bound callback to the `step` function for opcode `n`.
- // step(op) Evaluates opcodes in a generator body until execution is suspended or
- // completed.
- //
- // The __generator helper understands a limited set of instructions:
- // 0: next(value?) - Start or resume the generator with the specified value.
- // 1: throw(error) - Resume the generator with an exception. If the generator is
- // suspended inside of one or more protected regions, evaluates
- // any intervening finally blocks between the current label and
- // the nearest catch block or function boundary. If uncaught, the
- // exception is thrown to the caller.
- // 2: return(value?) - Resume the generator as if with a return. If the generator is
- // suspended inside of one or more protected regions, evaluates any
- // intervening finally blocks.
- // 3: break(label) - Jump to the specified label. If the label is outside of the
- // current protected region, evaluates any intervening finally
- // blocks.
- // 4: yield(value?) - Yield execution to the caller with an optional value. When
- // resumed, the generator will continue at the next label.
- // 5: yield*(value) - Delegates evaluation to the supplied iterator. When
- // delegation completes, the generator will continue at the next
- // label.
- // 6: catch(error) - Handles an exception thrown from within the generator body. If
- // the current label is inside of one or more protected regions,
- // evaluates any intervening finally blocks between the current
- // label and the nearest catch block or function boundary. If
- // uncaught, the exception is thrown to the caller.
- // 7: endfinally - Ends a finally block, resuming the last instruction prior to
- // entering a finally block.
- //
- // For examples of how these are used, see the comments in ./transformers/generators.ts
- var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};";
- // emit output for the __export helper function
- var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}";
- // emit output for the UMD helper function.
- var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})";
- var superHelper = "\nconst _super = name => super[name];";
- var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);";
var compilerOptions = host.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
@@ -58721,12 +59426,7 @@ var ts;
var currentSourceFile;
var currentText;
var currentFileIdentifiers;
- var extendsEmitted;
- var assignEmitted;
- var restEmitted;
- var decorateEmitted;
- var paramEmitted;
- var awaiterEmitted;
+ var bundledHelpers;
var isOwnFileEmit;
var emitSkipped = false;
var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);
@@ -58779,12 +59479,13 @@ var ts;
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNameSet = ts.createMap();
+ bundledHelpers = isBundledEmit ? ts.createMap() : undefined;
isOwnFileEmit = !isBundledEmit;
// Emit helpers from all the files
if (isBundledEmit && moduleKind) {
for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {
var sourceFile = sourceFiles_5[_a];
- emitEmitHelpers(sourceFile);
+ emitHelpers(sourceFile, /*isBundle*/ true);
}
}
// Print each transformed source file.
@@ -58796,14 +59497,14 @@ var ts;
}
// Write the source map
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles);
}
// Record source map data for the test harness.
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
}
// Write the output file
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM);
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
// Reset state
sourceMap.reset();
comments.reset();
@@ -58811,11 +59512,6 @@ var ts;
tempFlags = 0 /* Auto */;
currentSourceFile = undefined;
currentText = undefined;
- extendsEmitted = false;
- assignEmitted = false;
- decorateEmitted = false;
- paramEmitted = false;
- awaiterEmitted = false;
isOwnFileEmit = false;
}
function printSourceFile(node) {
@@ -59279,8 +59975,10 @@ var ts;
case 247 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
// Transformation nodes
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
+ case 297 /* RawExpression */:
+ return writeLines(node.text);
}
}
//
@@ -59313,12 +60011,7 @@ var ts;
// Identifiers
//
function emitIdentifier(node) {
- if (ts.getEmitFlags(node) & 16 /* UMDDefine */) {
- writeLines(umdHelper);
- }
- else {
- write(getTextOfNode(node, /*includeTrivia*/ false));
- }
+ write(getTextOfNode(node, /*includeTrivia*/ false));
}
//
// Names
@@ -59579,7 +60272,7 @@ var ts;
write("{}");
}
else {
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
@@ -59594,7 +60287,7 @@ var ts;
function emitPropertyAccessExpression(node) {
var indentBeforeDot = false;
var indentAfterDot = false;
- if (!(ts.getEmitFlags(node) & 1048576 /* NoIndentation */)) {
+ if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd };
@@ -59801,7 +60494,7 @@ var ts;
}
}
function emitBlockStatements(node) {
- if (ts.getEmitFlags(node) & 32 /* SingleLine */) {
+ if (ts.getEmitFlags(node) & 1 /* SingleLine */) {
emitList(node, node.statements, 384 /* SingleLineBlockStatements */);
}
else {
@@ -59980,11 +60673,11 @@ var ts;
var body = node.body;
if (body) {
if (ts.isBlock(body)) {
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
- if (ts.getEmitFlags(node) & 4194304 /* ReuseTempVariableScope */) {
+ if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) {
emitSignatureHead(node);
emitBlockFunctionBody(body);
}
@@ -60022,7 +60715,7 @@ var ts;
// * The body is explicitly marked as multi-line.
// * A non-synthesized body's start and end position are on different lines.
// * Any statement in the body starts on a new line.
- if (ts.getEmitFlags(body) & 32 /* SingleLine */) {
+ if (ts.getEmitFlags(body) & 1 /* SingleLine */) {
return true;
}
if (body.multiLine) {
@@ -60078,7 +60771,7 @@ var ts;
emitModifiers(node, node.modifiers);
write("class");
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
@@ -60358,7 +61051,7 @@ var ts;
// "comment1" is not considered to be leading comment for node.initializer
// but rather a trailing comment on the previous node.
var initializer = node.initializer;
- if ((ts.getEmitFlags(initializer) & 16384 /* NoLeadingComments */) === 0) {
+ if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) {
var commentRange = ts.getCommentRange(initializer);
emitTrailingCommentsOfPosition(commentRange.pos);
}
@@ -60424,78 +61117,37 @@ var ts;
}
return statements.length;
}
- function emitHelpers(node) {
- var emitFlags = ts.getEmitFlags(node);
+ function emitHelpers(node, isBundle) {
+ var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;
+ var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;
var helpersEmitted = false;
- if (emitFlags & 1 /* EmitEmitHelpers */) {
- helpersEmitted = emitEmitHelpers(currentSourceFile);
- }
- if (emitFlags & 2 /* EmitExportStar */) {
- writeLines(exportStarHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 4 /* EmitSuperHelper */) {
- writeLines(superHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 8 /* EmitAdvancedSuperHelper */) {
- writeLines(advancedSuperHelper);
- helpersEmitted = true;
- }
- return helpersEmitted;
- }
- function emitEmitHelpers(node) {
- // Only emit helpers if the user did not say otherwise.
- if (compilerOptions.noEmitHelpers) {
- return false;
- }
- // Don't emit helpers if we can import them.
- if (compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- return false;
- }
- var helpersEmitted = false;
- // Only Emit __extends function when target ES5.
- // For target ES6 and above, we can emit classDeclaration as is.
- if ((languageVersion < 2 /* ES2015 */) && (!extendsEmitted && node.flags & 1024 /* HasClassExtends */)) {
- writeLines(extendsHelper);
- extendsEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 5 /* ESNext */ || currentSourceFile.scriptKind === 2 /* JSX */ || currentSourceFile.scriptKind === 4 /* TSX */) &&
- compilerOptions.jsx !== 1 /* Preserve */ &&
- !assignEmitted &&
- node.flags & 16384 /* HasSpreadAttribute */) {
- writeLines(assignHelper);
- assignEmitted = true;
- }
- if (languageVersion < 5 /* ESNext */ && !restEmitted && node.flags & 32768 /* HasRestAttribute */) {
- writeLines(restHelper);
- restEmitted = true;
- }
- if (!decorateEmitted && node.flags & 2048 /* HasDecorators */) {
- writeLines(decorateHelper);
- if (compilerOptions.emitDecoratorMetadata) {
- writeLines(metadataHelper);
- }
- decorateEmitted = true;
- helpersEmitted = true;
- }
- if (!paramEmitted && node.flags & 4096 /* HasParamDecorators */) {
- writeLines(paramHelper);
- paramEmitted = true;
- helpersEmitted = true;
- }
- // Only emit __awaiter function when target ES5/ES6.
- // Only emit __generator function when target ES5.
- // For target ES2017 and above, we can emit async/await as is.
- if ((languageVersion < 4 /* ES2017 */) && (!awaiterEmitted && node.flags & 8192 /* HasAsyncFunctions */)) {
- writeLines(awaiterHelper);
- if (languageVersion < 2 /* ES2015 */) {
- writeLines(generatorHelper);
+ var helpers = ts.getEmitHelpers(node);
+ if (helpers) {
+ for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {
+ var helper = _b[_a];
+ if (!helper.scoped) {
+ // Skip the helper if it can be skipped and the noEmitHelpers compiler
+ // option is set, or if it can be imported and the importHelpers compiler
+ // option is set.
+ if (shouldSkip)
+ continue;
+ // Skip the helper if it can be bundled but hasn't already been emitted and we
+ // are emitting a bundled module.
+ if (shouldBundle) {
+ if (bundledHelpers[helper.name]) {
+ continue;
+ }
+ bundledHelpers[helper.name] = true;
+ }
+ }
+ else if (isBundle) {
+ // Skip the helper if it is scoped and we are emitting bundled helpers
+ continue;
+ }
+ writeLines(helper.text);
+ helpersEmitted = true;
}
- awaiterEmitted = true;
- helpersEmitted = true;
}
if (helpersEmitted) {
writeLine();
@@ -60503,9 +61155,10 @@ var ts;
return helpersEmitted;
}
function writeLines(text) {
- var lines = text.split(/\r\n|\r|\n/g);
+ var lines = text.split(/\r\n?|\n/g);
+ var indentation = guessIndentation(lines);
for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
+ var line = indentation ? lines[i].slice(indentation) : lines[i];
if (line.length) {
if (i > 0) {
writeLine();
@@ -60514,6 +61167,21 @@ var ts;
}
}
}
+ function guessIndentation(lines) {
+ var indentation;
+ for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
+ var line = lines_1[_a];
+ for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
+ if (!ts.isWhiteSpace(line.charCodeAt(i))) {
+ if (indentation === undefined || i < indentation) {
+ indentation = i;
+ break;
+ }
+ }
+ }
+ }
+ return indentation;
+ }
//
// Helpers
//
@@ -60881,10 +61549,10 @@ var ts;
*/
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_38 = flags === 268435456 /* _i */ ? "_i" : "_n";
- if (isUniqueName(name_38)) {
+ var name_39 = flags === 268435456 /* _i */ ? "_i" : "_n";
+ if (isUniqueName(name_39)) {
tempFlags |= flags;
- return name_38;
+ return name_39;
}
}
while (true) {
@@ -60892,11 +61560,11 @@ var ts;
tempFlags++;
// Skip over 'i' and 'n'
if (count !== 8 && count !== 13) {
- var name_39 = count < 26
+ var name_40 = count < 26
? "_" + String.fromCharCode(97 /* a */ + count)
: "_" + (count - 26);
- if (isUniqueName(name_39)) {
- return name_39;
+ if (isUniqueName(name_40)) {
+ return name_40;
}
}
}
@@ -61121,8 +61789,6 @@ var ts;
/// <reference path="core.ts" />
var ts;
(function (ts) {
- /** The version of the TypeScript compiler release */
- ts.version = "2.2.0-dev.20161115";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -61349,10 +62015,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_40 = names_1[_i];
- var result = name_40 in cache
- ? cache[name_40]
- : cache[name_40] = loader(name_40, containingFile);
+ var name_41 = names_1[_i];
+ var result = name_41 in cache
+ ? cache[name_41]
+ : cache[name_41] = loader(name_41, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -61422,7 +62088,8 @@ var ts;
var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);
if (typeReferences.length) {
// This containingFilename needs to match with the one used in managed-side
- var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
+ var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
+ var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts");
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (var i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
@@ -62003,8 +62670,8 @@ var ts;
}
break;
}
- for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
- var node = nodes_4[_b];
+ for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {
+ var node = nodes_6[_b];
walk(node);
}
}
@@ -63108,12 +63775,19 @@ var ts;
}
];
/* @internal */
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
+ /* @deprecated typingOptions.enableAutoDiscovery
+ * Use typeAcquisition.enable instead.
+ */
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -63139,6 +63813,20 @@ var ts;
};
var optionNameMapCache;
/* @internal */
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
+ /* @internal */
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -63379,11 +64067,11 @@ var ts;
function serializeCompilerOptions(options) {
var result = ts.createMap();
var optionsNameMap = getOptionNameMap().optionNameMap;
- for (var name_41 in options) {
- if (ts.hasProperty(options, name_41)) {
+ for (var name_42 in options) {
+ if (ts.hasProperty(options, name_42)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
- switch (name_41) {
+ switch (name_42) {
case "init":
case "watch":
case "version":
@@ -63391,14 +64079,14 @@ var ts;
case "project":
break;
default:
- var value = options[name_41];
- var optionDefinition = optionsNameMap[name_41.toLowerCase()];
+ var value = options[name_42];
+ var optionDefinition = optionsNameMap[name_42.toLowerCase()];
if (optionDefinition) {
var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
if (!customTypeMap) {
// There is no map associated with this compiler option then use the value as-is
// This is the case if the value is expect to be string, number, boolean or list of string
- result[name_41] = value;
+ result[name_42] = value;
}
else {
if (optionDefinition.type === "list") {
@@ -63407,11 +64095,11 @@ var ts;
var element = _a[_i];
convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
}
- result[name_41] = convertedValue;
+ result[name_42] = convertedValue;
}
else {
// There is a typeMap associated with this command-line option so use it to map value back to its name
- result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap);
+ result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap);
}
}
}
@@ -63464,14 +64152,17 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ // typingOptions has been deprecated and is only supported for backward compatibility purposes.
+ // It should be removed in future releases - use typeAcquisition instead.
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -63498,7 +64189,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -63507,7 +64198,7 @@ var ts;
function tryExtendsName(extendedConfig) {
// If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future)
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -63571,8 +64262,8 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- // By default, exclude common package folders and the outDir
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ // If no includes were specified, exclude common package folders and the outDir
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -63607,12 +64298,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -63620,9 +64311,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -64527,7 +65219,7 @@ var ts;
case 243 /* ExportSpecifier */:
case 237 /* NamespaceImport */:
return ts.ScriptElementKind.alias;
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return ts.ScriptElementKind.typeElement;
default:
return ts.ScriptElementKind.unknown;
@@ -64763,7 +65455,7 @@ var ts;
// for the position of the relevant node (or comma).
var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
// find syntax list that covers the span of the node
- if (c.kind === 291 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
@@ -65073,11 +65765,11 @@ var ts;
}
}
if (node) {
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- if (jsDocComment.tags) {
- for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ if (jsDoc.tags) {
+ for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {
var tag = _c[_b];
if (tag.pos <= position && position <= tag.end) {
return tag;
@@ -65416,7 +66108,7 @@ var ts;
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
- else if (ts.isStringOrNumericLiteral(location.kind) &&
+ else if (ts.isStringOrNumericLiteral(location) &&
location.parent.kind === 142 /* ComputedPropertyName */) {
return location.text;
}
@@ -66153,16 +66845,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */);
pos = tag.tagName.end;
switch (tag.kind) {
- case 280 /* JSDocParameterTag */:
+ case 281 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 283 /* JSDocTemplateTag */:
+ case 284 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
break;
- case 282 /* JSDocTypeTag */:
+ case 283 /* JSDocTypeTag */:
processElement(tag.typeExpression);
break;
- case 281 /* JSDocReturnTag */:
+ case 282 /* JSDocReturnTag */:
processElement(tag.typeExpression);
break;
}
@@ -66440,14 +67132,14 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_42 in nameTable) {
+ for (var name_43 in nameTable) {
// Skip identifiers produced only from the current location
- if (nameTable[name_42] === position) {
+ if (nameTable[name_43] === position) {
continue;
}
- if (!uniqueNames[name_42]) {
- uniqueNames[name_42] = name_42;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true);
+ if (!uniqueNames[name_43]) {
+ uniqueNames[name_43] = name_43;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, /*performCharacterChecks*/ true);
if (displayName) {
var entry = {
name: displayName,
@@ -66960,11 +67652,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_14 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_14) {
+ var parent_13 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_13) {
break;
}
- currentDir = parent_14;
+ currentDir = parent_13;
}
else {
break;
@@ -67045,14 +67737,14 @@ var ts;
// Compute all the completion symbols again.
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_2 = completionData.location;
+ var symbols = completionData.symbols, location_3 = completionData.location;
// Find the symbol with the matching entry name.
// We don't need to perform character checks here because we're only comparing the
// name against 'entryName' (which is known to be good), not building a new
// completion entry.
- var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; });
+ var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; });
if (symbol) {
- var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
+ var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
return {
name: entryName,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
@@ -67080,12 +67772,12 @@ var ts;
// Compute all the completion symbols again.
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_3 = completionData.location;
+ var symbols = completionData.symbols, location_4 = completionData.location;
// Find the symbol with the matching entry name.
// We don't need to perform character checks here because we're only comparing the
// name against 'entryName' (which is known to be good), not building a new
// completion entry.
- return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; });
+ return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; });
}
return undefined;
}
@@ -67116,9 +67808,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 282 /* JSDocTypeTag */:
- case 280 /* JSDocParameterTag */:
- case 281 /* JSDocReturnTag */:
+ case 283 /* JSDocTypeTag */:
+ case 281 /* JSDocParameterTag */:
+ case 282 /* JSDocReturnTag */:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -67163,13 +67855,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_15 = contextToken.parent, kind = contextToken.kind;
+ var parent_14 = contextToken.parent, kind = contextToken.kind;
if (kind === 22 /* DotToken */) {
- if (parent_15.kind === 177 /* PropertyAccessExpression */) {
+ if (parent_14.kind === 177 /* PropertyAccessExpression */) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_15.kind === 141 /* QualifiedName */) {
+ else if (parent_14.kind === 141 /* QualifiedName */) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -67556,9 +68248,9 @@ var ts;
switch (contextToken.kind) {
case 16 /* OpenBraceToken */: // const x = { |
case 25 /* CommaToken */:
- var parent_16 = contextToken.parent;
- if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) {
- return parent_16;
+ var parent_15 = contextToken.parent;
+ if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) {
+ return parent_15;
}
break;
}
@@ -67585,37 +68277,37 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_17 = contextToken.parent;
+ var parent_16 = contextToken.parent;
switch (contextToken.kind) {
case 27 /* LessThanSlashToken */:
case 40 /* SlashToken */:
case 70 /* Identifier */:
case 250 /* JsxAttribute */:
case 251 /* JsxSpreadAttribute */:
- if (parent_17 && (parent_17.kind === 247 /* JsxSelfClosingElement */ || parent_17.kind === 248 /* JsxOpeningElement */)) {
- return parent_17;
+ if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) {
+ return parent_16;
}
- else if (parent_17.kind === 250 /* JsxAttribute */) {
- return parent_17.parent;
+ else if (parent_16.kind === 250 /* JsxAttribute */) {
+ return parent_16.parent;
}
break;
// The context token is the closing } or " of an attribute, which means
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 9 /* StringLiteral */:
- if (parent_17 && ((parent_17.kind === 250 /* JsxAttribute */) || (parent_17.kind === 251 /* JsxSpreadAttribute */))) {
- return parent_17.parent;
+ if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) {
+ return parent_16.parent;
}
break;
case 17 /* CloseBraceToken */:
- if (parent_17 &&
- parent_17.kind === 252 /* JsxExpression */ &&
- parent_17.parent &&
- (parent_17.parent.kind === 250 /* JsxAttribute */)) {
- return parent_17.parent.parent;
+ if (parent_16 &&
+ parent_16.kind === 252 /* JsxExpression */ &&
+ parent_16.parent &&
+ (parent_16.parent.kind === 250 /* JsxAttribute */)) {
+ return parent_16.parent.parent;
}
- if (parent_17 && parent_17.kind === 251 /* JsxSpreadAttribute */) {
- return parent_17.parent;
+ if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) {
+ return parent_16.parent;
}
break;
}
@@ -67752,8 +68444,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_43 = element.propertyName || element.name;
- existingImportsOrExports[name_43.text] = true;
+ var name_44 = element.propertyName || element.name;
+ existingImportsOrExports[name_44.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -68112,19 +68804,19 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_18 = child.parent;
- if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261 /* SourceFile */) {
- return parent_18;
+ var parent_17 = child.parent;
+ if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) {
+ return parent_17;
}
// A throw-statement is only owned by a try-statement if the try-statement has
// a catch clause, and if the throw-statement occurs within the try block.
- if (parent_18.kind === 221 /* TryStatement */) {
- var tryStatement = parent_18;
+ if (parent_17.kind === 221 /* TryStatement */) {
+ var tryStatement = parent_17;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_18;
+ child = parent_17;
}
return undefined;
}
@@ -69081,24 +69773,24 @@ var ts;
// If we got a type reference, try and see if the reference applies to any expressions that can implement an interface
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_19 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.initializer));
+ var parent_18 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.initializer));
}
- else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) {
- if (parent_19.body.kind === 204 /* Block */) {
- ts.forEachReturnStatement(parent_19.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {
+ if (parent_18.body.kind === 204 /* Block */) {
+ ts.forEachReturnStatement(parent_18.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_19.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.body));
+ else if (isImplementationExpression(parent_18.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.body));
}
}
- else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.expression));
+ else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.expression));
}
}
}
@@ -69593,9 +70285,9 @@ var ts;
return undefined;
}
}
- var result_3 = [];
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, /*previousIterationSymbolsCache*/ ts.createMap());
- return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
+ var result_4 = [];
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap());
+ return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
}
return undefined;
});
@@ -69604,7 +70296,7 @@ var ts;
if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
return undefined;
@@ -69616,20 +70308,20 @@ var ts;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name = getNameFromObjectLiteralElement(node);
if (name && contextualType) {
- var result_4 = [];
+ var result_5 = [];
var symbol_2 = contextualType.getProperty(name);
if (symbol_2) {
- result_4.push(symbol_2);
+ result_5.push(symbol_2);
}
if (contextualType.flags & 65536 /* Union */) {
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name);
if (symbol) {
- result_4.push(symbol);
+ result_5.push(symbol);
}
});
}
- return result_4;
+ return result_5;
}
return undefined;
}
@@ -69896,13 +70588,13 @@ var ts;
return undefined;
}
if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) {
- var result_5 = [];
+ var result_6 = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
- ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node));
+ ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node));
}
});
- return result_5;
+ return result_6;
}
if (!type.symbol) {
return undefined;
@@ -70113,7 +70805,7 @@ var ts;
// from Array<T> - Array<string> and Array<number>
var documentationComment = [];
forEachUnique(declarations, function (declaration) {
- var comments = ts.getJSDocComments(declaration, /*checkParentVariableStatement*/ true);
+ var comments = ts.getCommentsFromJSDoc(declaration);
if (!comments) {
return;
}
@@ -70320,13 +71012,13 @@ var ts;
* @param projectRootPath is the path to the project root directory
* @param safeListPath is the path used to retrieve the safe list
* @param packageNameToTypingLocation is the map of package names to their cached typing locations
- * @param typingOptions are used to customize the typing inference process
+ * @param typeAcquisition is used to customize the typing acquisition process
* @param compilerOptions are used as a source for typing inference
*/
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
// A typing name to typing file path mapping
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
// Only infer typings for .js and .jsx files
@@ -70342,8 +71034,8 @@ var ts;
// Directories to search for package.json, bower.json and other typing information
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -70370,9 +71062,9 @@ var ts;
}
}
// Add the cached typing locations for inferred typings that are already installed
- for (var name_44 in packageNameToTypingLocation) {
- if (name_44 in inferredTypings && !inferredTypings[name_44]) {
- inferredTypings[name_44] = packageNameToTypingLocation[name_44];
+ for (var name_45 in packageNameToTypingLocation) {
+ if (name_45 in inferredTypings && !inferredTypings[name_45]) {
+ inferredTypings[name_45] = packageNameToTypingLocation[name_45];
}
}
// Remove typings that the user has added to the exclude list
@@ -70510,12 +71202,12 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_45 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_45];
+ for (var name_46 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_46];
if (declarations) {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46);
if (!matches) {
continue;
}
@@ -70528,14 +71220,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_45);
+ matches = patternMatcher.getMatches(containers, name_46);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -70824,9 +71516,9 @@ var ts;
case 174 /* BindingElement */:
case 223 /* VariableDeclaration */:
var decl = node;
- var name_46 = decl.name;
- if (ts.isBindingPattern(name_46)) {
- addChildrenRecursively(name_46);
+ var name_47 = decl.name;
+ if (ts.isBindingPattern(name_47)) {
+ addChildrenRecursively(name_47);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
// For `const x = function() {}`, just use the function node, not the const.
@@ -70873,9 +71565,9 @@ var ts;
addLeafNode(node);
break;
default:
- ts.forEach(node.jsDocComments, function (jsDocComment) {
- ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 284 /* JSDocTypedefTag */) {
+ ts.forEach(node.jsDoc, function (jsDoc) {
+ ts.forEach(jsDoc.tags, function (tag) {
+ if (tag.kind === 285 /* JSDocTypedefTag */) {
addLeafNode(tag);
}
});
@@ -71005,7 +71697,7 @@ var ts;
case 185 /* ArrowFunction */:
case 197 /* ClassExpression */:
return getFunctionOrClassName(node);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return undefined;
@@ -71048,7 +71740,7 @@ var ts;
return "()";
case 155 /* IndexSignature */:
return "[]";
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return "<unknown>";
@@ -71096,7 +71788,7 @@ var ts;
case 230 /* ModuleDeclaration */:
case 261 /* SourceFile */:
case 228 /* TypeAliasDeclaration */:
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return true;
case 150 /* Constructor */:
case 149 /* MethodDeclaration */:
@@ -71333,28 +72025,28 @@ var ts;
switch (n.kind) {
case 204 /* Block */:
if (!ts.isFunctionBlock(n)) {
- var parent_20 = n.parent;
+ var parent_19 = n.parent;
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
- if (parent_20.kind === 209 /* DoStatement */ ||
- parent_20.kind === 212 /* ForInStatement */ ||
- parent_20.kind === 213 /* ForOfStatement */ ||
- parent_20.kind === 211 /* ForStatement */ ||
- parent_20.kind === 208 /* IfStatement */ ||
- parent_20.kind === 210 /* WhileStatement */ ||
- parent_20.kind === 217 /* WithStatement */ ||
- parent_20.kind === 256 /* CatchClause */) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ if (parent_19.kind === 209 /* DoStatement */ ||
+ parent_19.kind === 212 /* ForInStatement */ ||
+ parent_19.kind === 213 /* ForOfStatement */ ||
+ parent_19.kind === 211 /* ForStatement */ ||
+ parent_19.kind === 208 /* IfStatement */ ||
+ parent_19.kind === 210 /* WhileStatement */ ||
+ parent_19.kind === 217 /* WithStatement */ ||
+ parent_19.kind === 256 /* CatchClause */) {
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_20.kind === 221 /* TryStatement */) {
+ if (parent_19.kind === 221 /* TryStatement */) {
// Could be the try-block, or the finally-block.
- var tryStatement = parent_20;
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -73447,9 +74139,9 @@ var ts;
return false;
}
// If the parent is not sourceFile or module block it is local variable
- for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) {
+ for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {
// Reached source file or module block
- if (parent_21.kind === 261 /* SourceFile */ || parent_21.kind === 231 /* ModuleBlock */) {
+ if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) {
return false;
}
}
@@ -74054,7 +74746,7 @@ var ts;
function RuleOperationContext() {
var funcs = [];
for (var _i = 0; _i < arguments.length; _i++) {
- funcs[_i - 0] = arguments[_i];
+ funcs[_i] = arguments[_i];
}
this.customContextChecks = funcs;
}
@@ -74325,9 +75017,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_47 in o) {
- if (o[name_47] === rule) {
- return name_47;
+ for (var name_48 in o) {
+ if (o[name_48] === rule) {
+ return name_48;
}
}
throw new Error("Unknown rule");
@@ -75715,11 +76407,23 @@ var ts;
else {
var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
- if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
+ if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
+ function characterToColumn(startLinePosition, characterInLine) {
+ var column = 0;
+ for (var i = 0; i < characterInLine; i++) {
+ if (sourceFile.text.charCodeAt(startLinePosition + i) === 9 /* tab */) {
+ column += options.tabSize - column % options.tabSize;
+ }
+ else {
+ column++;
+ }
+ }
+ return column;
+ }
function indentationIsDifferent(indentationString, startLinePosition) {
return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
}
@@ -76508,7 +77212,666 @@ var ts;
});
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ var ModuleSpecifierComparison;
+ (function (ModuleSpecifierComparison) {
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse";
+ })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {}));
+ var ImportCodeActionMap = (function () {
+ function ImportCodeActionMap() {
+ this.symbolIdToActionMap = ts.createMap();
+ }
+ ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) {
+ if (!newAction) {
+ return;
+ }
+ if (!this.symbolIdToActionMap[symbolId]) {
+ this.symbolIdToActionMap[symbolId] = [newAction];
+ return;
+ }
+ if (newAction.kind === "CodeChange") {
+ this.symbolIdToActionMap[symbolId].push(newAction);
+ return;
+ }
+ var updatedNewImports = [];
+ for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) {
+ var existingAction = _a[_i];
+ if (existingAction.kind === "CodeChange") {
+ // only import actions should compare
+ updatedNewImports.push(existingAction);
+ continue;
+ }
+ switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) {
+ case ModuleSpecifierComparison.Better:
+ // the new one is not worth considering if it is a new improt.
+ // However if it is instead a insertion into existing import, the user might want to use
+ // the module specifier even it is worse by our standards. So keep it.
+ if (newAction.kind === "NewImport") {
+ return;
+ }
+ case ModuleSpecifierComparison.Equal:
+ // the current one is safe. But it is still possible that the new one is worse
+ // than another existing one. For example, you may have new imports from "./foo/bar"
+ // and "bar", when the new one is "bar/bar2" and the current one is "./foo/bar". The new
+ // one and the current one are not comparable (one relative path and one absolute path),
+ // but the new one is worse than the other one, so should not add to the list.
+ updatedNewImports.push(existingAction);
+ break;
+ case ModuleSpecifierComparison.Worse:
+ // the existing one is worse, remove from the list.
+ continue;
+ }
+ }
+ // if we reach here, it means the new one is better or equal to all of the existing ones.
+ updatedNewImports.push(newAction);
+ this.symbolIdToActionMap[symbolId] = updatedNewImports;
+ };
+ ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) {
+ for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) {
+ var newAction = newActions_1[_i];
+ this.addAction(symbolId, newAction);
+ }
+ };
+ ImportCodeActionMap.prototype.getAllActions = function () {
+ var result = [];
+ for (var symbolId in this.symbolIdToActionMap) {
+ result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]);
+ }
+ return result;
+ };
+ ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) {
+ if (moduleSpecifier1 === moduleSpecifier2) {
+ return ModuleSpecifierComparison.Equal;
+ }
+ // if moduleSpecifier1 (ms1) is a substring of ms2, then it is better
+ if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) {
+ return ModuleSpecifierComparison.Better;
+ }
+ if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) {
+ return ModuleSpecifierComparison.Worse;
+ }
+ // if both are relative paths, and ms1 has fewer levels, then it is better
+ if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) {
+ var regex = new RegExp(ts.directorySeparator, "g");
+ var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length;
+ var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length;
+ return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Better
+ : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Equal
+ : ModuleSpecifierComparison.Worse;
+ }
+ // the equal cases include when the two specifiers are not comparable.
+ return ModuleSpecifierComparison.Equal;
+ };
+ return ImportCodeActionMap;
+ }());
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.Cannot_find_name_0.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var checker = context.program.getTypeChecker();
+ var allSourceFiles = context.program.getSourceFiles();
+ var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ var name = token.getText();
+ var symbolIdActionMap = new ImportCodeActionMap();
+ // this is a module id -> module import declaration map
+ var cachedImportDeclarations = ts.createMap();
+ var cachedNewImportInsertPosition;
+ var allPotentialModules = checker.getAmbientModules();
+ for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) {
+ var otherSourceFile = allSourceFiles_1[_i];
+ if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) {
+ allPotentialModules.push(otherSourceFile.symbol);
+ }
+ }
+ var currentTokenMeaning = ts.getMeaningFromLocation(token);
+ for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) {
+ var moduleSymbol = allPotentialModules_1[_a];
+ context.cancellationToken.throwIfCancellationRequested();
+ // check the default export
+ var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol);
+ if (defaultExport) {
+ var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
+ if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) {
+ // check if this symbol is already used
+ var symbolId = getUniqueSymbolId(localSymbol);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true));
+ }
+ }
+ // check exports with the same name
+ var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol);
+ if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol));
+ }
+ }
+ return symbolIdActionMap.getAllActions();
+ function getImportDeclarations(moduleSymbol) {
+ var moduleSymbolId = getUniqueSymbolId(moduleSymbol);
+ if (cachedImportDeclarations[moduleSymbolId]) {
+ return cachedImportDeclarations[moduleSymbolId];
+ }
+ var existingDeclarations = [];
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var importModuleSpecifier = _a[_i];
+ var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier);
+ if (importSymbol === moduleSymbol) {
+ existingDeclarations.push(getImportDeclaration(importModuleSpecifier));
+ }
+ }
+ cachedImportDeclarations[moduleSymbolId] = existingDeclarations;
+ return existingDeclarations;
+ function getImportDeclaration(moduleSpecifier) {
+ var node = moduleSpecifier;
+ while (node) {
+ if (node.kind === 235 /* ImportDeclaration */) {
+ return node;
+ }
+ if (node.kind === 234 /* ImportEqualsDeclaration */) {
+ return node;
+ }
+ node = node.parent;
+ }
+ return undefined;
+ }
+ }
+ function getUniqueSymbolId(symbol) {
+ if (symbol.flags & 8388608 /* Alias */) {
+ return ts.getSymbolId(checker.getAliasedSymbol(symbol));
+ }
+ return ts.getSymbolId(symbol);
+ }
+ function checkSymbolHasMeaning(symbol, meaning) {
+ var declarations = symbol.getDeclarations();
+ return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false;
+ }
+ function getCodeActionForImport(moduleSymbol, isDefault) {
+ var existingDeclarations = getImportDeclarations(moduleSymbol);
+ if (existingDeclarations.length > 0) {
+ // With an existing import statement, there are more than one actions the user can do.
+ return getCodeActionsForExistingImport(existingDeclarations);
+ }
+ else {
+ return [getCodeActionForNewImport()];
+ }
+ function getCodeActionsForExistingImport(declarations) {
+ var actions = [];
+ // It is possible that multiple import statements with the same specifier exist in the file.
+ // e.g.
+ //
+ // import * as ns from "foo";
+ // import { member1, member2 } from "foo";
+ //
+ // member3/**/ <-- cusor here
+ //
+ // in this case we should provie 2 actions:
+ // 1. change "member3" to "ns.member3"
+ // 2. add "member3" to the second import statement's import list
+ // and it is up to the user to decide which one fits best.
+ var namespaceImportDeclaration;
+ var namedImportDeclaration;
+ var existingModuleSpecifier;
+ for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
+ var declaration = declarations_11[_i];
+ if (declaration.kind === 235 /* ImportDeclaration */) {
+ var namedBindings = declaration.importClause && declaration.importClause.namedBindings;
+ if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) {
+ // case:
+ // import * as ns from "foo"
+ namespaceImportDeclaration = declaration;
+ }
+ else {
+ // cases:
+ // import default from "foo"
+ // import { bar } from "foo" or combination with the first one
+ // import "foo"
+ namedImportDeclaration = declaration;
+ }
+ existingModuleSpecifier = declaration.moduleSpecifier.getText();
+ }
+ else {
+ // case:
+ // import foo = require("foo")
+ namespaceImportDeclaration = declaration;
+ existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration);
+ }
+ }
+ if (namespaceImportDeclaration) {
+ actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration));
+ }
+ if (namedImportDeclaration && namedImportDeclaration.importClause &&
+ (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) {
+ /**
+ * If the existing import declaration already has a named import list, just
+ * insert the identifier into that list.
+ */
+ var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText());
+ actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes));
+ }
+ else {
+ // we need to create a new import statement, but the existing module specifier can be reused.
+ actions.push(getCodeActionForNewImport(existingModuleSpecifier));
+ }
+ return actions;
+ function getModuleSpecifierFromImportEqualsDeclaration(declaration) {
+ if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) {
+ return declaration.moduleReference.expression.getText();
+ }
+ return declaration.moduleReference.getText();
+ }
+ function getTextChangeForImportClause(importClause) {
+ var newImportText = isDefault ? "default as " + name : name;
+ var importList = importClause.namedBindings;
+ // case 1:
+ // original text: import default from "module"
+ // change to: import default, { name } from "module"
+ if (!importList && importClause.name) {
+ var start = importClause.name.getEnd();
+ return {
+ newText: ", { " + newImportText + " }",
+ span: { start: start, length: 0 }
+ };
+ }
+ // case 2:
+ // original text: import {} from "module"
+ // change to: import { name } from "module"
+ if (importList.elements.length === 0) {
+ var start = importList.getStart();
+ return {
+ newText: "{ " + newImportText + " }",
+ span: { start: start, length: importList.getEnd() - start }
+ };
+ }
+ // case 3:
+ // original text: import { foo, bar } from "module"
+ // change to: import { foo, bar, name } from "module"
+ var insertPoint = importList.elements[importList.elements.length - 1].getEnd();
+ /**
+ * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element
+ * import {
+ * foo
+ * } from "./module";
+ */
+ var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart());
+ var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd());
+ var oneImportPerLine = endLine - startLine > importList.elements.length;
+ return {
+ newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText,
+ span: { start: insertPoint, length: 0 }
+ };
+ }
+ function getCodeActionForNamespaceImport(declaration) {
+ var namespacePrefix;
+ if (declaration.kind === 235 /* ImportDeclaration */) {
+ namespacePrefix = declaration.importClause.namedBindings.name.getText();
+ }
+ else {
+ namespacePrefix = declaration.name.getText();
+ }
+ namespacePrefix = ts.stripQuotes(namespacePrefix);
+ /**
+ * Cases:
+ * import * as ns from "mod"
+ * import default, * as ns from "mod"
+ * import ns = require("mod")
+ *
+ * Because there is no import list, we alter the reference to include the
+ * namespace instead of altering the import declaration. For example, "foo" would
+ * become "ns.foo"
+ */
+ return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange");
+ }
+ }
+ function getCodeActionForNewImport(moduleSpecifier) {
+ if (!cachedNewImportInsertPosition) {
+ // insert after any existing imports
+ var lastModuleSpecifierEnd = -1;
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var moduleSpecifier_1 = _a[_i];
+ var end = moduleSpecifier_1.getEnd();
+ if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) {
+ lastModuleSpecifierEnd = end;
+ }
+ }
+ cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart();
+ }
+ var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport());
+ var importStatementText = isDefault
+ ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\""
+ : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\"";
+ // if this file doesn't have any import statements, insert an import statement and then insert a new line
+ // between the only import statement and user code. Otherwise just insert the statement because chances
+ // are there are already a new line seperating code and import statements.
+ var newText = cachedNewImportInsertPosition === sourceFile.getStart()
+ ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter
+ : "" + context.newLineCharacter + importStatementText + ";";
+ return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes);
+ function getModuleSpecifierForNewImport() {
+ var fileName = sourceFile.path;
+ var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path;
+ var sourceDirectory = ts.getDirectoryPath(fileName);
+ var options = context.program.getCompilerOptions();
+ return tryGetModuleNameFromAmbientModule() ||
+ tryGetModuleNameFromBaseUrl() ||
+ tryGetModuleNameFromRootDirs() ||
+ tryGetModuleNameFromTypeRoots() ||
+ tryGetModuleNameAsNodeModule() ||
+ ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));
+ function tryGetModuleNameFromAmbientModule() {
+ if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) {
+ return moduleSymbol.name;
+ }
+ }
+ function tryGetModuleNameFromBaseUrl() {
+ if (!options.baseUrl) {
+ return undefined;
+ }
+ var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName);
+ var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl);
+ if (!relativeName) {
+ return undefined;
+ }
+ relativeName = removeExtensionAndIndexPostFix(relativeName);
+ if (options.paths) {
+ for (var key in options.paths) {
+ for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {
+ var pattern = _a[_i];
+ var indexOfStar = pattern.indexOf("*");
+ if (indexOfStar === 0 && pattern.length === 1) {
+ continue;
+ }
+ else if (indexOfStar !== -1) {
+ var prefix = pattern.substr(0, indexOfStar);
+ var suffix = pattern.substr(indexOfStar + 1);
+ if (relativeName.length >= prefix.length + suffix.length &&
+ ts.startsWith(relativeName, prefix) &&
+ ts.endsWith(relativeName, suffix)) {
+ var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
+ return key.replace("\*", matchedStar);
+ }
+ }
+ else if (pattern === relativeName) {
+ return key;
+ }
+ }
+ }
+ }
+ return relativeName;
+ }
+ function tryGetModuleNameFromRootDirs() {
+ if (options.rootDirs) {
+ var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); });
+ var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs);
+ var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs);
+ if (normalizedTargetPath !== undefined) {
+ var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath;
+ return ts.removeFileExtension(relativePath);
+ }
+ }
+ return undefined;
+ }
+ function tryGetModuleNameFromTypeRoots() {
+ var typeRoots = ts.getEffectiveTypeRoots(options, context.host);
+ if (typeRoots) {
+ var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName); });
+ for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) {
+ var typeRoot = normalizedTypeRoots_1[_i];
+ if (ts.startsWith(moduleFileName, typeRoot)) {
+ var relativeFileName = moduleFileName.substring(typeRoot.length + 1);
+ return removeExtensionAndIndexPostFix(relativeFileName);
+ }
+ }
+ }
+ }
+ function tryGetModuleNameAsNodeModule() {
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
+ // nothing to do here
+ return undefined;
+ }
+ var indexOfNodeModules = moduleFileName.indexOf("node_modules");
+ if (indexOfNodeModules < 0) {
+ return undefined;
+ }
+ var relativeFileName;
+ if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) {
+ // if node_modules folder is in this folder or any of its parent folder, no need to keep it.
+ relativeFileName = moduleFileName.substring(indexOfNodeModules + 13 /* "node_modules\".length */);
+ }
+ else {
+ relativeFileName = getRelativePath(moduleFileName, sourceDirectory);
+ }
+ relativeFileName = ts.removeFileExtension(relativeFileName);
+ if (ts.endsWith(relativeFileName, "/index")) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ else {
+ try {
+ var moduleDirectory = ts.getDirectoryPath(moduleFileName);
+ var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json")));
+ if (packageJsonContent) {
+ var mainFile = packageJsonContent.main || packageJsonContent.typings;
+ if (mainFile) {
+ var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName);
+ if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ }
+ }
+ }
+ catch (e) { }
+ }
+ return relativeFileName;
+ }
+ }
+ function getPathRelativeToRootDirs(path, rootDirs) {
+ for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) {
+ var rootDir = rootDirs_2[_i];
+ var relativeName = tryRemoveParentDirectoryName(path, rootDir);
+ if (relativeName !== undefined) {
+ return relativeName;
+ }
+ }
+ return undefined;
+ }
+ function removeExtensionAndIndexPostFix(fileName) {
+ fileName = ts.removeFileExtension(fileName);
+ if (ts.endsWith(fileName, "/index")) {
+ fileName = fileName.substr(0, fileName.length - 6 /* "/index".length */);
+ }
+ return fileName;
+ }
+ function getRelativePath(path, directoryPath) {
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
+ return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath;
+ }
+ function tryRemoveParentDirectoryName(path, parentDirectory) {
+ var index = path.indexOf(parentDirectory);
+ if (index === 0) {
+ return ts.endsWith(parentDirectory, ts.directorySeparator)
+ ? path.substring(parentDirectory.length)
+ : path.substring(parentDirectory.length + 1);
+ }
+ return undefined;
+ }
+ }
+ }
+ function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) {
+ return {
+ description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)),
+ changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }],
+ kind: kind,
+ moduleSpecifier: moduleSpecifier
+ };
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ codefix.registerCodeFix({
+ errorCodes: [
+ ts.Diagnostics._0_is_declared_but_never_used.code,
+ ts.Diagnostics.Property_0_is_declared_but_never_used.code
+ ],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var start = context.span.start;
+ var token = ts.getTokenAtPosition(sourceFile, start);
+ // this handles var ["computed"] = 12;
+ if (token.kind === 20 /* OpenBracketToken */) {
+ token = ts.getTokenAtPosition(sourceFile, start + 1);
+ }
+ switch (token.kind) {
+ case 70 /* Identifier */:
+ switch (token.parent.kind) {
+ case 223 /* VariableDeclaration */:
+ switch (token.parent.parent.parent.kind) {
+ case 211 /* ForStatement */:
+ var forStatement = token.parent.parent.parent;
+ var forInitializer = forStatement.initializer;
+ if (forInitializer.declarations.length === 1) {
+ return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
+ }
+ else {
+ return removeSingleItem(forInitializer.declarations, token);
+ }
+ case 213 /* ForOfStatement */:
+ var forOfStatement = token.parent.parent.parent;
+ if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) {
+ var forOfInitializer = forOfStatement.initializer;
+ return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
+ }
+ break;
+ case 212 /* ForInStatement */:
+ // There is no valid fix in the case of:
+ // for .. in
+ return undefined;
+ case 256 /* CatchClause */:
+ var catchClause = token.parent.parent;
+ var parameter = catchClause.variableDeclaration.getChildren()[0];
+ return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
+ default:
+ var variableStatement = token.parent.parent.parent;
+ if (variableStatement.declarationList.declarations.length === 1) {
+ return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
+ }
+ else {
+ var declarations = variableStatement.declarationList.declarations;
+ return removeSingleItem(declarations, token);
+ }
+ }
+ case 143 /* TypeParameter */:
+ var typeParameters = token.parent.parent.typeParameters;
+ if (typeParameters.length === 1) {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
+ }
+ else {
+ return removeSingleItem(typeParameters, token);
+ }
+ case 144 /* Parameter */:
+ var functionDeclaration = token.parent.parent;
+ if (functionDeclaration.parameters.length === 1) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else {
+ return removeSingleItem(functionDeclaration.parameters, token);
+ }
+ // handle case where 'import a = A;'
+ case 234 /* ImportEqualsDeclaration */:
+ var importEquals = findImportDeclaration(token);
+ return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
+ case 239 /* ImportSpecifier */:
+ var namedImports = token.parent.parent;
+ if (namedImports.elements.length === 1) {
+ // Only 1 import and it is unused. So the entire declaration should be removed.
+ var importSpec = findImportDeclaration(token);
+ return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
+ }
+ else {
+ return removeSingleItem(namedImports.elements, token);
+ }
+ // handle case where "import d, * as ns from './file'"
+ // or "'import {a, b as ns} from './file'"
+ case 236 /* ImportClause */:
+ var importClause = token.parent;
+ if (!importClause.namedBindings) {
+ var importDecl = findImportDeclaration(importClause);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
+ }
+ case 237 /* NamespaceImport */:
+ var namespaceImport = token.parent;
+ if (namespaceImport.name == token && !namespaceImport.parent.name) {
+ var importDecl = findImportDeclaration(namespaceImport);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ var start_4 = namespaceImport.parent.name.end;
+ return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4);
+ }
+ }
+ break;
+ case 147 /* PropertyDeclaration */:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ case 237 /* NamespaceImport */:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ if (ts.isDeclarationName(token)) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else if (ts.isLiteralComputedPropertyDeclarationName(token)) {
+ return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
+ }
+ else {
+ return undefined;
+ }
+ function findImportDeclaration(token) {
+ var importDecl = token;
+ while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) {
+ importDecl = importDecl.parent;
+ }
+ return importDecl;
+ }
+ function createCodeFix(newText, start, length) {
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers),
+ changes: [{
+ fileName: sourceFile.fileName,
+ textChanges: [{ newText: newText, span: { start: start, length: length } }]
+ }]
+ }];
+ }
+ function removeSingleItem(elements, token) {
+ if (elements[0] === token.parent) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
+ }
+ else {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
+ }
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
///<reference path='superFixes.ts' />
+///<reference path='importFixes.ts' />
+///<reference path='unusedIdentifierFixes.ts' />
/// <reference path="..\compiler\program.ts"/>
/// <reference path="..\compiler\commandLineParser.ts"/>
/// <reference path='types.ts' />
@@ -76599,11 +77962,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(291 /* SyntaxList */, nodes.pos, nodes.end, this);
+ var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
- var node = nodes_5[_i];
+ for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
+ var node = nodes_7[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -76622,7 +77985,7 @@ var ts;
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 290 /* LastJSDocTagNode */;
+ var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -76641,8 +78004,8 @@ var ts;
pos_3 = nodes.end;
};
// jsDocComments need to be the first children
- if (this.jsDocComments) {
- for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
+ if (this.jsDoc) {
+ for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
processNode(jsDocComment);
}
@@ -76866,6 +78229,20 @@ var ts;
SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
return ts.getPositionOfLineAndCharacter(this, line, character);
};
+ SourceFileObject.prototype.getLineEndOfPosition = function (pos) {
+ var line = this.getLineAndCharacterOfPosition(pos).line;
+ var lineStarts = this.getLineStarts();
+ var lastCharPos;
+ if (line + 1 >= lineStarts.length) {
+ lastCharPos = this.getEnd();
+ }
+ if (!lastCharPos) {
+ lastCharPos = lineStarts[line + 1] - 1;
+ }
+ var fullText = this.getFullText();
+ // if the new line is "\r\n", we should return the last non-new-line-character position
+ return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos;
+ };
SourceFileObject.prototype.getNamedDeclarations = function () {
if (!this.namedDeclarations) {
this.namedDeclarations = this.computeNamedDeclarations();
@@ -76887,9 +78264,9 @@ var ts;
}
function getDeclarationName(declaration) {
if (declaration.name) {
- var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
- if (result_6 !== undefined) {
- return result_6;
+ var result_7 = getTextOfIdentifierOrLiteral(declaration.name);
+ if (result_7 !== undefined) {
+ return result_7;
}
if (declaration.name.kind === 142 /* ComputedPropertyName */) {
var expr = declaration.name.expression;
@@ -77845,7 +79222,9 @@ var ts;
sourceFile: sourceFile,
span: span,
program: program,
- newLineCharacter: newLineChar
+ newLineCharacter: newLineChar,
+ host: host,
+ cancellationToken: cancellationToken
};
var fixes = ts.codefix.getFixes(context);
if (fixes) {
@@ -78087,10 +79466,10 @@ var ts;
break;
default:
ts.forEachChild(node, walk);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- ts.forEachChild(jsDocComment, walk);
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ ts.forEachChild(jsDoc, walk);
}
}
}
@@ -79416,7 +80795,7 @@ var ts;
if (result.error) {
return {
options: {},
- typingOptions: {},
+ typeAcquisition: {},
files: [],
raw: {},
errors: [realizeDiagnostic(result.error, "\r\n")]
@@ -79426,7 +80805,7 @@ var ts;
var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName);
return {
options: configFile.options,
- typingOptions: configFile.typingOptions,
+ typeAcquisition: configFile.typeAcquisition,
files: configFile.fileNames,
raw: configFile.raw,
errors: realizeDiagnostics(configFile.errors, "\r\n")
@@ -79441,7 +80820,7 @@ var ts;
var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false);
return this.forwardJSONCall("discoverTypings()", function () {
var info = JSON.parse(discoverTypingsJson);
- return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports);
+ return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);
});
};
return CoreServicesShimObject;
diff --git a/node_modules/typescript/lib/typescriptServices.d.ts b/node_modules/typescript/lib/typescriptServices.d.ts
index 1bfe70d03..ecd018623 100644
--- a/node_modules/typescript/lib/typescriptServices.d.ts
+++ b/node_modules/typescript/lib/typescriptServices.d.ts
@@ -317,23 +317,25 @@ declare namespace ts {
JSDocThisType = 277,
JSDocComment = 278,
JSDocTag = 279,
- JSDocParameterTag = 280,
- JSDocReturnTag = 281,
- JSDocTypeTag = 282,
- JSDocTemplateTag = 283,
- JSDocTypedefTag = 284,
- JSDocPropertyTag = 285,
- JSDocTypeLiteral = 286,
- JSDocLiteralType = 287,
- JSDocNullKeyword = 288,
- JSDocUndefinedKeyword = 289,
- JSDocNeverKeyword = 290,
- SyntaxList = 291,
- NotEmittedStatement = 292,
- PartiallyEmittedExpression = 293,
- MergeDeclarationMarker = 294,
- EndOfDeclarationMarker = 295,
- Count = 296,
+ JSDocAugmentsTag = 280,
+ JSDocParameterTag = 281,
+ JSDocReturnTag = 282,
+ JSDocTypeTag = 283,
+ JSDocTemplateTag = 284,
+ JSDocTypedefTag = 285,
+ JSDocPropertyTag = 286,
+ JSDocTypeLiteral = 287,
+ JSDocLiteralType = 288,
+ JSDocNullKeyword = 289,
+ JSDocUndefinedKeyword = 290,
+ JSDocNeverKeyword = 291,
+ SyntaxList = 292,
+ NotEmittedStatement = 293,
+ PartiallyEmittedExpression = 294,
+ MergeDeclarationMarker = 295,
+ EndOfDeclarationMarker = 296,
+ RawExpression = 297,
+ Count = 298,
FirstAssignment = 57,
LastAssignment = 69,
FirstCompoundAssignment = 58,
@@ -360,9 +362,9 @@ declare namespace ts {
LastBinaryOperator = 69,
FirstNode = 141,
FirstJSDocNode = 262,
- LastJSDocNode = 287,
+ LastJSDocNode = 288,
FirstJSDocTagNode = 278,
- LastJSDocTagNode = 290,
+ LastJSDocTagNode = 291,
}
enum NodeFlags {
None = 0,
@@ -464,14 +466,14 @@ declare namespace ts {
right: Identifier;
}
type EntityName = Identifier | QualifiedName;
- type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
- type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
+ type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
+ type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern;
interface Declaration extends Node {
_declarationBrand: any;
name?: DeclarationName;
}
interface DeclarationStatement extends Declaration, Statement {
- name?: Identifier | LiteralExpression;
+ name?: Identifier | StringLiteral | NumericLiteral;
}
interface ComputedPropertyName extends Node {
kind: SyntaxKind.ComputedPropertyName;
@@ -573,18 +575,16 @@ declare namespace ts {
interface PropertyLikeDeclaration extends Declaration {
name: PropertyName;
}
- interface BindingPattern extends Node {
- elements: NodeArray<BindingElement | ArrayBindingElement>;
- }
- interface ObjectBindingPattern extends BindingPattern {
+ interface ObjectBindingPattern extends Node {
kind: SyntaxKind.ObjectBindingPattern;
elements: NodeArray<BindingElement>;
}
- type ArrayBindingElement = BindingElement | OmittedExpression;
- interface ArrayBindingPattern extends BindingPattern {
+ interface ArrayBindingPattern extends Node {
kind: SyntaxKind.ArrayBindingPattern;
elements: NodeArray<ArrayBindingElement>;
}
+ type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
+ type ArrayBindingElement = BindingElement | OmittedExpression;
/**
* Several node kinds share function-like features such as a signature,
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
@@ -809,17 +809,25 @@ declare namespace ts {
operatorToken: BinaryOperatorToken;
right: Expression;
}
- interface AssignmentExpression extends BinaryExpression {
+ type AssignmentOperatorToken = Token<AssignmentOperator>;
+ interface AssignmentExpression<TOperator extends AssignmentOperatorToken> extends BinaryExpression {
left: LeftHandSideExpression;
- operatorToken: Token<SyntaxKind.EqualsToken>;
+ operatorToken: TOperator;
}
- interface ObjectDestructuringAssignment extends AssignmentExpression {
+ interface ObjectDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ObjectLiteralExpression;
}
- interface ArrayDestructuringAssignment extends AssignmentExpression {
+ interface ArrayDestructuringAssignment extends AssignmentExpression<EqualsToken> {
left: ArrayLiteralExpression;
}
type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment;
+ type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression<EqualsToken> | Identifier | PropertyAccessExpression | ElementAccessExpression;
+ type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment;
+ type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression;
+ type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression;
+ type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression;
+ type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression;
+ type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern;
interface ConditionalExpression extends Expression {
kind: SyntaxKind.ConditionalExpression;
condition: Expression;
@@ -1180,7 +1188,7 @@ declare namespace ts {
type ModuleName = Identifier | StringLiteral;
interface ModuleDeclaration extends DeclarationStatement {
kind: SyntaxKind.ModuleDeclaration;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral;
body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier;
}
interface NamespaceDeclaration extends ModuleDeclaration {
@@ -1332,7 +1340,7 @@ declare namespace ts {
type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
interface JSDocRecordMember extends PropertySignature {
kind: SyntaxKind.JSDocRecordMember;
- name: Identifier | LiteralExpression;
+ name: Identifier | StringLiteral | NumericLiteral;
type?: JSDocType;
}
interface JSDoc extends Node {
@@ -1348,6 +1356,10 @@ declare namespace ts {
interface JSDocUnknownTag extends JSDocTag {
kind: SyntaxKind.JSDocTag;
}
+ interface JSDocAugmentsTag extends JSDocTag {
+ kind: SyntaxKind.JSDocAugmentsTag;
+ typeExpression: JSDocTypeExpression;
+ }
interface JSDocTemplateTag extends JSDocTag {
kind: SyntaxKind.JSDocTemplateTag;
typeParameters: NodeArray<TypeParameterDeclaration>;
@@ -1596,6 +1608,7 @@ declare namespace ts {
getJsxIntrinsicTagNames(): Symbol[];
isOptionalParameter(node: ParameterDeclaration): boolean;
getAmbientModules(): Symbol[];
+ tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
}
interface SymbolDisplayBuilder {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
@@ -1761,7 +1774,7 @@ declare namespace ts {
Literal = 480,
StringOrNumberLiteral = 96,
PossiblyFalsy = 7406,
- StringLike = 34,
+ StringLike = 262178,
NumberLike = 340,
BooleanLike = 136,
EnumLike = 272,
@@ -1845,7 +1858,7 @@ declare namespace ts {
}
interface IndexedAccessType extends Type {
objectType: Type;
- indexType: TypeParameter;
+ indexType: Type;
}
enum SignatureKind {
Call = 0,
@@ -1962,12 +1975,13 @@ declare namespace ts {
target?: ScriptTarget;
traceResolution?: boolean;
types?: string[];
- /** Paths used to used to compute primary types search locations */
+ /** Paths used to compute primary types search locations */
typeRoots?: string[];
[option: string]: CompilerOptionsValue | undefined;
}
- interface TypingOptions {
+ interface TypeAcquisition {
enableAutoDiscovery?: boolean;
+ enable?: boolean;
include?: string[];
exclude?: string[];
[option: string]: string[] | boolean | undefined;
@@ -1977,7 +1991,7 @@ declare namespace ts {
projectRootPath: string;
safeListPath: string;
packageNameToTypingLocation: Map<string>;
- typingOptions: TypingOptions;
+ typeAcquisition: TypeAcquisition;
compilerOptions: CompilerOptions;
unresolvedImports: ReadonlyArray<string>;
}
@@ -2025,7 +2039,7 @@ declare namespace ts {
/** Either a parsed command line or a parsed tsconfig.json */
interface ParsedCommandLine {
options: CompilerOptions;
- typingOptions?: TypingOptions;
+ typeAcquisition?: TypeAcquisition;
fileNames: string[];
raw?: any;
errors: Diagnostic[];
@@ -2130,6 +2144,10 @@ declare namespace ts {
}
}
declare namespace ts {
+ /** The version of the TypeScript compiler release */
+ const version = "2.2.0-dev.20161127";
+}
+declare namespace ts {
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
type DirectoryWatcherCallback = (fileName: string) => void;
interface WatchedFile {
@@ -2260,9 +2278,19 @@ declare namespace ts {
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
- function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean;
+ function isParameterPropertyDeclaration(node: Node): boolean;
function getCombinedModifierFlags(node: Node): ModifierFlags;
function getCombinedNodeFlags(node: Node): NodeFlags;
+ /**
+ * Checks to see if the locale is in the appropriate format,
+ * and if it is, attempts to set the appropriate language.
+ */
+ function validateLocaleAndSetLanguage(locale: string, sys: {
+ getExecutingFilePath(): string;
+ resolvePath(path: string): string;
+ fileExists(fileName: string): boolean;
+ readFile(fileName: string): string;
+ }, errors?: Diagnostic[]): void;
}
declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
@@ -2273,6 +2301,7 @@ declare namespace ts {
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
declare namespace ts {
+ function moduleHasNonRelativeName(moduleName: string): boolean;
function getEffectiveTypeRoots(options: CompilerOptions, host: {
directoryExists?: (directoryName: string) => boolean;
getCurrentDirectory?: () => string;
@@ -2297,8 +2326,6 @@ declare namespace ts {
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
}
declare namespace ts {
- /** The version of the TypeScript compiler release */
- const version = "2.2.0-dev.20161115";
function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
@@ -2343,8 +2370,8 @@ declare namespace ts {
options: CompilerOptions;
errors: Diagnostic[];
};
- function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
- options: TypingOptions;
+ function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
+ options: TypeAcquisition;
errors: Diagnostic[];
};
}
@@ -2393,6 +2420,7 @@ declare namespace ts {
}
interface SourceFile {
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
+ getLineEndOfPosition(pos: number): number;
getLineStarts(): number[];
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
diff --git a/node_modules/typescript/lib/typescriptServices.js b/node_modules/typescript/lib/typescriptServices.js
index 4964aa75f..d4ad545cf 100644
--- a/node_modules/typescript/lib/typescriptServices.js
+++ b/node_modules/typescript/lib/typescriptServices.js
@@ -333,26 +333,28 @@ var ts;
SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType";
SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment";
SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 280] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 281] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 282] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 283] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 284] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 285] = "JSDocPropertyTag";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 286] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocLiteralType"] = 287] = "JSDocLiteralType";
- SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 288] = "JSDocNullKeyword";
- SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 289] = "JSDocUndefinedKeyword";
- SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 290] = "JSDocNeverKeyword";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType";
+ SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword";
+ SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword";
+ SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 291] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 292] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 293] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 294] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 295] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 296] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 298] = "Count";
// Markers
SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment";
@@ -380,9 +382,9 @@ var ts;
SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator";
SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode";
SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 287] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode";
SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 290] = "LastJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -710,7 +712,7 @@ var ts;
TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic";
/* @internal */
TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive";
- TypeFlags[TypeFlags["StringLike"] = 34] = "StringLike";
+ TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike";
TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike";
TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike";
TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike";
@@ -974,98 +976,95 @@ var ts;
// - Flags used to indicate that a node or subtree contains syntax that requires transformation.
TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript";
TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript";
- TransformFlags[TransformFlags["Jsx"] = 4] = "Jsx";
- TransformFlags[TransformFlags["ContainsJsx"] = 8] = "ContainsJsx";
- TransformFlags[TransformFlags["ESNext"] = 16] = "ESNext";
- TransformFlags[TransformFlags["ContainsESNext"] = 32] = "ContainsESNext";
- TransformFlags[TransformFlags["ES2017"] = 64] = "ES2017";
- TransformFlags[TransformFlags["ContainsES2017"] = 128] = "ContainsES2017";
- TransformFlags[TransformFlags["ES2016"] = 256] = "ES2016";
- TransformFlags[TransformFlags["ContainsES2016"] = 512] = "ContainsES2016";
- TransformFlags[TransformFlags["ES2015"] = 1024] = "ES2015";
- TransformFlags[TransformFlags["ContainsES2015"] = 2048] = "ContainsES2015";
- TransformFlags[TransformFlags["Generator"] = 4096] = "Generator";
- TransformFlags[TransformFlags["ContainsGenerator"] = 8192] = "ContainsGenerator";
- TransformFlags[TransformFlags["DestructuringAssignment"] = 16384] = "DestructuringAssignment";
- TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 32768] = "ContainsDestructuringAssignment";
+ TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx";
+ TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext";
+ TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017";
+ TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016";
+ TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015";
+ TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015";
+ TransformFlags[TransformFlags["Generator"] = 256] = "Generator";
+ TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator";
+ TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment";
+ TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment";
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
- TransformFlags[TransformFlags["ContainsDecorators"] = 65536] = "ContainsDecorators";
- TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 131072] = "ContainsPropertyInitializer";
- TransformFlags[TransformFlags["ContainsLexicalThis"] = 262144] = "ContainsLexicalThis";
- TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 524288] = "ContainsCapturedLexicalThis";
- TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 1048576] = "ContainsLexicalThisInComputedPropertyName";
- TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 2097152] = "ContainsDefaultValueAssignments";
- TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 4194304] = "ContainsParameterPropertyAssignments";
- TransformFlags[TransformFlags["ContainsSpreadExpression"] = 8388608] = "ContainsSpreadExpression";
- TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 16777216] = "ContainsComputedPropertyName";
- TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 33554432] = "ContainsBlockScopedBinding";
- TransformFlags[TransformFlags["ContainsBindingPattern"] = 67108864] = "ContainsBindingPattern";
- TransformFlags[TransformFlags["ContainsYield"] = 134217728] = "ContainsYield";
- TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 268435456] = "ContainsHoistedDeclarationOrCompletion";
+ TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators";
+ TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer";
+ TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis";
+ TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis";
+ TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments";
+ TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments";
+ TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread";
+ TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread";
+ TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest";
+ TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest";
+ TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName";
+ TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding";
+ TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern";
+ TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield";
+ TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion";
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
// Assertions
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript";
- TransformFlags[TransformFlags["AssertJsx"] = 12] = "AssertJsx";
- TransformFlags[TransformFlags["AssertESNext"] = 48] = "AssertESNext";
- TransformFlags[TransformFlags["AssertES2017"] = 192] = "AssertES2017";
- TransformFlags[TransformFlags["AssertES2016"] = 768] = "AssertES2016";
- TransformFlags[TransformFlags["AssertES2015"] = 3072] = "AssertES2015";
- TransformFlags[TransformFlags["AssertGenerator"] = 12288] = "AssertGenerator";
- TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 49152] = "AssertDestructuringAssignment";
+ TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx";
+ TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext";
+ TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017";
+ TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016";
+ TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015";
+ TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator";
+ TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment";
// Scope Exclusions
// - Bitmasks that exclude flags from propagating out of a specific context
// into the subtree flags of their container.
- TransformFlags[TransformFlags["NodeExcludes"] = 536892757] = "NodeExcludes";
- TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 979719509] = "ArrowFunctionExcludes";
- TransformFlags[TransformFlags["FunctionExcludes"] = 980243797] = "FunctionExcludes";
- TransformFlags[TransformFlags["ConstructorExcludes"] = 975983957] = "ConstructorExcludes";
- TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 975983957] = "MethodOrAccessorExcludes";
- TransformFlags[TransformFlags["ClassExcludes"] = 559895893] = "ClassExcludes";
- TransformFlags[TransformFlags["ModuleExcludes"] = 839734613] = "ModuleExcludes";
+ TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes";
+ TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes";
+ TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes";
+ TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes";
+ TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes";
+ TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes";
+ TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes";
TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes";
- TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 554784085] = "ObjectLiteralExcludes";
- TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 545281365] = "ArrayLiteralOrCallOrNewExcludes";
- TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 604001621] = "VariableDeclarationListExcludes";
- TransformFlags[TransformFlags["ParameterExcludes"] = 604001621] = "ParameterExcludes";
+ TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes";
+ TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes";
+ TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes";
+ TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes";
+ TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes";
+ TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes";
// Masks
// - Additional bitmasks
- TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 4390912] = "TypeScriptClassSyntaxMask";
- TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 2621440] = "ES2015FunctionSyntaxMask";
+ TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask";
+ TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask";
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
/* @internal */
var EmitFlags;
(function (EmitFlags) {
- EmitFlags[EmitFlags["EmitEmitHelpers"] = 1] = "EmitEmitHelpers";
- EmitFlags[EmitFlags["EmitExportStar"] = 2] = "EmitExportStar";
- EmitFlags[EmitFlags["EmitSuperHelper"] = 4] = "EmitSuperHelper";
- EmitFlags[EmitFlags["EmitAdvancedSuperHelper"] = 8] = "EmitAdvancedSuperHelper";
- EmitFlags[EmitFlags["UMDDefine"] = 16] = "UMDDefine";
- EmitFlags[EmitFlags["SingleLine"] = 32] = "SingleLine";
- EmitFlags[EmitFlags["AdviseOnEmitNode"] = 64] = "AdviseOnEmitNode";
- EmitFlags[EmitFlags["NoSubstitution"] = 128] = "NoSubstitution";
- EmitFlags[EmitFlags["CapturesThis"] = 256] = "CapturesThis";
- EmitFlags[EmitFlags["NoLeadingSourceMap"] = 512] = "NoLeadingSourceMap";
- EmitFlags[EmitFlags["NoTrailingSourceMap"] = 1024] = "NoTrailingSourceMap";
- EmitFlags[EmitFlags["NoSourceMap"] = 1536] = "NoSourceMap";
- EmitFlags[EmitFlags["NoNestedSourceMaps"] = 2048] = "NoNestedSourceMaps";
- EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 4096] = "NoTokenLeadingSourceMaps";
- EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 8192] = "NoTokenTrailingSourceMaps";
- EmitFlags[EmitFlags["NoTokenSourceMaps"] = 12288] = "NoTokenSourceMaps";
- EmitFlags[EmitFlags["NoLeadingComments"] = 16384] = "NoLeadingComments";
- EmitFlags[EmitFlags["NoTrailingComments"] = 32768] = "NoTrailingComments";
- EmitFlags[EmitFlags["NoComments"] = 49152] = "NoComments";
- EmitFlags[EmitFlags["NoNestedComments"] = 65536] = "NoNestedComments";
- EmitFlags[EmitFlags["ExportName"] = 131072] = "ExportName";
- EmitFlags[EmitFlags["LocalName"] = 262144] = "LocalName";
- EmitFlags[EmitFlags["Indented"] = 524288] = "Indented";
- EmitFlags[EmitFlags["NoIndentation"] = 1048576] = "NoIndentation";
- EmitFlags[EmitFlags["AsyncFunctionBody"] = 2097152] = "AsyncFunctionBody";
- EmitFlags[EmitFlags["ReuseTempVariableScope"] = 4194304] = "ReuseTempVariableScope";
- EmitFlags[EmitFlags["CustomPrologue"] = 8388608] = "CustomPrologue";
- EmitFlags[EmitFlags["NoHoisting"] = 16777216] = "NoHoisting";
- EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 33554432] = "HasEndOfDeclarationMarker";
+ EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine";
+ EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode";
+ EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution";
+ EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis";
+ EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap";
+ EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap";
+ EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap";
+ EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps";
+ EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps";
+ EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps";
+ EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments";
+ EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments";
+ EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments";
+ EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments";
+ EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName";
+ EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName";
+ EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName";
+ EmitFlags[EmitFlags["Indented"] = 32768] = "Indented";
+ EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation";
+ EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody";
+ EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope";
+ EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue";
+ EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting";
+ EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker";
})(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {}));
/* @internal */
var EmitContext;
@@ -1172,9 +1171,13 @@ var ts;
})(ts || (ts = {}));
/// <reference path="types.ts"/>
/// <reference path="performance.ts" />
-/* @internal */
var ts;
(function (ts) {
+ /** The version of the TypeScript compiler release */
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+/* @internal */
+(function (ts) {
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
@@ -1727,7 +1730,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -1750,6 +1753,17 @@ var ts;
return to;
}
ts.addRange = addRange;
+ /**
+ * Stable sort of an array. Elements equal to each other maintain their relative position in the array.
+ */
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; }) // create array of indices
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); }) // sort indices by value then position
+ .map(function (i) { return array[i]; }); // get sorted array
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -1968,6 +1982,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -2483,6 +2506,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
/* @internal */
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
@@ -3140,6 +3171,17 @@ var ts;
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
/** Remove an item from an array, moving everything to its right one space left. */
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
+ /** Remove an item by index from an array, moving everything to its right one space left. */
function orderedRemoveItemAt(array, index) {
// This seems to be faster than either `array.splice(i, 1)` or `array.copyWithin(i, i+ 1)`.
for (var i = index; i < array.length - 1; i++) {
@@ -4244,7 +4286,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -4309,7 +4351,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -4380,6 +4423,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -4594,9 +4638,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -4608,6 +4652,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
/// <reference path="core.ts"/>
@@ -6552,7 +6599,7 @@ var ts;
return !nodeIsMissing(node);
}
ts.nodeIsPresent = nodeIsPresent;
- function getTokenPosOfNode(node, sourceFile, includeJsDocComment) {
+ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
// With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
// want to skip trivia because this will launch us forward to the next token.
if (nodeIsMissing(node)) {
@@ -6561,25 +6608,25 @@ var ts;
if (isJSDocNode(node)) {
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
}
- if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
- return getTokenPosOfNode(node.jsDocComments[0]);
+ if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
+ return getTokenPosOfNode(node.jsDoc[0]);
}
// For a syntax list, it is possible that one of its children has JSDocComment nodes, while
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 291 /* SyntaxList */ && node._children.length > 0) {
- return getTokenPosOfNode(node._children[0], sourceFile, includeJsDocComment);
+ if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) {
+ return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
}
ts.getTokenPosOfNode = getTokenPosOfNode;
function isJSDocNode(node) {
- return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 287 /* LastJSDocNode */;
+ return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocTag(node) {
- return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 290 /* LastJSDocTagNode */;
+ return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function getNonDecoratorTokenPosOfNode(node, sourceFile) {
@@ -6778,7 +6825,7 @@ var ts;
case 8 /* NumericLiteral */:
return name.text;
case 142 /* ComputedPropertyName */:
- if (isStringOrNumericLiteral(name.expression.kind)) {
+ if (isStringOrNumericLiteral(name.expression)) {
return name.expression.text;
}
}
@@ -6907,7 +6954,8 @@ var ts;
}
ts.isSuperCall = isSuperCall;
function isPrologueDirective(node) {
- return node.kind === 207 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */;
+ return node.kind === 207 /* ExpressionStatement */
+ && node.expression.kind === 9 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
@@ -6918,26 +6966,21 @@ var ts;
return ts.getLeadingCommentRanges(text, node.pos);
}
ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText;
- function getJsDocComments(node, sourceFileOfNode) {
- return getJsDocCommentsFromText(node, sourceFileOfNode.text);
- }
- ts.getJsDocComments = getJsDocComments;
- function getJsDocCommentsFromText(node, text) {
+ function getJSDocCommentRanges(node, text) {
var commentRanges = (node.kind === 144 /* Parameter */ ||
node.kind === 143 /* TypeParameter */ ||
node.kind === 184 /* FunctionExpression */ ||
node.kind === 185 /* ArrowFunction */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
getLeadingCommentRangesOfNodeFromText(node, text);
- return ts.filter(commentRanges, isJsDocComment);
- function isJsDocComment(comment) {
- // True if the comment starts with '/**' but not if it is '/**/'
+ // True if the comment starts with '/**' but not if it is '/**/'
+ return ts.filter(commentRanges, function (comment) {
return text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ &&
text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ &&
text.charCodeAt(comment.pos + 3) !== 47 /* slash */;
- }
+ });
}
- ts.getJsDocCommentsFromText = getJsDocCommentsFromText;
+ ts.getJSDocCommentRanges = getJSDocCommentRanges;
ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/;
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
@@ -7520,6 +7563,7 @@ var ts;
case 145 /* Decorator */:
case 252 /* JsxExpression */:
case 251 /* JsxSpreadAttribute */:
+ case 259 /* SpreadAssignment */:
return true;
case 199 /* ExpressionWithTypeArguments */:
return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3);
@@ -7690,127 +7734,98 @@ var ts;
node.parameters[0].type.kind === 276 /* JSDocConstructorType */;
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
- function getJSDocTag(node, kind, checkParentVariableStatement) {
- if (!node) {
- return undefined;
- }
- var jsDocTags = getJSDocTags(node, checkParentVariableStatement);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_1 = jsDocTags; _i < jsDocTags_1.length; _i++) {
- var tag = jsDocTags_1[_i];
- if (tag.kind === kind) {
- return tag;
- }
- }
+ function getCommentsFromJSDoc(node) {
+ return ts.map(getJSDocs(node), function (doc) { return doc.comment; });
}
- function append(previous, additional) {
- if (additional) {
- if (!previous) {
- previous = [];
- }
- for (var _i = 0, additional_1 = additional; _i < additional_1.length; _i++) {
- var x = additional_1[_i];
- previous.push(x);
- }
- }
- return previous;
- }
- function getJSDocComments(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) { return ts.map(docs, function (doc) { return doc.comment; }); }, function (tags) { return ts.map(tags, function (tag) { return tag.comment; }); });
- }
- ts.getJSDocComments = getJSDocComments;
- function getJSDocTags(node, checkParentVariableStatement) {
- return getJSDocs(node, checkParentVariableStatement, function (docs) {
+ ts.getCommentsFromJSDoc = getCommentsFromJSDoc;
+ function getJSDocTags(node, kind) {
+ var docs = getJSDocs(node);
+ if (docs) {
var result = [];
for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) {
var doc = docs_1[_i];
- if (doc.tags) {
- result.push.apply(result, doc.tags);
+ if (doc.kind === 281 /* JSDocParameterTag */) {
+ if (doc.kind === kind) {
+ result.push(doc);
+ }
+ }
+ else {
+ result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; }));
}
}
return result;
- }, function (tags) { return tags; });
- }
- function getJSDocs(node, checkParentVariableStatement, getDocs, getTags) {
- // TODO: Get rid of getJsDocComments and friends (note the lowercase 's' in Js)
- // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now...
- var result = undefined;
- // prepend documentation from parent sources
- if (checkParentVariableStatement) {
+ }
+ }
+ function getFirstJSDocTag(node, kind) {
+ return node && ts.firstOrUndefined(getJSDocTags(node, kind));
+ }
+ function getJSDocs(node) {
+ var cache = node.jsDocCache;
+ if (!cache) {
+ getJSDocsWorker(node);
+ node.jsDocCache = cache;
+ }
+ return cache;
+ function getJSDocsWorker(node) {
+ var parent = node.parent;
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
// /**
// * @param {number} name
// * @returns {number}
// */
// var x = function(name) { return name.length; }
- var isInitializerOfVariableDeclarationInStatement = isVariableLike(node.parent) &&
- (node.parent).initializer === node &&
- node.parent.parent.parent.kind === 205 /* VariableStatement */;
+ var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) &&
+ parent.initializer === node &&
+ parent.parent.parent.kind === 205 /* VariableStatement */;
var isVariableOfVariableDeclarationStatement = isVariableLike(node) &&
- node.parent.parent.kind === 205 /* VariableStatement */;
- var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent :
- isVariableOfVariableDeclarationStatement ? node.parent.parent :
+ parent.parent.kind === 205 /* VariableStatement */;
+ var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent :
+ isVariableOfVariableDeclarationStatement ? parent.parent :
undefined;
if (variableStatementNode) {
- result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags));
- }
- if (node.kind === 230 /* ModuleDeclaration */ &&
- node.parent && node.parent.kind === 230 /* ModuleDeclaration */) {
- result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(variableStatementNode);
}
// Also recognize when the node is the RHS of an assignment expression
- var parent_4 = node.parent;
- var isSourceOfAssignmentExpressionStatement = parent_4 && parent_4.parent &&
- parent_4.kind === 192 /* BinaryExpression */ &&
- parent_4.operatorToken.kind === 57 /* EqualsToken */ &&
- parent_4.parent.kind === 207 /* ExpressionStatement */;
+ var isSourceOfAssignmentExpressionStatement = parent && parent.parent &&
+ parent.kind === 192 /* BinaryExpression */ &&
+ parent.operatorToken.kind === 57 /* EqualsToken */ &&
+ parent.parent.kind === 207 /* ExpressionStatement */;
if (isSourceOfAssignmentExpressionStatement) {
- result = append(result, getJSDocs(parent_4.parent, checkParentVariableStatement, getDocs, getTags));
+ getJSDocsWorker(parent.parent);
}
- var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 257 /* PropertyAssignment */;
- if (isPropertyAssignmentExpression) {
- result = append(result, getJSDocs(parent_4, checkParentVariableStatement, getDocs, getTags));
+ var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ &&
+ parent && parent.kind === 230 /* ModuleDeclaration */;
+ var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */;
+ if (isModuleDeclaration || isPropertyAssignmentExpression) {
+ getJSDocsWorker(parent);
}
// Pull parameter comments from declaring function as well
if (node.kind === 144 /* Parameter */) {
- var paramTags = getJSDocParameterTag(node, checkParentVariableStatement);
- if (paramTags) {
- result = append(result, getTags(paramTags));
- }
+ cache = ts.concatenate(cache, getJSDocParameterTags(node));
}
- }
- if (isVariableLike(node) && node.initializer) {
- result = append(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags));
- }
- if (node.jsDocComments) {
- if (result) {
- result = append(result, getDocs(node.jsDocComments));
- }
- else {
- return getDocs(node.jsDocComments);
+ if (isVariableLike(node) && node.initializer) {
+ cache = ts.concatenate(cache, node.initializer.jsDoc);
}
+ cache = ts.concatenate(cache, node.jsDoc);
}
- return result;
}
- function getJSDocParameterTag(param, checkParentVariableStatement) {
+ function getJSDocParameterTags(param) {
+ if (!isParameter(param)) {
+ return undefined;
+ }
var func = param.parent;
- var tags = getJSDocTags(func, checkParentVariableStatement);
+ var tags = getJSDocTags(func, 281 /* JSDocParameterTag */);
if (!param.name) {
// this is an anonymous jsdoc param from a `function(type1, type2): type3` specification
var i = func.parameters.indexOf(param);
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */; });
+ var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; });
if (paramTags && 0 <= i && i < paramTags.length) {
return [paramTags[i]];
}
}
else if (param.name.kind === 70 /* Identifier */) {
var name_6 = param.name.text;
- var paramTags = ts.filter(tags, function (tag) { return tag.kind === 280 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
- if (paramTags) {
- return paramTags;
- }
+ return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; });
}
else {
// TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines
@@ -7818,40 +7833,30 @@ var ts;
return undefined;
}
}
- function getJSDocTypeTag(node) {
- return getJSDocTag(node, 282 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false);
+ ts.getJSDocParameterTags = getJSDocParameterTags;
+ function getJSDocType(node) {
+ var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */);
+ if (!tag && node.kind === 144 /* Parameter */) {
+ var paramTags = getJSDocParameterTags(node);
+ if (paramTags) {
+ tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; });
+ }
+ }
+ return tag && tag.typeExpression && tag.typeExpression.type;
+ }
+ ts.getJSDocType = getJSDocType;
+ function getJSDocAugmentsTag(node) {
+ return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */);
}
- ts.getJSDocTypeTag = getJSDocTypeTag;
+ ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
function getJSDocReturnTag(node) {
- return getJSDocTag(node, 281 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true);
+ return getFirstJSDocTag(node, 282 /* JSDocReturnTag */);
}
ts.getJSDocReturnTag = getJSDocReturnTag;
function getJSDocTemplateTag(node) {
- return getJSDocTag(node, 283 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false);
+ return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */);
}
ts.getJSDocTemplateTag = getJSDocTemplateTag;
- function getCorrespondingJSDocParameterTag(parameter) {
- if (parameter.name && parameter.name.kind === 70 /* Identifier */) {
- // If it's a parameter, see if the parent has a jsdoc comment with an @param
- // annotation.
- var parameterName = parameter.name.text;
- var jsDocTags = getJSDocTags(parameter.parent, /*checkParentVariableStatement*/ true);
- if (!jsDocTags) {
- return undefined;
- }
- for (var _i = 0, jsDocTags_2 = jsDocTags; _i < jsDocTags_2.length; _i++) {
- var tag = jsDocTags_2[_i];
- if (tag.kind === 280 /* JSDocParameterTag */) {
- var parameterTag = tag;
- if (parameterTag.parameterName.text === parameterName) {
- return parameterTag;
- }
- }
- }
- }
- return undefined;
- }
- ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag;
function hasRestParameter(s) {
return isRestParameter(ts.lastOrUndefined(s.parameters));
}
@@ -7862,13 +7867,10 @@ var ts;
ts.hasDeclaredRestParameter = hasDeclaredRestParameter;
function isRestParameter(node) {
if (node && (node.flags & 2097152 /* JavaScriptFile */)) {
- if (node.type && node.type.kind === 275 /* JSDocVariadicType */) {
+ if (node.type && node.type.kind === 275 /* JSDocVariadicType */ ||
+ ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) {
return true;
}
- var paramTag = getCorrespondingJSDocParameterTag(node);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 275 /* JSDocVariadicType */;
- }
}
return isDeclaredRestParam(node);
}
@@ -8115,8 +8117,10 @@ var ts;
return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node);
}
ts.isAsyncFunctionLike = isAsyncFunctionLike;
- function isStringOrNumericLiteral(kind) {
- return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */;
+ function isStringOrNumericLiteral(node) {
+ var kind = node.kind;
+ return kind === 9 /* StringLiteral */
+ || kind === 8 /* NumericLiteral */;
}
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
/**
@@ -8132,7 +8136,7 @@ var ts;
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
return name.kind === 142 /* ComputedPropertyName */ &&
- !isStringOrNumericLiteral(name.expression.kind) &&
+ !isStringOrNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
ts.isDynamicName = isDynamicName;
@@ -8356,6 +8360,7 @@ var ts;
case 194 /* TemplateExpression */:
case 183 /* ParenthesizedExpression */:
case 198 /* OmittedExpression */:
+ case 297 /* RawExpression */:
return 19;
case 181 /* TaggedTemplateExpression */:
case 177 /* PropertyAccessExpression */:
@@ -9226,19 +9231,19 @@ var ts;
}
}
ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
- function isAssignmentExpression(node) {
+ function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node)
- && isAssignmentOperator(node.operatorToken.kind)
+ && (excludeCompoundAssignment
+ ? node.operatorToken.kind === 57 /* EqualsToken */
+ : isAssignmentOperator(node.operatorToken.kind))
&& isLeftHandSideExpression(node.left);
}
ts.isAssignmentExpression = isAssignmentExpression;
function isDestructuringAssignment(node) {
- if (isBinaryExpression(node)) {
- if (node.operatorToken.kind === 57 /* EqualsToken */) {
- var kind = node.left.kind;
- return kind === 176 /* ObjectLiteralExpression */
- || kind === 175 /* ArrayLiteralExpression */;
- }
+ if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
+ var kind = node.left.kind;
+ return kind === 176 /* ObjectLiteralExpression */
+ || kind === 175 /* ArrayLiteralExpression */;
}
return false;
}
@@ -9632,135 +9637,6 @@ var ts;
return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos);
}
ts.getStartPositionOfRange = getStartPositionOfRange;
- function collectExternalModuleInfo(sourceFile, resolver) {
- var externalImports = [];
- var exportSpecifiers = ts.createMap();
- var exportedBindings = ts.createMap();
- var uniqueExports = ts.createMap();
- var hasExportDefault = false;
- var exportEquals = undefined;
- var hasExportStarsToExportValues = false;
- for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
- var node = _a[_i];
- switch (node.kind) {
- case 235 /* ImportDeclaration */:
- // import "mod"
- // import x from "mod"
- // import * as x from "mod"
- // import { x, y } from "mod"
- externalImports.push(node);
- break;
- case 234 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {
- // import x = require("mod")
- externalImports.push(node);
- }
- break;
- case 241 /* ExportDeclaration */:
- if (node.moduleSpecifier) {
- if (!node.exportClause) {
- // export * from "mod"
- externalImports.push(node);
- hasExportStarsToExportValues = true;
- }
- else {
- // export { x, y } from "mod"
- externalImports.push(node);
- }
- }
- else {
- // export { x, y }
- for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
- var specifier = _c[_b];
- if (!uniqueExports[specifier.name.text]) {
- var name_8 = specifier.propertyName || specifier.name;
- ts.multiMapAdd(exportSpecifiers, name_8.text, specifier);
- var decl = resolver.getReferencedImportDeclaration(name_8)
- || resolver.getReferencedValueDeclaration(name_8);
- if (decl) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
- }
- uniqueExports[specifier.name.text] = specifier.name;
- }
- }
- }
- break;
- case 240 /* ExportAssignment */:
- if (node.isExportEquals && !exportEquals) {
- // export = x
- exportEquals = node;
- }
- break;
- case 205 /* VariableStatement */:
- if (hasModifier(node, 1 /* Export */)) {
- for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
- var decl = _e[_d];
- collectExportedVariableInfo(decl, uniqueExports);
- }
- }
- break;
- case 225 /* FunctionDeclaration */:
- if (hasModifier(node, 1 /* Export */)) {
- if (hasModifier(node, 512 /* Default */)) {
- // export default function() { }
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- // export function x() { }
- var name_9 = node.name;
- if (!uniqueExports[name_9.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_9);
- uniqueExports[name_9.text] = name_9;
- }
- }
- }
- break;
- case 226 /* ClassDeclaration */:
- if (hasModifier(node, 1 /* Export */)) {
- if (hasModifier(node, 512 /* Default */)) {
- // export default class { }
- if (!hasExportDefault) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node));
- hasExportDefault = true;
- }
- }
- else {
- // export class x { }
- var name_10 = node.name;
- if (!uniqueExports[name_10.text]) {
- ts.multiMapAdd(exportedBindings, getOriginalNodeId(node), name_10);
- uniqueExports[name_10.text] = name_10;
- }
- }
- }
- break;
- }
- }
- var exportedNames;
- for (var key in uniqueExports) {
- exportedNames = ts.append(exportedNames, uniqueExports[key]);
- }
- return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames };
- }
- ts.collectExternalModuleInfo = collectExternalModuleInfo;
- function collectExportedVariableInfo(decl, uniqueExports) {
- if (isBindingPattern(decl.name)) {
- for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
- var element = _a[_i];
- if (!isOmittedExpression(element)) {
- collectExportedVariableInfo(element, uniqueExports);
- }
- }
- }
- else if (!isGeneratedIdentifier(decl.name)) {
- if (!uniqueExports[decl.name.text]) {
- uniqueExports[decl.name.text] = decl.name;
- }
- }
- }
/**
* Determines whether a name was originally the declaration name of an enum or namespace
* declaration.
@@ -9964,6 +9840,14 @@ var ts;
}
ts.isTypeNode = isTypeNode;
// Binding patterns
+ function isArrayBindingPattern(node) {
+ return node.kind === 173 /* ArrayBindingPattern */;
+ }
+ ts.isArrayBindingPattern = isArrayBindingPattern;
+ function isObjectBindingPattern(node) {
+ return node.kind === 172 /* ObjectBindingPattern */;
+ }
+ ts.isObjectBindingPattern = isObjectBindingPattern;
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
@@ -9973,6 +9857,12 @@ var ts;
return false;
}
ts.isBindingPattern = isBindingPattern;
+ function isAssignmentPattern(node) {
+ var kind = node.kind;
+ return kind === 175 /* ArrayLiteralExpression */
+ || kind === 176 /* ObjectLiteralExpression */;
+ }
+ ts.isAssignmentPattern = isAssignmentPattern;
function isBindingElement(node) {
return node.kind === 174 /* BindingElement */;
}
@@ -9983,6 +9873,51 @@ var ts;
|| kind === 198 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
+ /**
+ * Determines whether the BindingOrAssignmentElement is a BindingElement-like declaration
+ */
+ function isDeclarationBindingElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 223 /* VariableDeclaration */:
+ case 144 /* Parameter */:
+ case 174 /* BindingElement */:
+ return true;
+ }
+ return false;
+ }
+ ts.isDeclarationBindingElement = isDeclarationBindingElement;
+ /**
+ * Determines whether a node is a BindingOrAssignmentPattern
+ */
+ function isBindingOrAssignmentPattern(node) {
+ return isObjectBindingOrAssignmentPattern(node)
+ || isArrayBindingOrAssignmentPattern(node);
+ }
+ ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
+ /**
+ * Determines whether a node is an ObjectBindingOrAssignmentPattern
+ */
+ function isObjectBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 172 /* ObjectBindingPattern */:
+ case 176 /* ObjectLiteralExpression */:
+ return true;
+ }
+ return false;
+ }
+ ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
+ /**
+ * Determines whether a node is an ArrayBindingOrAssignmentPattern
+ */
+ function isArrayBindingOrAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ return true;
+ }
+ return false;
+ }
+ ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
// Expression
function isArrayLiteralExpression(node) {
return node.kind === 175 /* ArrayLiteralExpression */;
@@ -10050,7 +9985,8 @@ var ts;
|| kind === 98 /* ThisKeyword */
|| kind === 100 /* TrueKeyword */
|| kind === 96 /* SuperKeyword */
- || kind === 201 /* NonNullExpression */;
+ || kind === 201 /* NonNullExpression */
+ || kind === 297 /* RawExpression */;
}
function isLeftHandSideExpression(node) {
return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind);
@@ -10078,6 +10014,7 @@ var ts;
|| kind === 196 /* SpreadElement */
|| kind === 200 /* AsExpression */
|| kind === 198 /* OmittedExpression */
+ || kind === 297 /* RawExpression */
|| isUnaryExpressionKind(kind);
}
function isExpression(node) {
@@ -10091,11 +10028,11 @@ var ts;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 293 /* PartiallyEmittedExpression */;
+ return node.kind === 294 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 292 /* NotEmittedStatement */;
+ return node.kind === 293 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -10209,7 +10146,7 @@ var ts;
|| kind === 228 /* TypeAliasDeclaration */
|| kind === 143 /* TypeParameter */
|| kind === 223 /* VariableDeclaration */
- || kind === 284 /* JSDocTypedefTag */;
+ || kind === 285 /* JSDocTypedefTag */;
}
function isDeclarationStatementKind(kind) {
return kind === 225 /* FunctionDeclaration */
@@ -10244,9 +10181,9 @@ var ts;
|| kind === 205 /* VariableStatement */
|| kind === 210 /* WhileStatement */
|| kind === 217 /* WithStatement */
- || kind === 292 /* NotEmittedStatement */
- || kind === 295 /* EndOfDeclarationMarker */
- || kind === 294 /* MergeDeclarationMarker */;
+ || kind === 293 /* NotEmittedStatement */
+ || kind === 296 /* EndOfDeclarationMarker */
+ || kind === 295 /* MergeDeclarationMarker */;
}
function isDeclaration(node) {
return isDeclarationKind(node.kind);
@@ -10641,6 +10578,60 @@ var ts;
return flags;
}
ts.getCombinedNodeFlags = getCombinedNodeFlags;
+ /**
+ * Checks to see if the locale is in the appropriate format,
+ * and if it is, attempts to set the appropriate language.
+ */
+ function validateLocaleAndSetLanguage(locale, sys, errors) {
+ var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase());
+ if (!matchResult) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
+ }
+ return;
+ }
+ var language = matchResult[1];
+ var territory = matchResult[3];
+ // First try the entire locale, then fall back to just language if that's all we have.
+ // Either ways do not fail, and fallback to the English diagnostic strings.
+ if (!trySetLanguageAndTerritory(language, territory, errors)) {
+ trySetLanguageAndTerritory(language, /*territory*/ undefined, errors);
+ }
+ function trySetLanguageAndTerritory(language, territory, errors) {
+ var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
+ var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
+ var filePath = ts.combinePaths(containingDirectoryPath, language);
+ if (territory) {
+ filePath = filePath + "-" + territory;
+ }
+ filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
+ if (!sys.fileExists(filePath)) {
+ return false;
+ }
+ // TODO: Add codePage support for readFile?
+ var fileContents = "";
+ try {
+ fileContents = sys.readFile(filePath);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
+ }
+ return false;
+ }
+ try {
+ ts.localizedDiagnosticMessages = JSON.parse(fileContents);
+ }
+ catch (e) {
+ if (errors) {
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
})(ts || (ts = {}));
/// <reference path="core.ts"/>
/// <reference path="utilities.ts"/>
@@ -10858,9 +10849,9 @@ var ts;
return node;
}
ts.createParameter = createParameter;
- function updateParameter(node, decorators, modifiers, name, type, initializer) {
- if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) {
- return updateNode(createParameter(decorators, modifiers, node.dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
+ function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) {
+ if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) {
+ return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node);
}
return node;
}
@@ -10995,9 +10986,9 @@ var ts;
return node;
}
ts.createBindingElement = createBindingElement;
- function updateBindingElement(node, propertyName, name, initializer) {
- if (node.propertyName !== propertyName || node.name !== name || node.initializer !== initializer) {
- return updateNode(createBindingElement(propertyName, node.dotDotDotToken, name, initializer, node), node);
+ function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
+ if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) {
+ return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node);
}
return node;
}
@@ -11038,7 +11029,7 @@ var ts;
function createPropertyAccess(expression, name, location, flags) {
var node = createNode(177 /* PropertyAccessExpression */, location, flags);
node.expression = parenthesizeForAccess(expression);
- (node.emitNode || (node.emitNode = {})).flags |= 1048576 /* NoIndentation */;
+ (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */;
node.name = typeof name === "string" ? createIdentifier(name) : name;
return node;
}
@@ -11260,13 +11251,23 @@ var ts;
return node;
}
ts.updateBinary = updateBinary;
- function createConditional(condition, questionToken, whenTrue, colonToken, whenFalse, location) {
- var node = createNode(193 /* ConditionalExpression */, location);
- node.condition = condition;
- node.questionToken = questionToken;
- node.whenTrue = whenTrue;
- node.colonToken = colonToken;
- node.whenFalse = whenFalse;
+ function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) {
+ var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation);
+ node.condition = parenthesizeForConditionalHead(condition);
+ if (whenFalse) {
+ // second overload
+ node.questionToken = questionTokenOrWhenTrue;
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ node.colonToken = colonTokenOrLocation;
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse);
+ }
+ else {
+ // first overload
+ node.questionToken = createToken(54 /* QuestionToken */);
+ node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue);
+ node.colonToken = createToken(55 /* ColonToken */);
+ node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse);
+ }
return node;
}
ts.createConditional = createConditional;
@@ -12082,8 +12083,6 @@ var ts;
updated.imports = node.imports;
if (node.moduleAugmentations !== undefined)
updated.moduleAugmentations = node.moduleAugmentations;
- if (node.externalHelpersModuleName !== undefined)
- updated.externalHelpersModuleName = node.externalHelpersModuleName;
return updateNode(updated, node);
}
return node;
@@ -12097,7 +12096,7 @@ var ts;
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createNode(292 /* NotEmittedStatement */, /*location*/ original);
+ var node = createNode(293 /* NotEmittedStatement */, /*location*/ original);
node.original = original;
return node;
}
@@ -12107,7 +12106,7 @@ var ts;
* order to properly emit exports.
*/
function createEndOfDeclarationMarker(original) {
- var node = createNode(295 /* EndOfDeclarationMarker */);
+ var node = createNode(296 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -12118,7 +12117,7 @@ var ts;
* order to properly emit exports.
*/
function createMergeDeclarationMarker(original) {
- var node = createNode(294 /* MergeDeclarationMarker */);
+ var node = createNode(295 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -12133,7 +12132,7 @@ var ts;
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original, location) {
- var node = createNode(293 /* PartiallyEmittedExpression */, /*location*/ location || original);
+ var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original);
node.expression = expression;
node.original = original;
return node;
@@ -12146,6 +12145,19 @@ var ts;
return node;
}
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
+ /**
+ * Creates a node that emits a string of raw text in an expression position. Raw text is never
+ * transformed, should be ES3 compliant, and should have the same precedence as
+ * PrimaryExpression.
+ *
+ * @param text The raw text of the node.
+ */
+ function createRawExpression(text) {
+ var node = createNode(297 /* RawExpression */);
+ node.text = text;
+ return node;
+ }
+ ts.createRawExpression = createRawExpression;
// Compound nodes
function createComma(left, right) {
return createBinary(left, 25 /* CommaToken */, right);
@@ -12195,13 +12207,19 @@ var ts;
return createVoid(createLiteral(0));
}
ts.createVoidZero = createVoidZero;
+ function createTypeCheck(value, tag) {
+ return tag === "undefined"
+ ? createStrictEquality(value, createVoidZero())
+ : createStrictEquality(createTypeOf(value), createLiteral(tag));
+ }
+ ts.createTypeCheck = createTypeCheck;
function createMemberAccessForPropertyName(target, memberName, location) {
if (ts.isComputedPropertyName(memberName)) {
return createElementAccess(target, memberName.expression, location);
}
else {
var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location);
- (expression.emitNode || (expression.emitNode = {})).flags |= 2048 /* NoNestedSourceMaps */;
+ (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */;
return expression;
}
}
@@ -12245,14 +12263,17 @@ var ts;
// flag and setting a parent node.
var react = createIdentifier(reactNamespace || "React");
react.flags &= ~8 /* Synthesized */;
- // Set the parent that is in parse tree
+ // Set the parent that is in parse tree
// this makes sure that parent chain is intact for checker to traverse complete scope tree
react.parent = ts.getParseTreeNode(parent);
return react;
}
function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) {
if (ts.isQualifiedName(jsxFactory)) {
- return createPropertyAccess(createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent), setEmitFlags(getMutableClone(jsxFactory.right), 1536 /* NoSourceMap */));
+ var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent);
+ var right = createSynthesizedNode(70 /* Identifier */);
+ right.text = jsxFactory.right.text;
+ return createPropertyAccess(left, right);
}
else {
return createReactNamespace(jsxFactory.text, parent);
@@ -12308,170 +12329,10 @@ var ts;
}
ts.createConstDeclarationList = createConstDeclarationList;
// Helpers
- function createHelperName(externalHelpersModuleName, name) {
- return externalHelpersModuleName
- ? createPropertyAccess(externalHelpersModuleName, name)
- : createIdentifier(name);
- }
- ts.createHelperName = createHelperName;
- function createExtendsHelper(externalHelpersModuleName, name) {
- return createCall(createHelperName(externalHelpersModuleName, "__extends"),
- /*typeArguments*/ undefined, [
- name,
- createIdentifier("_super")
- ]);
- }
- ts.createExtendsHelper = createExtendsHelper;
- function createAssignHelper(externalHelpersModuleName, attributesSegments) {
- return createCall(createHelperName(externalHelpersModuleName, "__assign"),
- /*typeArguments*/ undefined, attributesSegments);
- }
- ts.createAssignHelper = createAssignHelper;
- function createParamHelper(externalHelpersModuleName, expression, parameterOffset, location) {
- return createCall(createHelperName(externalHelpersModuleName, "__param"),
- /*typeArguments*/ undefined, [
- createLiteral(parameterOffset),
- expression
- ], location);
- }
- ts.createParamHelper = createParamHelper;
- function createMetadataHelper(externalHelpersModuleName, metadataKey, metadataValue) {
- return createCall(createHelperName(externalHelpersModuleName, "__metadata"),
- /*typeArguments*/ undefined, [
- createLiteral(metadataKey),
- metadataValue
- ]);
- }
- ts.createMetadataHelper = createMetadataHelper;
- function createDecorateHelper(externalHelpersModuleName, decoratorExpressions, target, memberName, descriptor, location) {
- var argumentsArray = [];
- argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
- argumentsArray.push(target);
- if (memberName) {
- argumentsArray.push(memberName);
- if (descriptor) {
- argumentsArray.push(descriptor);
- }
- }
- return createCall(createHelperName(externalHelpersModuleName, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
- }
- ts.createDecorateHelper = createDecorateHelper;
- function createAwaiterHelper(externalHelpersModuleName, hasLexicalArguments, promiseConstructor, body) {
- var generatorFunc = createFunctionExpression(
- /*modifiers*/ undefined, createToken(38 /* AsteriskToken */),
- /*name*/ undefined,
- /*typeParameters*/ undefined,
- /*parameters*/ [],
- /*type*/ undefined, body);
- // Mark this node as originally an async function
- (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 2097152 /* AsyncFunctionBody */;
- return createCall(createHelperName(externalHelpersModuleName, "__awaiter"),
- /*typeArguments*/ undefined, [
- createThis(),
- hasLexicalArguments ? createIdentifier("arguments") : createVoidZero(),
- promiseConstructor ? createExpressionFromEntityName(promiseConstructor) : createVoidZero(),
- generatorFunc
- ]);
+ function getHelperName(name) {
+ return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */);
}
- ts.createAwaiterHelper = createAwaiterHelper;
- function createHasOwnProperty(target, propertyName) {
- return createCall(createPropertyAccess(target, "hasOwnProperty"),
- /*typeArguments*/ undefined, [propertyName]);
- }
- ts.createHasOwnProperty = createHasOwnProperty;
- function createObjectCreate(prototype) {
- return createCall(createPropertyAccess(createIdentifier("Object"), "create"),
- /*typeArguments*/ undefined, [prototype]);
- }
- function createGeti(target) {
- // name => super[name]
- return createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createElementAccess(target, createIdentifier("name")));
- }
- function createSeti(target) {
- // (name, value) => super[name] = value
- return createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name"),
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "value")
- ],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createAssignment(createElementAccess(target, createIdentifier("name")), createIdentifier("value")));
- }
- function createAdvancedAsyncSuperHelper() {
- // const _super = (function (geti, seti) {
- // const cache = Object.create(null);
- // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
- // })(name => super[name], (name, value) => super[name] = value);
- // const cache = Object.create(null);
- var createCache = createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("cache",
- /*type*/ undefined, createObjectCreate(createNull()))
- ]));
- // get value() { return geti(name); }
- var getter = createGetAccessor(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, "value",
- /*parameters*/ [],
- /*type*/ undefined, createBlock([
- createReturn(createCall(createIdentifier("geti"),
- /*typeArguments*/ undefined, [createIdentifier("name")]))
- ]));
- // set value(v) { seti(name, v); }
- var setter = createSetAccessor(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, "value", [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "v")], createBlock([
- createStatement(createCall(createIdentifier("seti"),
- /*typeArguments*/ undefined, [
- createIdentifier("name"),
- createIdentifier("v")
- ]))
- ]));
- // return name => cache[name] || ...
- var getOrCreateAccessorsForName = createReturn(createArrowFunction(
- /*modifiers*/ undefined,
- /*typeParameters*/ undefined, [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "name")],
- /*type*/ undefined, createToken(35 /* EqualsGreaterThanToken */), createLogicalOr(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createParen(createAssignment(createElementAccess(createIdentifier("cache"), createIdentifier("name")), createObjectLiteral([
- getter,
- setter
- ]))))));
- // const _super = (function (geti, seti) {
- // const cache = Object.create(null);
- // return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
- // })(name => super[name], (name, value) => super[name] = value);
- return createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("_super",
- /*type*/ undefined, createCall(createParen(createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "geti"),
- createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "seti")
- ],
- /*type*/ undefined, createBlock([
- createCache,
- getOrCreateAccessorsForName
- ]))),
- /*typeArguments*/ undefined, [
- createGeti(createSuper()),
- createSeti(createSuper())
- ]))
- ]));
- }
- ts.createAdvancedAsyncSuperHelper = createAdvancedAsyncSuperHelper;
- function createSimpleAsyncSuperHelper() {
- return createVariableStatement(
- /*modifiers*/ undefined, createConstDeclarationList([
- createVariableDeclaration("_super",
- /*type*/ undefined, createGeti(createSuper()))
- ]));
- }
- ts.createSimpleAsyncSuperHelper = createSimpleAsyncSuperHelper;
+ ts.getHelperName = getHelperName;
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = skipParentheses(node);
switch (target.kind) {
@@ -12657,14 +12518,14 @@ var ts;
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
*/
function getLocalName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 262144 /* LocalName */);
+ return getName(node, allowComments, allowSourceMaps, 16384 /* LocalName */);
}
ts.getLocalName = getLocalName;
/**
* Gets whether an identifier should only be referred to by its local name.
*/
function isLocalName(node) {
- return (getEmitFlags(node) & 262144 /* LocalName */) !== 0;
+ return (getEmitFlags(node) & 16384 /* LocalName */) !== 0;
}
ts.isLocalName = isLocalName;
/**
@@ -12678,7 +12539,7 @@ var ts;
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
*/
function getExportName(node, allowComments, allowSourceMaps) {
- return getName(node, allowComments, allowSourceMaps, 131072 /* ExportName */);
+ return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */);
}
ts.getExportName = getExportName;
/**
@@ -12686,7 +12547,7 @@ var ts;
* name points to an exported symbol.
*/
function isExportName(node) {
- return (getEmitFlags(node) & 131072 /* ExportName */) !== 0;
+ return (getEmitFlags(node) & 8192 /* ExportName */) !== 0;
}
ts.isExportName = isExportName;
/**
@@ -12702,15 +12563,15 @@ var ts;
ts.getDeclarationName = getDeclarationName;
function getName(node, allowComments, allowSourceMaps, emitFlags) {
if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) {
- var name_11 = getMutableClone(node.name);
+ var name_8 = getMutableClone(node.name);
emitFlags |= getEmitFlags(node.name);
if (!allowSourceMaps)
- emitFlags |= 1536 /* NoSourceMap */;
+ emitFlags |= 48 /* NoSourceMap */;
if (!allowComments)
- emitFlags |= 49152 /* NoComments */;
+ emitFlags |= 1536 /* NoComments */;
if (emitFlags)
- setEmitFlags(name_11, emitFlags);
- return name_11;
+ setEmitFlags(name_8, emitFlags);
+ return name_8;
}
return getGeneratedNameForNode(node);
}
@@ -12744,15 +12605,18 @@ var ts;
var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name);
var emitFlags;
if (!allowSourceMaps)
- emitFlags |= 1536 /* NoSourceMap */;
+ emitFlags |= 48 /* NoSourceMap */;
if (!allowComments)
- emitFlags |= 49152 /* NoComments */;
+ emitFlags |= 1536 /* NoComments */;
if (emitFlags)
setEmitFlags(qualifiedName, emitFlags);
return qualifiedName;
}
ts.getNamespaceMemberName = getNamespaceMemberName;
- // Utilities
+ function convertToFunctionBody(node, multiLine) {
+ return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine);
+ }
+ ts.convertToFunctionBody = convertToFunctionBody;
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
}
@@ -12790,7 +12654,7 @@ var ts;
}
while (statementOffset < numStatements) {
var statement = source[statementOffset];
- if (getEmitFlags(statement) & 8388608 /* CustomPrologue */) {
+ if (getEmitFlags(statement) & 524288 /* CustomPrologue */) {
target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
}
else {
@@ -12801,15 +12665,22 @@ var ts;
return statementOffset;
}
ts.addPrologueDirectives = addPrologueDirectives;
+ function startsWithUseStrict(statements) {
+ var firstStatement = ts.firstOrUndefined(statements);
+ return firstStatement !== undefined
+ && ts.isPrologueDirective(firstStatement)
+ && isUseStrictPrologue(firstStatement);
+ }
+ ts.startsWithUseStrict = startsWithUseStrict;
/**
* Ensures "use strict" directive is added
*
- * @param node source file
+ * @param statements An array of statements
*/
- function ensureUseStrict(node) {
+ function ensureUseStrict(statements) {
var foundUseStrict = false;
- for (var _i = 0, _a = node.statements; _i < _a.length; _i++) {
- var statement = _a[_i];
+ for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
+ var statement = statements_1[_i];
if (ts.isPrologueDirective(statement)) {
if (isUseStrictPrologue(statement)) {
foundUseStrict = true;
@@ -12821,12 +12692,11 @@ var ts;
}
}
if (!foundUseStrict) {
- var statements = [];
- statements.push(startOnNewLine(createStatement(createLiteral("use strict"))));
- // add "use strict" as the first statement
- return updateSourceFileNode(node, statements.concat(node.statements));
+ return createNodeArray([
+ startOnNewLine(createStatement(createLiteral("use strict")))
+ ].concat(statements), statements);
}
- return node;
+ return statements;
}
ts.ensureUseStrict = ensureUseStrict;
/**
@@ -12987,6 +12857,24 @@ var ts;
}
return 0 /* Unknown */;
}
+ function parenthesizeForConditionalHead(condition) {
+ var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */);
+ var emittedCondition = skipPartiallyEmittedExpressions(condition);
+ var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
+ if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
+ return createParen(condition);
+ }
+ return condition;
+ }
+ ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead;
+ function parenthesizeSubexpressionOfConditionalExpression(e) {
+ // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions
+ // so in case when comma expression is introduced as a part of previous transformations
+ // if should be wrapped in parens since comma operator has the lowest precedence
+ return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */
+ ? createParen(e)
+ : e;
+ }
/**
* Wraps an expression in parentheses if it is needed in order to use the expression
* as the expression of a NewExpression node.
@@ -13118,7 +13006,7 @@ var ts;
case 177 /* PropertyAccessExpression */:
node = node.expression;
continue;
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -13173,7 +13061,7 @@ var ts;
}
ts.skipAssertions = skipAssertions;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 293 /* PartiallyEmittedExpression */) {
+ while (node.kind === 294 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
@@ -13195,8 +13083,8 @@ var ts;
}
ts.setOriginalNode = setOriginalNode;
function mergeEmitNode(sourceEmitNode, destEmitNode) {
- var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges;
- if (!destEmitNode && (flags || commentRange || sourceMapRange || tokenSourceMapRanges))
+ var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers;
+ if (!destEmitNode)
destEmitNode = {};
if (flags)
destEmitNode.flags = flags;
@@ -13206,6 +13094,10 @@ var ts;
destEmitNode.sourceMapRange = sourceMapRange;
if (tokenSourceMapRanges)
destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
+ if (constantValue !== undefined)
+ destEmitNode.constantValue = constantValue;
+ if (helpers)
+ destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers);
return destEmitNode;
}
function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
@@ -13258,6 +13150,7 @@ var ts;
}
return node.emitNode;
}
+ ts.getOrCreateEmitNode = getOrCreateEmitNode;
/**
* Gets flags that control emit behavior of a node.
*
@@ -13280,6 +13173,16 @@ var ts;
}
ts.setEmitFlags = setEmitFlags;
/**
+ * Gets a custom text range to use when emitting source maps.
+ *
+ * @param node The node.
+ */
+ function getSourceMapRange(node) {
+ var emitNode = node.emitNode;
+ return (emitNode && emitNode.sourceMapRange) || node;
+ }
+ ts.getSourceMapRange = getSourceMapRange;
+ /**
* Sets a custom text range to use when emitting source maps.
*
* @param node The node.
@@ -13291,6 +13194,18 @@ var ts;
}
ts.setSourceMapRange = setSourceMapRange;
/**
+ * Gets the TextRange to use for source maps for a token of a node.
+ *
+ * @param node The node.
+ * @param token The token.
+ */
+ function getTokenSourceMapRange(node, token) {
+ var emitNode = node.emitNode;
+ var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
+ return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ }
+ ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ /**
* Sets the TextRange to use for source maps for a token of a node.
*
* @param node The node.
@@ -13305,14 +13220,6 @@ var ts;
}
ts.setTokenSourceMapRange = setTokenSourceMapRange;
/**
- * Sets a custom text range to use when emitting comments.
- */
- function setCommentRange(node, range) {
- getOrCreateEmitNode(node).commentRange = range;
- return node;
- }
- ts.setCommentRange = setCommentRange;
- /**
* Gets a custom text range to use when emitting comments.
*
* @param node The node.
@@ -13323,27 +13230,13 @@ var ts;
}
ts.getCommentRange = getCommentRange;
/**
- * Gets a custom text range to use when emitting source maps.
- *
- * @param node The node.
- */
- function getSourceMapRange(node) {
- var emitNode = node.emitNode;
- return (emitNode && emitNode.sourceMapRange) || node;
- }
- ts.getSourceMapRange = getSourceMapRange;
- /**
- * Gets the TextRange to use for source maps for a token of a node.
- *
- * @param node The node.
- * @param token The token.
+ * Sets a custom text range to use when emitting comments.
*/
- function getTokenSourceMapRange(node, token) {
- var emitNode = node.emitNode;
- var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
- return tokenSourceMapRanges && tokenSourceMapRanges[token];
+ function setCommentRange(node, range) {
+ getOrCreateEmitNode(node).commentRange = range;
+ return node;
}
- ts.getTokenSourceMapRange = getTokenSourceMapRange;
+ ts.setCommentRange = setCommentRange;
/**
* Gets the constant value to emit for an expression.
*/
@@ -13361,6 +13254,118 @@ var ts;
return node;
}
ts.setConstantValue = setConstantValue;
+ function getExternalHelpersModuleName(node) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = parseNode && parseNode.emitNode;
+ return emitNode && emitNode.externalHelpersModuleName;
+ }
+ ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
+ function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions) {
+ if (compilerOptions.importHelpers && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
+ var externalHelpersModuleName = getExternalHelpersModuleName(node);
+ if (externalHelpersModuleName) {
+ return externalHelpersModuleName;
+ }
+ var helpers = getEmitHelpers(node);
+ if (helpers) {
+ for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
+ var helper = helpers_1[_i];
+ if (!helper.scoped) {
+ var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
+ var emitNode = getOrCreateEmitNode(parseNode);
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText));
+ }
+ }
+ }
+ }
+ }
+ ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
+ /**
+ * Adds an EmitHelper to a node.
+ */
+ function addEmitHelper(node, helper) {
+ var emitNode = getOrCreateEmitNode(node);
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ return node;
+ }
+ ts.addEmitHelper = addEmitHelper;
+ /**
+ * Adds an EmitHelper to a node.
+ */
+ function addEmitHelpers(node, helpers) {
+ if (ts.some(helpers)) {
+ var emitNode = getOrCreateEmitNode(node);
+ for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
+ var helper = helpers_2[_i];
+ if (!ts.contains(emitNode.helpers, helper)) {
+ emitNode.helpers = ts.append(emitNode.helpers, helper);
+ }
+ }
+ }
+ return node;
+ }
+ ts.addEmitHelpers = addEmitHelpers;
+ /**
+ * Removes an EmitHelper from a node.
+ */
+ function removeEmitHelper(node, helper) {
+ var emitNode = node.emitNode;
+ if (emitNode) {
+ var helpers = emitNode.helpers;
+ if (helpers) {
+ return ts.orderedRemoveItem(helpers, helper);
+ }
+ }
+ return false;
+ }
+ ts.removeEmitHelper = removeEmitHelper;
+ /**
+ * Gets the EmitHelpers of a node.
+ */
+ function getEmitHelpers(node) {
+ var emitNode = node.emitNode;
+ return emitNode && emitNode.helpers;
+ }
+ ts.getEmitHelpers = getEmitHelpers;
+ /**
+ * Moves matching emit helpers from a source node to a target node.
+ */
+ function moveEmitHelpers(source, target, predicate) {
+ var sourceEmitNode = source.emitNode;
+ var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
+ if (!ts.some(sourceEmitHelpers))
+ return;
+ var targetEmitNode = getOrCreateEmitNode(target);
+ var helpersRemoved = 0;
+ for (var i = 0; i < sourceEmitHelpers.length; i++) {
+ var helper = sourceEmitHelpers[i];
+ if (predicate(helper)) {
+ helpersRemoved++;
+ if (!ts.contains(targetEmitNode.helpers, helper)) {
+ targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper);
+ }
+ }
+ else if (helpersRemoved > 0) {
+ sourceEmitHelpers[i - helpersRemoved] = helper;
+ }
+ }
+ if (helpersRemoved > 0) {
+ sourceEmitHelpers.length -= helpersRemoved;
+ }
+ }
+ ts.moveEmitHelpers = moveEmitHelpers;
+ function compareEmitHelpers(x, y) {
+ if (x === y)
+ return 0 /* EqualTo */;
+ if (x.priority === y.priority)
+ return 0 /* EqualTo */;
+ if (x.priority === undefined)
+ return 1 /* GreaterThan */;
+ if (y.priority === undefined)
+ return -1 /* LessThan */;
+ return ts.compareValues(x.priority, y.priority);
+ }
+ ts.compareEmitHelpers = compareEmitHelpers;
function setTextRange(node, location) {
if (location) {
node.pos = location.pos;
@@ -13390,8 +13395,8 @@ var ts;
function getLocalNameForExternalImport(node, sourceFile) {
var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !ts.isDefaultImport(node)) {
- var name_12 = namespaceDeclaration.name;
- return ts.isGeneratedIdentifier(name_12) ? name_12 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
+ var name_9 = namespaceDeclaration.name;
+ return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
}
if (node.kind === 235 /* ImportDeclaration */ && node.importClause) {
return getGeneratedNameForNode(node);
@@ -13454,362 +13459,390 @@ var ts;
return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
}
/**
- * Transforms the body of a function-like node.
- *
- * @param node A function-like node.
+ * Gets the initializer of an BindingOrAssignmentElement.
*/
- function transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis, convertObjectRest) {
- var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
- var singleLine = false; // indicates whether the block *may* be emitted as a single line
- var statementsLocation;
- var closeBraceLocation;
- var statements = [];
- var body = node.body;
- var statementOffset;
- context.startLexicalEnvironment();
- if (ts.isBlock(body)) {
- // ensureUseStrict is false because no new prologue-directive should be added.
- // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
- statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
- }
- addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest);
- addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
- // If we added any generated statements, this must be a multi-line block.
- if (!multiLine && statements.length > 0) {
- multiLine = true;
- }
- if (ts.isBlock(body)) {
- statementsLocation = body.statements;
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
- // If the original body was a multi-line block, this must be a multi-line block.
- if (!multiLine && body.multiLine) {
- multiLine = true;
- }
- }
- else {
- ts.Debug.assert(node.kind === 185 /* ArrowFunction */);
- // To align with the old emitter, we use a synthetic end position on the location
- // for the statement list we synthesize when we down-level an arrow function with
- // an expression function body. This prevents both comments and source maps from
- // being emitted for the end position only.
- statementsLocation = ts.moveRangeEnd(body, -1);
- var equalsGreaterThanToken = node.equalsGreaterThanToken;
- if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
- if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
- singleLine = true;
- }
- else {
- multiLine = true;
- }
- }
- var expression = ts.visitNode(body, visitor, ts.isExpression);
- var returnStatement = createReturn(expression, /*location*/ body);
- setEmitFlags(returnStatement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 32768 /* NoTrailingComments */);
- statements.push(returnStatement);
- // To align with the source map emit for the old emitter, we set a custom
- // source map location for the close brace.
- closeBraceLocation = body;
+ function getInitializerOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ // `1` in `let { a = 1 } = ...`
+ // `1` in `let { a: b = 1 } = ...`
+ // `1` in `let { a: {b} = 1 } = ...`
+ // `1` in `let { a: [b] = 1 } = ...`
+ // `1` in `let [a = 1] = ...`
+ // `1` in `let [{a} = 1] = ...`
+ // `1` in `let [[a] = 1] = ...`
+ return bindingElement.initializer;
+ }
+ if (ts.isPropertyAssignment(bindingElement)) {
+ // `1` in `({ a: b = 1 } = ...)`
+ // `1` in `({ a: {b} = 1 } = ...)`
+ // `1` in `({ a: [b] = 1 } = ...)`
+ return ts.isAssignmentExpression(bindingElement.initializer, /*excludeCompoundAssignment*/ true)
+ ? bindingElement.initializer.right
+ : undefined;
}
- var lexicalEnvironment = context.endLexicalEnvironment();
- ts.addRange(statements, lexicalEnvironment);
- // If we added any final generated statements, this must be a multi-line block
- if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
- multiLine = true;
+ if (ts.isShorthandPropertyAssignment(bindingElement)) {
+ // `1` in `({ a = 1 } = ...)`
+ return bindingElement.objectAssignmentInitializer;
}
- var block = createBlock(createNodeArray(statements, statementsLocation), node.body, multiLine);
- if (!multiLine && singleLine) {
- setEmitFlags(block, 32 /* SingleLine */);
+ if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {
+ // `1` in `[a = 1] = ...`
+ // `1` in `[{a} = 1] = ...`
+ // `1` in `[[a] = 1] = ...`
+ return bindingElement.right;
}
- if (closeBraceLocation) {
- setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
+ if (ts.isSpreadExpression(bindingElement)) {
+ // Recovery consistent with existing emit.
+ return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
}
- setOriginalNode(block, node.body);
- return block;
}
- ts.transformFunctionBody = transformFunctionBody;
+ ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
/**
- * Adds a statement to capture the `this` of a function declaration if it is needed.
- *
- * @param statements The statements for the new function body.
- * @param node A node.
+ * Gets the name of an BindingOrAssignmentElement.
*/
- function addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis) {
- if (node.transformFlags & 524288 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) {
- captureThisForNode(statements, node, createThis(), enableSubstitutionsForCapturedThis);
- }
- }
- ts.addCaptureThisForNodeIfNeeded = addCaptureThisForNodeIfNeeded;
- function captureThisForNode(statements, node, initializer, enableSubstitutionsForCapturedThis, originalStatement) {
- enableSubstitutionsForCapturedThis();
- var captureThisStatement = createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList([
- createVariableDeclaration("_this",
- /*type*/ undefined, initializer)
- ]), originalStatement);
- setEmitFlags(captureThisStatement, 49152 /* NoComments */ | 8388608 /* CustomPrologue */);
- setSourceMapRange(captureThisStatement, node);
- statements.push(captureThisStatement);
- }
- ts.captureThisForNode = captureThisForNode;
+ function getTargetOfBindingOrAssignmentElement(bindingElement) {
+ if (ts.isDeclarationBindingElement(bindingElement)) {
+ // `a` in `let { a } = ...`
+ // `a` in `let { a = 1 } = ...`
+ // `b` in `let { a: b } = ...`
+ // `b` in `let { a: b = 1 } = ...`
+ // `a` in `let { ...a } = ...`
+ // `{b}` in `let { a: {b} } = ...`
+ // `{b}` in `let { a: {b} = 1 } = ...`
+ // `[b]` in `let { a: [b] } = ...`
+ // `[b]` in `let { a: [b] = 1 } = ...`
+ // `a` in `let [a] = ...`
+ // `a` in `let [a = 1] = ...`
+ // `a` in `let [...a] = ...`
+ // `{a}` in `let [{a}] = ...`
+ // `{a}` in `let [{a} = 1] = ...`
+ // `[a]` in `let [[a]] = ...`
+ // `[a]` in `let [[a] = 1] = ...`
+ return bindingElement.name;
+ }
+ if (ts.isObjectLiteralElementLike(bindingElement)) {
+ switch (bindingElement.kind) {
+ case 257 /* PropertyAssignment */:
+ // `b` in `({ a: b } = ...)`
+ // `b` in `({ a: b = 1 } = ...)`
+ // `{b}` in `({ a: {b} } = ...)`
+ // `{b}` in `({ a: {b} = 1 } = ...)`
+ // `[b]` in `({ a: [b] } = ...)`
+ // `[b]` in `({ a: [b] = 1 } = ...)`
+ // `b.c` in `({ a: b.c } = ...)`
+ // `b.c` in `({ a: b.c = 1 } = ...)`
+ // `b[0]` in `({ a: b[0] } = ...)`
+ // `b[0]` in `({ a: b[0] = 1 } = ...)`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
+ case 258 /* ShorthandPropertyAssignment */:
+ // `a` in `({ a } = ...)`
+ // `a` in `({ a = 1 } = ...)`
+ return bindingElement.name;
+ case 259 /* SpreadAssignment */:
+ // `a` in `({ ...a } = ...)`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ // no target
+ return undefined;
+ }
+ if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) {
+ // `a` in `[a = 1] = ...`
+ // `{a}` in `[{a} = 1] = ...`
+ // `[a]` in `[[a] = 1] = ...`
+ // `a.b` in `[a.b = 1] = ...`
+ // `a[0]` in `[a[0] = 1] = ...`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.left);
+ }
+ if (ts.isSpreadExpression(bindingElement)) {
+ // `a` in `[...a] = ...`
+ return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
+ }
+ // `a` in `[a] = ...`
+ // `{a}` in `[{a}] = ...`
+ // `[a]` in `[[a]] = ...`
+ // `a.b` in `[a.b] = ...`
+ // `a[0]` in `[a[0]] = ...`
+ return bindingElement;
+ }
+ ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
/**
- * Gets a value indicating whether we need to add default value assignments for a
- * function-like node.
- *
- * @param node A function-like node.
+ * Determines whether an BindingOrAssignmentElement is a rest element.
*/
- function shouldAddDefaultValueAssignments(node) {
- return (node.transformFlags & 2097152 /* ContainsDefaultValueAssignments */) !== 0;
+ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 144 /* Parameter */:
+ case 174 /* BindingElement */:
+ // `...` in `let [...a] = ...`
+ return bindingElement.dotDotDotToken;
+ case 196 /* SpreadElement */:
+ case 259 /* SpreadAssignment */:
+ // `...` in `[...a] = ...`
+ return bindingElement;
+ }
+ return undefined;
}
+ ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
/**
- * Adds statements to the body of a function-like node if it contains parameters with
- * binding patterns or initializers.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
+ * Gets the property name of a BindingOrAssignmentElement
*/
- function addDefaultValueAssignmentsIfNeeded(statements, node, visitor, convertObjectRest) {
- if (!shouldAddDefaultValueAssignments(node)) {
- return;
+ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
+ switch (bindingElement.kind) {
+ case 174 /* BindingElement */:
+ // `a` in `let { a: b } = ...`
+ // `[a]` in `let { [a]: b } = ...`
+ // `"a"` in `let { "a": b } = ...`
+ // `1` in `let { 1: b } = ...`
+ if (bindingElement.propertyName) {
+ var propertyName = bindingElement.propertyName;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 257 /* PropertyAssignment */:
+ // `a` in `({ a: b } = ...)`
+ // `[a]` in `({ [a]: b } = ...)`
+ // `"a"` in `({ "a": b } = ...)`
+ // `1` in `({ 1: b } = ...)`
+ if (bindingElement.name) {
+ var propertyName = bindingElement.name;
+ return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression)
+ ? propertyName.expression
+ : propertyName;
+ }
+ break;
+ case 259 /* SpreadAssignment */:
+ // `a` in `({ ...a } = ...)`
+ return bindingElement.name;
}
- for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
- var parameter = _a[_i];
- var name_13 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
- // A rest parameter cannot have a binding pattern or an initializer,
- // so let's just ignore it.
- if (dotDotDotToken) {
- continue;
- }
- if (ts.isBindingPattern(name_13)) {
- addDefaultValueAssignmentForBindingPattern(statements, parameter, name_13, initializer, visitor, convertObjectRest);
- }
- else if (initializer) {
- addDefaultValueAssignmentForInitializer(statements, parameter, name_13, initializer, visitor);
- }
+ var target = getTargetOfBindingOrAssignmentElement(bindingElement);
+ if (target && ts.isPropertyName(target)) {
+ return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression)
+ ? target.expression
+ : target;
}
+ ts.Debug.fail("Invalid property name for binding element.");
}
- ts.addDefaultValueAssignmentsIfNeeded = addDefaultValueAssignmentsIfNeeded;
+ ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
/**
- * Adds statements to the body of a function-like node for parameters with binding patterns
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
+ * Gets the elements of a BindingOrAssignmentPattern
*/
- function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer, visitor, convertObjectRest) {
- var temp = getGeneratedNameForNode(parameter);
- // In cases where a binding pattern is simply '[]' or '{}',
- // we usually don't want to emit a var declaration; however, in the presence
- // of an initializer, we must emit that expression to preserve side effects.
- if (name.elements.length > 0) {
- statements.push(setEmitFlags(createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList(ts.flattenParameterDestructuring(parameter, temp, visitor, convertObjectRest))), 8388608 /* CustomPrologue */));
+ function getElementsOfBindingOrAssignmentPattern(name) {
+ switch (name.kind) {
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ // `a` in `{a}`
+ // `a` in `[a]`
+ return name.elements;
+ case 176 /* ObjectLiteralExpression */:
+ // `a` in `{a}`
+ return name.properties;
}
- else if (initializer) {
- statements.push(setEmitFlags(createStatement(createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 8388608 /* CustomPrologue */));
+ }
+ ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
+ function convertToArrayAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpread(element.name, element), element);
+ }
+ var expression = convertToAssignmentElementTarget(element.name);
+ return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression;
}
+ ts.Debug.assertNode(element, ts.isExpression);
+ return element;
}
- /**
- * Adds statements to the body of a function-like node for parameters with initializers.
- *
- * @param statements The statements for the new function body.
- * @param parameter The parameter for the function.
- * @param name The name of the parameter.
- * @param initializer The initializer for the parameter.
- */
- function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer, visitor) {
- initializer = ts.visitNode(initializer, visitor, ts.isExpression);
- var statement = createIf(createStrictEquality(getSynthesizedClone(name), createVoidZero()), setEmitFlags(createBlock([
- createStatement(createAssignment(setEmitFlags(getMutableClone(name), 1536 /* NoSourceMap */), setEmitFlags(initializer, 1536 /* NoSourceMap */ | getEmitFlags(initializer)),
- /*location*/ parameter))
- ], /*location*/ parameter), 32 /* SingleLine */ | 1024 /* NoTrailingSourceMap */ | 12288 /* NoTokenSourceMaps */),
- /*elseStatement*/ undefined,
- /*location*/ parameter);
- statement.startsOnNewLine = true;
- setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 1024 /* NoTrailingSourceMap */ | 8388608 /* CustomPrologue */);
- statements.push(statement);
+ ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement;
+ function convertToObjectAssignmentElement(element) {
+ if (ts.isBindingElement(element)) {
+ if (element.dotDotDotToken) {
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createSpreadAssignment(element.name, element), element);
+ }
+ if (element.propertyName) {
+ var expression = convertToAssignmentElementTarget(element.name);
+ return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element);
+ }
+ ts.Debug.assertNode(element.name, ts.isIdentifier);
+ return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element);
+ }
+ ts.Debug.assertNode(element, ts.isObjectLiteralElementLike);
+ return element;
}
- /**
- * Gets a value indicating whether we need to add statements to handle a rest parameter.
- *
- * @param node A ParameterDeclaration node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
- return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
+ ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
+ function convertToAssignmentPattern(node) {
+ switch (node.kind) {
+ case 173 /* ArrayBindingPattern */:
+ case 175 /* ArrayLiteralExpression */:
+ return convertToArrayAssignmentPattern(node);
+ case 172 /* ObjectBindingPattern */:
+ case 176 /* ObjectLiteralExpression */:
+ return convertToObjectAssignmentPattern(node);
+ }
}
- /**
- * Adds statements to the body of a function-like node if it contains a rest parameter.
- *
- * @param statements The statements for the new function body.
- * @param node A function-like node.
- * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
- * part of a constructor declaration with a
- * synthesized call to `super`
- */
- function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
- var parameter = ts.lastOrUndefined(node.parameters);
- if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
- return;
+ ts.convertToAssignmentPattern = convertToAssignmentPattern;
+ function convertToObjectAssignmentPattern(node) {
+ if (ts.isObjectBindingPattern(node)) {
+ return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node);
}
- // `declarationName` is the name of the local declaration for the parameter.
- var declarationName = getMutableClone(parameter.name);
- setEmitFlags(declarationName, 1536 /* NoSourceMap */);
- // `expressionName` is the name of the parameter used in expressions.
- var expressionName = getSynthesizedClone(parameter.name);
- var restIndex = node.parameters.length - 1;
- var temp = createLoopVariable();
- // var param = [];
- statements.push(setEmitFlags(createVariableStatement(
- /*modifiers*/ undefined, createVariableDeclarationList([
- createVariableDeclaration(declarationName,
- /*type*/ undefined, createArrayLiteral([]))
- ]),
- /*location*/ parameter), 8388608 /* CustomPrologue */));
- // for (var _i = restIndex; _i < arguments.length; _i++) {
- // param[_i - restIndex] = arguments[_i];
- // }
- var forStatement = createFor(createVariableDeclarationList([
- createVariableDeclaration(temp, /*type*/ undefined, createLiteral(restIndex))
- ], /*location*/ parameter), createLessThan(temp, createPropertyAccess(createIdentifier("arguments"), "length"),
- /*location*/ parameter), createPostfixIncrement(temp, /*location*/ parameter), createBlock([
- startOnNewLine(createStatement(createAssignment(createElementAccess(expressionName, createSubtract(temp, createLiteral(restIndex))), createElementAccess(createIdentifier("arguments"), temp)),
- /*location*/ parameter))
- ]));
- setEmitFlags(forStatement, 8388608 /* CustomPrologue */);
- startOnNewLine(forStatement);
- statements.push(forStatement);
- }
- ts.addRestParameterIfNeeded = addRestParameterIfNeeded;
- function convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, convertObjectRest) {
- // The following ES6 code:
- //
- // for (let v of expr) { }
- //
- // should be emitted as
- //
- // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
- // var v = _a[_i];
- // }
- //
- // where _a and _i are temps emitted to capture the RHS and the counter,
- // respectively.
- // When the left hand side is an expression instead of a let declaration,
- // the "let v" is not emitted.
- // When the left hand side is a let/const, the v is renamed if there is
- // another v in scope.
- // Note that all assignments to the LHS are emitted in the body, including
- // all destructuring.
- // Note also that because an extra statement is needed to assign to the LHS,
- // for-of bodies are always emitted as blocks.
- var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
- var initializer = node.initializer;
- var statements = [];
- // In the case where the user wrote an identifier as the RHS, like this:
- //
- // for (let v of arr) { }
- //
- // we don't want to emit a temporary variable for the RHS, just use it directly.
- var counter = convertObjectRest ? undefined : createLoopVariable();
- var rhsReference = expression.kind === 70 /* Identifier */
- ? createUniqueName(expression.text)
- : createTempVariable(/*recordTempVariable*/ undefined);
- var elementAccess = convertObjectRest ? rhsReference : createElementAccess(rhsReference, counter);
- // Initialize LHS
- // var v = _a[_i];
- if (ts.isVariableDeclarationList(initializer)) {
- if (initializer.flags & 3 /* BlockScoped */) {
- enableSubstitutionsForBlockScopedBindings();
- }
- var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
- if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
- // This works whether the declaration is a var, let, or const.
- // It will use rhsIterationValue _a[_i] as the initializer.
- var declarations = ts.flattenVariableDestructuring(firstOriginalDeclaration, elementAccess, visitor,
- /*recordTempVariable*/ undefined, convertObjectRest);
- var declarationList = createVariableDeclarationList(declarations, /*location*/ initializer);
- setOriginalNode(declarationList, initializer);
- // Adjust the source map range for the first declaration to align with the old
- // emitter.
- var firstDeclaration = declarations[0];
- var lastDeclaration = ts.lastOrUndefined(declarations);
- setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
- statements.push(createVariableStatement(
- /*modifiers*/ undefined, declarationList));
- }
- else {
- // The following call does not include the initializer, so we have
- // to emit it separately.
- statements.push(createVariableStatement(
- /*modifiers*/ undefined, setOriginalNode(createVariableDeclarationList([
- createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined),
- /*type*/ undefined, createElementAccess(rhsReference, counter))
- ], /*location*/ ts.moveRangePos(initializer, -1)), initializer),
- /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
+ ts.Debug.assertNode(node, ts.isObjectLiteralExpression);
+ return node;
+ }
+ ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern;
+ function convertToArrayAssignmentPattern(node) {
+ if (ts.isArrayBindingPattern(node)) {
+ return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node);
}
- else {
- // Initializer is an expression. Emit the expression in the body, so that it's
- // evaluated on every iteration.
- var assignment = createAssignment(initializer, elementAccess);
- if (ts.isDestructuringAssignment(assignment)) {
- // This is a destructuring pattern, so we flatten the destructuring instead.
- statements.push(createStatement(ts.flattenDestructuringAssignment(context, assignment,
- /*needsValue*/ false, context.hoistVariableDeclaration, visitor, convertObjectRest)));
- }
- else {
- // Currently there is not way to check that assignment is binary expression of destructing assignment
- // so we have to cast never type to binaryExpression
- assignment.end = initializer.end;
- statements.push(createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
- }
+ ts.Debug.assertNode(node, ts.isArrayLiteralExpression);
+ return node;
+ }
+ ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern;
+ function convertToAssignmentElementTarget(node) {
+ if (ts.isBindingPattern(node)) {
+ return convertToAssignmentPattern(node);
}
- var bodyLocation;
- var statementsLocation;
- if (convertedLoopBodyStatements) {
- ts.addRange(statements, convertedLoopBodyStatements);
+ ts.Debug.assertNode(node, ts.isExpression);
+ return node;
+ }
+ ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget;
+ function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) {
+ var externalImports = [];
+ var exportSpecifiers = ts.createMap();
+ var exportedBindings = ts.createMap();
+ var uniqueExports = ts.createMap();
+ var exportedNames;
+ var hasExportDefault = false;
+ var exportEquals = undefined;
+ var hasExportStarsToExportValues = false;
+ var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions);
+ var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText));
+ if (externalHelpersImportDeclaration) {
+ externalImports.push(externalHelpersImportDeclaration);
}
- else {
- var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
- if (ts.isBlock(statement)) {
- ts.addRange(statements, statement.statements);
- bodyLocation = statement;
- statementsLocation = statement.statements;
- }
- else {
- statements.push(statement);
+ for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
+ var node = _a[_i];
+ switch (node.kind) {
+ case 235 /* ImportDeclaration */:
+ // import "mod"
+ // import x from "mod"
+ // import * as x from "mod"
+ // import { x, y } from "mod"
+ externalImports.push(node);
+ break;
+ case 234 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 245 /* ExternalModuleReference */) {
+ // import x = require("mod")
+ externalImports.push(node);
+ }
+ break;
+ case 241 /* ExportDeclaration */:
+ if (node.moduleSpecifier) {
+ if (!node.exportClause) {
+ // export * from "mod"
+ externalImports.push(node);
+ hasExportStarsToExportValues = true;
+ }
+ else {
+ // export { x, y } from "mod"
+ externalImports.push(node);
+ }
+ }
+ else {
+ // export { x, y }
+ for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) {
+ var specifier = _c[_b];
+ if (!uniqueExports[specifier.name.text]) {
+ var name_10 = specifier.propertyName || specifier.name;
+ ts.multiMapAdd(exportSpecifiers, name_10.text, specifier);
+ var decl = resolver.getReferencedImportDeclaration(name_10)
+ || resolver.getReferencedValueDeclaration(name_10);
+ if (decl) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name);
+ }
+ uniqueExports[specifier.name.text] = true;
+ exportedNames = ts.append(exportedNames, specifier.name);
+ }
+ }
+ }
+ break;
+ case 240 /* ExportAssignment */:
+ if (node.isExportEquals && !exportEquals) {
+ // export = x
+ exportEquals = node;
+ }
+ break;
+ case 205 /* VariableStatement */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
+ var decl = _e[_d];
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
+ }
+ }
+ break;
+ case 225 /* FunctionDeclaration */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ if (ts.hasModifier(node, 512 /* Default */)) {
+ // export default function() { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export function x() { }
+ var name_11 = node.name;
+ if (!uniqueExports[name_11.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11);
+ uniqueExports[name_11.text] = true;
+ exportedNames = ts.append(exportedNames, name_11);
+ }
+ }
+ }
+ break;
+ case 226 /* ClassDeclaration */:
+ if (ts.hasModifier(node, 1 /* Export */)) {
+ if (ts.hasModifier(node, 512 /* Default */)) {
+ // export default class { }
+ if (!hasExportDefault) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node));
+ hasExportDefault = true;
+ }
+ }
+ else {
+ // export class x { }
+ var name_12 = node.name;
+ if (!uniqueExports[name_12.text]) {
+ ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12);
+ uniqueExports[name_12.text] = true;
+ exportedNames = ts.append(exportedNames, name_12);
+ }
+ }
+ }
+ break;
}
}
- // The old emitter does not emit source maps for the expression
- setEmitFlags(expression, 1536 /* NoSourceMap */ | getEmitFlags(expression));
- // The old emitter does not emit source maps for the block.
- // We add the location to preserve comments.
- var body = createBlock(createNodeArray(statements, /*location*/ statementsLocation),
- /*location*/ bodyLocation);
- setEmitFlags(body, 1536 /* NoSourceMap */ | 12288 /* NoTokenSourceMaps */);
- var forStatement;
- if (convertObjectRest) {
- forStatement = createForOf(createVariableDeclarationList([
- createVariableDeclaration(rhsReference, /*type*/ undefined, /*initializer*/ undefined, /*location*/ node.expression)
- ], /*location*/ node.expression), node.expression, body,
- /*location*/ node);
+ return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
+ }
+ ts.collectExternalModuleInfo = collectExternalModuleInfo;
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
+ if (ts.isBindingPattern(decl.name)) {
+ for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
+ var element = _a[_i];
+ if (!ts.isOmittedExpression(element)) {
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
+ }
+ }
}
- else {
- forStatement = createFor(setEmitFlags(createVariableDeclarationList([
- createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
- createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
- ], /*location*/ node.expression), 16777216 /* NoHoisting */), createLessThan(counter, createPropertyAccess(rhsReference, "length"),
- /*location*/ node.expression), createPostfixIncrement(counter, /*location*/ node.expression), body,
- /*location*/ node);
+ else if (!ts.isGeneratedIdentifier(decl.name)) {
+ if (!uniqueExports[decl.name.text]) {
+ uniqueExports[decl.name.text] = true;
+ exportedNames = ts.append(exportedNames, decl.name);
+ }
}
- // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
- setEmitFlags(forStatement, 8192 /* NoTokenTrailingSourceMaps */);
- return forStatement;
+ return exportedNames;
}
- ts.convertForOf = convertForOf;
})(ts || (ts = {}));
/// <reference path="utilities.ts"/>
/// <reference path="scanner.ts"/>
@@ -14217,29 +14250,31 @@ var ts;
visitNode(cbNode, node.type);
case 278 /* JSDocComment */:
return visitNodes(cbNodes, node.tags);
- case 280 /* JSDocParameterTag */:
+ case 281 /* JSDocParameterTag */:
return visitNode(cbNode, node.preParameterName) ||
visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.postParameterName);
- case 281 /* JSDocReturnTag */:
+ case 282 /* JSDocReturnTag */:
return visitNode(cbNode, node.typeExpression);
- case 282 /* JSDocTypeTag */:
+ case 283 /* JSDocTypeTag */:
return visitNode(cbNode, node.typeExpression);
- case 283 /* JSDocTemplateTag */:
+ case 280 /* JSDocAugmentsTag */:
+ return visitNode(cbNode, node.typeExpression);
+ case 284 /* JSDocTemplateTag */:
return visitNodes(cbNodes, node.typeParameters);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.jsDocTypeLiteral);
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
return visitNodes(cbNodes, node.jsDocPropertyTags);
- case 285 /* JSDocPropertyTag */:
+ case 286 /* JSDocPropertyTag */:
return visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name);
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
- case 287 /* JSDocLiteralType */:
+ case 288 /* JSDocLiteralType */:
return visitNode(cbNode, node.literal);
}
}
@@ -14462,7 +14497,7 @@ var ts;
return sourceFile;
}
function addJSDocComment(node) {
- var comments = ts.getJsDocCommentsFromText(node, sourceFile.text);
+ var comments = ts.getJSDocCommentRanges(node, sourceFile.text);
if (comments) {
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var comment = comments_2[_i];
@@ -14470,10 +14505,10 @@ var ts;
if (!jsDoc) {
continue;
}
- if (!node.jsDocComments) {
- node.jsDocComments = [];
+ if (!node.jsDoc) {
+ node.jsDoc = [];
}
- node.jsDocComments.push(jsDoc);
+ node.jsDoc.push(jsDoc);
}
}
return node;
@@ -14495,12 +14530,12 @@ var ts;
var saveParent = parent;
parent = n;
forEachChild(n, visitNode);
- if (n.jsDocComments) {
- for (var _i = 0, _a = n.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- jsDocComment.parent = n;
- parent = jsDocComment;
- forEachChild(jsDocComment, visitNode);
+ if (n.jsDoc) {
+ for (var _i = 0, _a = n.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ jsDoc.parent = n;
+ parent = jsDoc;
+ forEachChild(jsDoc, visitNode);
}
}
parent = saveParent;
@@ -18524,8 +18559,8 @@ var ts;
}
if (decorators || modifiers) {
// treat this as a property declaration with a missing name.
- var name_14 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
- return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, /*questionToken*/ undefined);
+ var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
ts.Debug.fail("Should not have attempted to parse class member declaration.");
@@ -19276,7 +19311,7 @@ var ts;
return finishNode(result);
}
function parseJSDocLiteralType() {
- var result = createNode(287 /* JSDocLiteralType */);
+ var result = createNode(288 /* JSDocLiteralType */);
result.literal = parseLiteralTypeNode();
return finishNode(result);
}
@@ -19486,6 +19521,9 @@ var ts;
var tag;
if (tagName) {
switch (tagName.text) {
+ case "augments":
+ tag = parseAugmentsTag(atToken, tagName);
+ break;
case "param":
tag = parseParamTag(atToken, tagName);
break;
@@ -19633,7 +19671,7 @@ var ts;
if (!typeExpression) {
typeExpression = tryParseTypeExpression();
}
- var result = createNode(280 /* JSDocParameterTag */, atToken.pos);
+ var result = createNode(281 /* JSDocParameterTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.preParameterName = preName;
@@ -19644,20 +19682,20 @@ var ts;
return finishNode(result);
}
function parseReturnTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocReturnTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(281 /* JSDocReturnTag */, atToken.pos);
+ var result = createNode(282 /* JSDocReturnTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTypeTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
- var result = createNode(282 /* JSDocTypeTag */, atToken.pos);
+ var result = createNode(283 /* JSDocTypeTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
@@ -19672,17 +19710,25 @@ var ts;
parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var result = createNode(285 /* JSDocPropertyTag */, atToken.pos);
+ var result = createNode(286 /* JSDocPropertyTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.name = name;
result.typeExpression = typeExpression;
return finishNode(result);
}
+ function parseAugmentsTag(atToken, tagName) {
+ var typeExpression = tryParseTypeExpression();
+ var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos);
+ result.atToken = atToken;
+ result.tagName = tagName;
+ result.typeExpression = typeExpression;
+ return finishNode(result);
+ }
function parseTypedefTag(atToken, tagName) {
var typeExpression = tryParseTypeExpression();
skipWhitespace();
- var typedefTag = createNode(284 /* JSDocTypedefTag */, atToken.pos);
+ var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos);
typedefTag.atToken = atToken;
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0);
@@ -19699,8 +19745,8 @@ var ts;
if (typeExpression.type.kind === 272 /* JSDocTypeReference */) {
var jsDocTypeReference = typeExpression.type;
if (jsDocTypeReference.name.kind === 70 /* Identifier */) {
- var name_15 = jsDocTypeReference.name;
- if (name_15.text === "Object") {
+ var name_14 = jsDocTypeReference.name;
+ if (name_14.text === "Object") {
typedefTag.jsDocTypeLiteral = scanChildTags();
}
}
@@ -19714,7 +19760,7 @@ var ts;
}
return finishNode(typedefTag);
function scanChildTags() {
- var jsDocTypeLiteral = createNode(286 /* JSDocTypeLiteral */, scanner.getStartPos());
+ var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos());
var resumePos = scanner.getStartPos();
var canParseTag = true;
var seenAsterisk = false;
@@ -19801,20 +19847,20 @@ var ts;
return false;
}
function parseTemplateTag(atToken, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTemplateTag */; })) {
+ if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) {
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text);
}
// Type parameter list looks like '@template T,U,V'
var typeParameters = createNodeArray();
while (true) {
- var name_16 = parseJSDocIdentifierName();
+ var name_15 = parseJSDocIdentifierName();
skipWhitespace();
- if (!name_16) {
+ if (!name_15) {
parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected);
return undefined;
}
- var typeParameter = createNode(143 /* TypeParameter */, name_16.pos);
- typeParameter.name = name_16;
+ var typeParameter = createNode(143 /* TypeParameter */, name_15.pos);
+ typeParameter.name = name_15;
finishNode(typeParameter);
typeParameters.push(typeParameter);
if (token() === 25 /* CommaToken */) {
@@ -19825,7 +19871,7 @@ var ts;
break;
}
}
- var result = createNode(283 /* JSDocTemplateTag */, atToken.pos);
+ var result = createNode(284 /* JSDocTemplateTag */, atToken.pos);
result.atToken = atToken;
result.tagName = tagName;
result.typeParameters = typeParameters;
@@ -19952,8 +19998,8 @@ var ts;
ts.Debug.assert(text === newText.substring(node.pos, node.end));
}
forEachChild(node, visitNode, visitArray);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
forEachChild(jsDocComment, visitNode, visitArray);
}
@@ -20530,7 +20576,7 @@ var ts;
if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
@@ -20580,7 +20626,7 @@ var ts;
var functionType = node.parent;
var index = ts.indexOf(functionType.parameters, node);
return "arg" + index;
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
var parentNode = node.parent && node.parent.parent;
var nameFromParentNode = void 0;
if (parentNode && parentNode.kind === 205 /* VariableStatement */) {
@@ -20713,7 +20759,7 @@ var ts;
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
// and this case is specially handled. Module augmentations should only be merged with original module definition
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
- var isJSDocTypedefInJSDocNamespace = node.kind === 284 /* JSDocTypedefTag */ &&
+ var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ &&
node.name &&
node.name.kind === 70 /* Identifier */ &&
node.name.isInJSDocNamespace;
@@ -20845,15 +20891,38 @@ var ts;
subtreeTransformFlags = savedSubtreeTransformFlags | computeTransformFlagsForNode(node, subtreeTransformFlags);
}
}
+ function bindEach(nodes) {
+ if (nodes === undefined) {
+ return;
+ }
+ if (skipTransformFlagAggregation) {
+ ts.forEach(nodes, bind);
+ }
+ else {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0 /* None */;
+ var nodeArrayFlags = 0 /* None */;
+ for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
+ var node = nodes_2[_i];
+ bind(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;
+ }
+ nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
+ }
+ }
+ function bindEachChild(node) {
+ ts.forEachChild(node, bind, bindEach);
+ }
function bindChildrenWorker(node) {
// Binding of JsDocComment should be done before the current block scope container changes.
// because the scope of JsDocComment should not be affected by whether the current node is a
// container or not.
- if (ts.isInJavaScriptFile(node) && node.jsDocComments) {
- ts.forEach(node.jsDocComments, bind);
+ if (ts.isInJavaScriptFile(node) && node.jsDoc) {
+ ts.forEach(node.jsDoc, bind);
}
if (checkUnreachable(node)) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
return;
}
switch (node.kind) {
@@ -20918,7 +20987,7 @@ var ts;
bindCallExpressionFlow(node);
break;
default:
- ts.forEachChild(node, bind);
+ bindEachChild(node);
break;
}
}
@@ -21224,7 +21293,7 @@ var ts;
}
return undefined;
}
- function bindbreakOrContinueFlow(node, breakTarget, continueTarget) {
+ function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
@@ -21237,11 +21306,11 @@ var ts;
var activeLabel = findActiveLabel(node.label.text);
if (activeLabel) {
activeLabel.referenced = true;
- bindbreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
+ bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
}
}
else {
- bindbreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
+ bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
}
}
function bindTryStatement(node) {
@@ -21303,6 +21372,8 @@ var ts;
currentFlow = finishFlowLabel(postSwitchLabel);
}
function bindCaseBlock(node) {
+ var savedSubtreeTransformFlags = subtreeTransformFlags;
+ subtreeTransformFlags = 0;
var clauses = node.clauses;
var fallthroughFlow = unreachableFlow;
for (var i = 0; i < clauses.length; i++) {
@@ -21322,13 +21393,15 @@ var ts;
errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch);
}
}
+ clauses.transformFlags = subtreeTransformFlags | 536870912 /* HasComputedFlags */;
+ subtreeTransformFlags |= savedSubtreeTransformFlags;
}
function bindCaseClause(node) {
var saveCurrentFlow = currentFlow;
currentFlow = preSwitchCaseFlow;
bind(node.expression);
currentFlow = saveCurrentFlow;
- ts.forEach(node.statements, bind);
+ bindEach(node.statements);
}
function pushActiveLabel(name, breakTarget, continueTarget) {
var activeLabel = {
@@ -21415,19 +21488,19 @@ var ts;
var saveTrueTarget = currentTrueTarget;
currentTrueTarget = currentFalseTarget;
currentFalseTarget = saveTrueTarget;
- ts.forEachChild(node, bind);
+ bindEachChild(node);
currentFalseTarget = currentTrueTarget;
currentTrueTarget = saveTrueTarget;
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {
bindAssignmentTargetFlow(node.operand);
}
}
}
function bindPostfixUnaryExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) {
bindAssignmentTargetFlow(node.operand);
}
@@ -21445,7 +21518,7 @@ var ts;
}
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) {
@@ -21458,7 +21531,7 @@ var ts;
}
}
function bindDeleteExpressionFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.expression.kind === 177 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
@@ -21491,7 +21564,7 @@ var ts;
}
}
function bindVariableDeclarationFlow(node) {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) {
bindInitializedVariableFlow(node);
}
@@ -21505,12 +21578,12 @@ var ts;
expr = expr.expression;
}
if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) {
- ts.forEach(node.typeArguments, bind);
- ts.forEach(node.arguments, bind);
+ bindEach(node.typeArguments);
+ bindEach(node.arguments);
bind(node.expression);
}
else {
- ts.forEachChild(node, bind);
+ bindEachChild(node);
}
if (node.expression.kind === 177 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
@@ -21526,7 +21599,7 @@ var ts;
case 229 /* EnumDeclaration */:
case 176 /* ObjectLiteralExpression */:
case 161 /* TypeLiteral */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 270 /* JSDocRecordType */:
return 1 /* IsContainer */;
case 227 /* InterfaceDeclaration */:
@@ -21616,7 +21689,7 @@ var ts;
case 176 /* ObjectLiteralExpression */:
case 227 /* InterfaceDeclaration */:
case 270 /* JSDocRecordType */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
@@ -21990,8 +22063,8 @@ var ts;
}
function updateStrictModeStatementList(statements) {
if (!inStrictMode) {
- for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
- var statement = statements_1[_i];
+ for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
+ var statement = statements_2[_i];
if (!ts.isPrologueDirective(statement)) {
return;
}
@@ -22018,7 +22091,7 @@ var ts;
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
- while (parentNode && parentNode.kind !== 284 /* JSDocTypedefTag */) {
+ while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) {
parentNode = parentNode.parent;
}
bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
@@ -22089,7 +22162,7 @@ var ts;
case 146 /* PropertySignature */:
case 271 /* JSDocRecordMember */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
- case 285 /* JSDocPropertyTag */:
+ case 286 /* JSDocPropertyTag */:
return bindJSDocProperty(node);
case 257 /* PropertyAssignment */:
case 258 /* ShorthandPropertyAssignment */:
@@ -22137,7 +22210,7 @@ var ts;
return bindFunctionOrConstructorType(node);
case 161 /* TypeLiteral */:
case 170 /* MappedType */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 270 /* JSDocRecordType */:
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
case 176 /* ObjectLiteralExpression */:
@@ -22158,7 +22231,7 @@ var ts;
return bindClassLikeDeclaration(node);
case 227 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
if (!node.fullName || node.fullName.kind === 70 /* Identifier */) {
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
}
@@ -22238,12 +22311,12 @@ var ts;
return;
}
else {
- var parent_5 = node.parent;
- if (!ts.isExternalModule(parent_5)) {
+ var parent_4 = node.parent;
+ if (!ts.isExternalModule(parent_4)) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files));
return;
}
- if (!parent_5.isDeclarationFile) {
+ if (!parent_4.isDeclarationFile) {
file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
return;
}
@@ -22591,14 +22664,14 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */
+ if (subtreeFlags & 524288 /* ContainsSpread */
|| isSuperOrSuperProperty(expression, expressionKind)) {
// If the this node contains a SpreadExpression, or is a super call, then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;
}
function isSuperOrSuperProperty(node, kind) {
switch (kind) {
@@ -22617,13 +22690,13 @@ var ts;
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (subtreeFlags & 524288 /* ContainsSpread */) {
// If the this node contains a SpreadElementExpression then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */;
}
function computeBinaryExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22632,19 +22705,19 @@ var ts;
if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ESNext if they contain rest
- transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
+ transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
- transformFlags |= 3072 /* AssertES2015 */ | 49152 /* AssertDestructuringAssignment */;
+ transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */
|| operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
- transformFlags |= 768 /* AssertES2016 */;
+ transformFlags |= 32 /* AssertES2016 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeParameter(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22656,25 +22729,25 @@ var ts;
// syntax.
if (node.questionToken
|| node.type
- || subtreeFlags & 65536 /* ContainsDecorators */
+ || subtreeFlags & 4096 /* ContainsDecorators */
|| ts.isThisIdentifier(name)) {
transformFlags |= 3 /* AssertTypeScript */;
}
// If a parameter has an accessibility modifier, then it is TypeScript syntax.
if (modifierFlags & 92 /* ParameterPropertyModifier */) {
- transformFlags |= 3 /* AssertTypeScript */ | 4194304 /* ContainsParameterPropertyAssignments */;
+ transformFlags |= 3 /* AssertTypeScript */ | 262144 /* ContainsParameterPropertyAssignments */;
}
// parameters with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a parameter has an initializer, a binding pattern or a dotDotDot token, then
// it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel.
- if (subtreeFlags & 67108864 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
- transformFlags |= 3072 /* AssertES2015 */ | 2097152 /* ContainsDefaultValueAssignments */;
+ if (subtreeFlags & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) {
+ transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~604001621 /* ParameterExcludes */;
+ return transformFlags & ~536872257 /* ParameterExcludes */;
}
function computeParenthesizedExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22690,11 +22763,11 @@ var ts;
}
// If the expression of a ParenthesizedExpression is a destructuring assignment,
// then the ParenthesizedExpression is a destructuring assignment.
- if (expressionTransformFlags & 16384 /* DestructuringAssignment */) {
- transformFlags |= 16384 /* DestructuringAssignment */;
+ if (expressionTransformFlags & 1024 /* DestructuringAssignment */) {
+ transformFlags |= 1024 /* DestructuringAssignment */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeClassDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -22705,47 +22778,47 @@ var ts;
}
else {
// A ClassDeclaration is ES6 syntax.
- transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
// An exported declaration may be TypeScript syntax, but is handled by the visitor
// for a namespace declaration.
- if ((subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */)
+ if ((subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */)
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~559895893 /* ClassExcludes */;
+ return transformFlags & ~539358529 /* ClassExcludes */;
}
function computeClassExpression(node, subtreeFlags) {
// A ClassExpression is ES6 syntax.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// A class with a parameter property assignment, property initializer, or decorator is
// TypeScript syntax.
- if (subtreeFlags & 4390912 /* TypeScriptClassSyntaxMask */
+ if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */
|| node.typeParameters) {
transformFlags |= 3 /* AssertTypeScript */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~559895893 /* ClassExcludes */;
+ return transformFlags & ~539358529 /* ClassExcludes */;
}
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
case 84 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 107 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
@@ -22756,27 +22829,27 @@ var ts;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeCatchClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) {
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~537920833 /* CatchClauseExcludes */;
}
function computeExpressionWithTypeArguments(node, subtreeFlags) {
// An ExpressionWithTypeArguments is ES6 syntax, as it is used in the
// extends clause of a class.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// If an ExpressionWithTypeArguments contains type arguments, then it
// is TypeScript syntax.
if (node.typeArguments) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeConstructor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22785,12 +22858,16 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* ConstructorExcludes */;
+ return transformFlags & ~601015617 /* ConstructorExcludes */;
}
function computeMethod(node, subtreeFlags) {
// A MethodDeclaration is ES6 syntax.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// Decorators, TypeScript-specific modifiers, type parameters, type annotations, and
// overloads are TypeScript syntax.
if (node.decorators
@@ -22800,16 +22877,20 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
// An async method declaration is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// Currently, we only support generators that were originally async function bodies.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;
}
function computeAccessor(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22821,8 +22902,12 @@ var ts;
|| !node.body) {
transformFlags |= 3 /* AssertTypeScript */;
}
+ // function declarations with object rest destructuring are ES Next syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
+ }
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~975983957 /* MethodOrAccessorExcludes */;
+ return transformFlags & ~601015617 /* MethodOrAccessorExcludes */;
}
function computePropertyDeclaration(node, subtreeFlags) {
// A PropertyDeclaration is TypeScript syntax.
@@ -22830,10 +22915,10 @@ var ts;
// If the PropertyDeclaration has an initializer, we need to inform its ancestor
// so that it handle the transformation.
if (node.initializer) {
- transformFlags |= 131072 /* ContainsPropertyInitializer */;
+ transformFlags |= 8192 /* ContainsPropertyInitializer */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeFunctionDeclaration(node, subtreeFlags) {
var transformFlags;
@@ -22845,7 +22930,7 @@ var ts;
transformFlags = 3 /* AssertTypeScript */;
}
else {
- transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
+ transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (modifierFlags & 2270 /* TypeScriptModifier */
@@ -22855,29 +22940,29 @@ var ts;
}
// An async function declaration is ES2017 syntax.
if (modifierFlags & 256 /* Async */) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// function declarations with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a FunctionDeclaration's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a FunctionDeclaration is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
// Currently we do not support transforming any other generator fucntions
// down level.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~980243797 /* FunctionExcludes */;
+ return transformFlags & ~601281857 /* FunctionExcludes */;
}
function computeFunctionExpression(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22890,32 +22975,32 @@ var ts;
}
// An async function expression is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// function expressions with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If a FunctionExpression's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
- if (subtreeFlags & 2621440 /* ES2015FunctionSyntaxMask */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 163840 /* ES2015FunctionSyntaxMask */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a FunctionExpression is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
// Currently we do not support transforming any other generator fucntions
// down level.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
- transformFlags |= 12288 /* AssertGenerator */;
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
+ transformFlags |= 768 /* AssertGenerator */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~980243797 /* FunctionExcludes */;
+ return transformFlags & ~601281857 /* FunctionExcludes */;
}
function computeArrowFunction(node, subtreeFlags) {
// An ArrowFunction is ES6 syntax, and excludes markers that should not escape the scope of an ArrowFunction.
- var transformFlags = subtreeFlags | 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 192 /* AssertES2015 */;
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
// syntax.
if (ts.hasModifier(node, 2270 /* TypeScriptModifier */)
@@ -22925,18 +23010,18 @@ var ts;
}
// An async arrow function is ES2017 syntax.
if (ts.hasModifier(node, 256 /* Async */)) {
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
}
// arrow functions with object rest destructuring are ES Next syntax
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */;
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// If an ArrowFunction contains a lexical this, its container must capture the lexical this.
- if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
- transformFlags |= 524288 /* ContainsCapturedLexicalThis */;
+ if (subtreeFlags & 16384 /* ContainsLexicalThis */) {
+ transformFlags |= 32768 /* ContainsCapturedLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~979719509 /* ArrowFunctionExcludes */;
+ return transformFlags & ~601249089 /* ArrowFunctionExcludes */;
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -22945,28 +23030,24 @@ var ts;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
if (expressionKind === 96 /* SuperKeyword */) {
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeVariableDeclaration(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- var nameKind = node.name.kind;
- // A VariableDeclaration with an object binding pattern is ES2015 syntax
- // and possibly ESNext syntax if it contains an object binding pattern
- if (nameKind === 172 /* ObjectBindingPattern */) {
- transformFlags |= 48 /* AssertESNext */ | 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
- }
- else if (nameKind === 173 /* ArrayBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ // A VariableDeclaration containing ObjectRest is ESNext syntax
+ if (subtreeFlags & 1048576 /* ContainsObjectRest */) {
+ transformFlags |= 8 /* AssertESNext */;
}
// Type annotations are TypeScript syntax.
if (node.type) {
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeVariableStatement(node, subtreeFlags) {
var transformFlags;
@@ -22978,22 +23059,22 @@ var ts;
}
else {
transformFlags = subtreeFlags;
- if (declarationListTransformFlags & 67108864 /* ContainsBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeLabeledStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// A labeled statement containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */
+ if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */
&& ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) {
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeImportEquals(node, subtreeFlags) {
var transformFlags = subtreeFlags;
@@ -23002,18 +23083,18 @@ var ts;
transformFlags |= 3 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeExpressionStatement(node, subtreeFlags) {
var transformFlags = subtreeFlags;
// If the expression of an expression statement is a destructuring assignment,
// then we treat the statement as ES6 so that we can indicate that we do not
// need to hold on to the right-hand side.
- if (node.expression.transformFlags & 16384 /* DestructuringAssignment */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (node.expression.transformFlags & 1024 /* DestructuringAssignment */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~536892757 /* NodeExcludes */;
+ return transformFlags & ~536872257 /* NodeExcludes */;
}
function computeModuleDeclaration(node, subtreeFlags) {
var transformFlags = 3 /* AssertTypeScript */;
@@ -23022,29 +23103,29 @@ var ts;
transformFlags |= subtreeFlags;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~839734613 /* ModuleExcludes */;
+ return transformFlags & ~574674241 /* ModuleExcludes */;
}
function computeVariableDeclarationList(node, subtreeFlags) {
- var transformFlags = subtreeFlags | 268435456 /* ContainsHoistedDeclarationOrCompletion */;
- if (subtreeFlags & 67108864 /* ContainsBindingPattern */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ var transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */;
+ if (subtreeFlags & 8388608 /* ContainsBindingPattern */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
// If a VariableDeclarationList is `let` or `const`, then it is ES6 syntax.
if (node.flags & 3 /* BlockScoped */) {
- transformFlags |= 3072 /* AssertES2015 */ | 33554432 /* ContainsBlockScopedBinding */;
+ transformFlags |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
- return transformFlags & ~604001621 /* VariableDeclarationListExcludes */;
+ return transformFlags & ~546309441 /* VariableDeclarationListExcludes */;
}
function computeOther(node, kind, subtreeFlags) {
// Mark transformations needed for each node
var transformFlags = subtreeFlags;
- var excludeFlags = 536892757 /* NodeExcludes */;
+ var excludeFlags = 536872257 /* NodeExcludes */;
switch (kind) {
case 119 /* AsyncKeyword */:
case 189 /* AwaitExpression */:
// async/await is ES2017 syntax
- transformFlags |= 192 /* AssertES2017 */;
+ transformFlags |= 16 /* AssertES2017 */;
break;
case 113 /* PublicKeyword */:
case 111 /* PrivateKeyword */:
@@ -23070,11 +23151,11 @@ var ts;
case 251 /* JsxSpreadAttribute */:
case 252 /* JsxExpression */:
// These nodes are Jsx syntax.
- transformFlags |= 12 /* AssertJsx */;
+ transformFlags |= 4 /* AssertJsx */;
break;
case 213 /* ForOfStatement */:
// for-of might be ESNext if it has a rest destructuring
- transformFlags |= 48 /* AssertESNext */;
+ transformFlags |= 8 /* AssertESNext */;
// FALLTHROUGH
case 12 /* NoSubstitutionTemplateLiteral */:
case 13 /* TemplateHead */:
@@ -23085,11 +23166,11 @@ var ts;
case 258 /* ShorthandPropertyAssignment */:
case 114 /* StaticKeyword */:
// These nodes are ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 195 /* YieldExpression */:
// This node is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */ | 134217728 /* ContainsYield */;
+ transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */;
break;
case 118 /* AnyKeyword */:
case 132 /* NumberKeyword */:
@@ -23130,8 +23211,8 @@ var ts;
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
- transformFlags |= 16777216 /* ContainsComputedPropertyName */;
- if (subtreeFlags & 262144 /* ContainsLexicalThis */) {
+ transformFlags |= 2097152 /* ContainsComputedPropertyName */;
+ if (subtreeFlags & 16384 /* ContainsLexicalThis */) {
// A computed method name like `[this.getName()](x: string) { ... }` needs to
// distinguish itself from the normal case of a method body containing `this`:
// `this` inside a method doesn't need to be rewritten (the method provides `this`),
@@ -23140,66 +23221,69 @@ var ts;
// `_this = this; () => class K { [_this.getName()]() { ... } }`
// To make this distinction, use ContainsLexicalThisInComputedPropertyName
// instead of ContainsLexicalThis for computed property names
- transformFlags |= 1048576 /* ContainsLexicalThisInComputedPropertyName */;
+ transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */;
}
break;
case 196 /* SpreadElement */:
+ transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */;
+ break;
case 259 /* SpreadAssignment */:
- // This node is ES6 or ES next syntax, but is handled by a containing node.
- transformFlags |= 8388608 /* ContainsSpreadExpression */;
+ transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */;
break;
- case 174 /* BindingElement */:
- if (node.dotDotDotToken) {
- // this node is ES2015 or ES next syntax, but is handled by a containing node.
- transformFlags |= 8388608 /* ContainsSpreadExpression */;
- }
case 96 /* SuperKeyword */:
// This node is ES6 syntax.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
break;
case 98 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
break;
case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- // These nodes are ES2015 or ES Next syntax.
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
- transformFlags |= 48 /* AssertESNext */ | 67108864 /* ContainsBindingPattern */;
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ if (subtreeFlags & 524288 /* ContainsRest */) {
+ transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */;
}
- else {
- transformFlags |= 3072 /* AssertES2015 */ | 67108864 /* ContainsBindingPattern */;
+ excludeFlags = 537396545 /* BindingPatternExcludes */;
+ break;
+ case 173 /* ArrayBindingPattern */:
+ transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */;
+ excludeFlags = 537396545 /* BindingPatternExcludes */;
+ break;
+ case 174 /* BindingElement */:
+ transformFlags |= 192 /* AssertES2015 */;
+ if (node.dotDotDotToken) {
+ transformFlags |= 524288 /* ContainsRest */;
}
break;
case 145 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
- transformFlags |= 3 /* AssertTypeScript */ | 65536 /* ContainsDecorators */;
+ transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */;
break;
case 176 /* ObjectLiteralExpression */:
- excludeFlags = 554784085 /* ObjectLiteralExcludes */;
- if (subtreeFlags & 16777216 /* ContainsComputedPropertyName */) {
+ excludeFlags = 540087617 /* ObjectLiteralExcludes */;
+ if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
// is an ES6 node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
- if (subtreeFlags & 1048576 /* ContainsLexicalThisInComputedPropertyName */) {
+ if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
- transformFlags |= 262144 /* ContainsLexicalThis */;
+ transformFlags |= 16384 /* ContainsLexicalThis */;
}
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (subtreeFlags & 1048576 /* ContainsObjectSpread */) {
// If an ObjectLiteralExpression contains a spread element, then it
// is an ES next node.
- transformFlags |= 48 /* AssertESNext */;
+ transformFlags |= 8 /* AssertESNext */;
}
break;
case 175 /* ArrayLiteralExpression */:
case 180 /* NewExpression */:
- excludeFlags = 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
- if (subtreeFlags & 8388608 /* ContainsSpreadExpression */) {
+ excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */;
+ if (subtreeFlags & 524288 /* ContainsSpread */) {
// If the this node contains a SpreadExpression, then it is an ES6
// node.
- transformFlags |= 3072 /* AssertES2015 */;
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 209 /* DoStatement */:
@@ -23207,19 +23291,19 @@ var ts;
case 211 /* ForStatement */:
case 212 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
- if (subtreeFlags & 33554432 /* ContainsBlockScopedBinding */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 261 /* SourceFile */:
- if (subtreeFlags & 524288 /* ContainsCapturedLexicalThis */) {
- transformFlags |= 3072 /* AssertES2015 */;
+ if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) {
+ transformFlags |= 192 /* AssertES2015 */;
}
break;
case 216 /* ReturnStatement */:
case 214 /* ContinueStatement */:
case 215 /* BreakStatement */:
- transformFlags |= 268435456 /* ContainsHoistedDeclarationOrCompletion */;
+ transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -23241,27 +23325,27 @@ var ts;
case 179 /* CallExpression */:
case 180 /* NewExpression */:
case 175 /* ArrayLiteralExpression */:
- return 545281365 /* ArrayLiteralOrCallOrNewExcludes */;
+ return 537396545 /* ArrayLiteralOrCallOrNewExcludes */;
case 230 /* ModuleDeclaration */:
- return 839734613 /* ModuleExcludes */;
+ return 574674241 /* ModuleExcludes */;
case 144 /* Parameter */:
- return 604001621 /* ParameterExcludes */;
+ return 536872257 /* ParameterExcludes */;
case 185 /* ArrowFunction */:
- return 979719509 /* ArrowFunctionExcludes */;
+ return 601249089 /* ArrowFunctionExcludes */;
case 184 /* FunctionExpression */:
case 225 /* FunctionDeclaration */:
- return 980243797 /* FunctionExcludes */;
+ return 601281857 /* FunctionExcludes */;
case 224 /* VariableDeclarationList */:
- return 604001621 /* VariableDeclarationListExcludes */;
+ return 546309441 /* VariableDeclarationListExcludes */;
case 226 /* ClassDeclaration */:
case 197 /* ClassExpression */:
- return 559895893 /* ClassExcludes */;
+ return 539358529 /* ClassExcludes */;
case 150 /* Constructor */:
- return 975983957 /* ConstructorExcludes */;
+ return 601015617 /* ConstructorExcludes */;
case 149 /* MethodDeclaration */:
case 151 /* GetAccessor */:
case 152 /* SetAccessor */:
- return 975983957 /* MethodOrAccessorExcludes */;
+ return 601015617 /* MethodOrAccessorExcludes */;
case 118 /* AnyKeyword */:
case 132 /* NumberKeyword */:
case 129 /* NeverKeyword */:
@@ -23279,9 +23363,14 @@ var ts;
case 228 /* TypeAliasDeclaration */:
return -3 /* TypeExcludes */;
case 176 /* ObjectLiteralExpression */:
- return 554784085 /* ObjectLiteralExcludes */;
+ return 540087617 /* ObjectLiteralExcludes */;
+ case 256 /* CatchClause */:
+ return 537920833 /* CatchClauseExcludes */;
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ return 537396545 /* BindingPatternExcludes */;
default:
- return 536892757 /* NodeExcludes */;
+ return 536872257 /* NodeExcludes */;
}
}
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -23332,6 +23421,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -24100,6 +24190,7 @@ var ts;
getJsxElementAttributesType: getJsxElementAttributesType,
getJsxIntrinsicTagNames: getJsxIntrinsicTagNames,
isOptionalParameter: isOptionalParameter,
+ tryGetMemberInModuleExports: tryGetMemberInModuleExports,
tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
// we deliberately exclude augmentations
// since we are only interested in declarations of the module itself
@@ -24111,6 +24202,7 @@ var ts;
var intersectionTypes = ts.createMap();
var stringLiteralTypes = ts.createMap();
var numericLiteralTypes = ts.createMap();
+ var indexedAccessTypes = ts.createMap();
var evolvingArrayTypes = [];
var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown");
var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__");
@@ -24130,7 +24222,6 @@ var ts;
var voidType = createIntrinsicType(1024 /* Void */, "void");
var neverType = createIntrinsicType(8192 /* Never */, "never");
var silentNeverType = createIntrinsicType(8192 /* Never */, "never");
- var stringOrNumberType = getUnionType([stringType, numberType]);
var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type");
emptyTypeLiteralSymbol.members = ts.createMap();
@@ -24853,6 +24944,7 @@ var ts;
if (!errorLocation ||
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
!checkAndReportErrorForExtendingInterface(errorLocation) &&
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) {
error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg));
}
@@ -24951,6 +25043,16 @@ var ts;
return undefined;
}
}
+ function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
+ if (meaning === 1920 /* Namespace */) {
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));
+ if (symbol) {
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name);
+ return true;
+ }
+ }
+ return false;
+ }
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */)) {
var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 /* Type */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined));
@@ -25079,31 +25181,31 @@ var ts;
var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier);
if (targetSymbol) {
- var name_17 = specifier.propertyName || specifier.name;
- if (name_17.text) {
+ var name_16 = specifier.propertyName || specifier.name;
+ if (name_16.text) {
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
var symbolFromVariable = void 0;
// First check if module was specified with "export=". If so, get the member from the resolved type
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
- symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text);
+ symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text);
}
else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text);
}
// if symbolFromVariable is export - get its final target
symbolFromVariable = resolveSymbol(symbolFromVariable);
- var symbolFromModule = getExportOfModule(targetSymbol, name_17.text);
+ var symbolFromModule = getExportOfModule(targetSymbol, name_16.text);
// If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default
- if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") {
+ if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol);
}
var symbol = symbolFromModule && symbolFromVariable ?
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
symbolFromModule || symbolFromVariable;
if (!symbol) {
- error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17));
+ error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16));
}
return symbol;
}
@@ -25357,6 +25459,12 @@ var ts;
function getExportsOfModuleAsArray(moduleSymbol) {
return symbolsToArray(getExportsOfModule(moduleSymbol));
}
+ function tryGetMemberInModuleExports(memberName, moduleSymbol) {
+ var symbolTable = getExportsOfModule(moduleSymbol);
+ if (symbolTable) {
+ return symbolTable[memberName];
+ }
+ }
function getExportsOfSymbol(symbol) {
return symbol.flags & 1536 /* Module */ ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
}
@@ -25967,9 +26075,9 @@ var ts;
if (!accessibleSymbolChain ||
needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
// Go up and add our parent.
- var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
- if (parent_6) {
- walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
+ var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
+ if (parent_5) {
+ walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false);
}
}
if (accessibleSymbolChain) {
@@ -26119,14 +26227,14 @@ var ts;
while (i < length_1) {
// Find group of type arguments for type parameters with the same declaring container.
var start = i;
- var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
+ var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
do {
i++;
- } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7);
+ } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6);
// When type parameters are their own type arguments for the whole group (i.e. we have
// the default outer type arguments), we don't show the group.
if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
- writeSymbolTypeReference(parent_7, typeArguments, start, i, flags);
+ writeSymbolTypeReference(parent_6, typeArguments, start, i, flags);
writePunctuation(writer, 22 /* DotToken */);
}
}
@@ -26565,14 +26673,14 @@ var ts;
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
- var parent_8 = getDeclarationContainer(node);
+ var parent_7 = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_8.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_8))) {
- return isGlobalSourceFile(parent_8);
+ !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) {
+ return isGlobalSourceFile(parent_7);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
- return isDeclarationVisible(parent_8);
+ return isDeclarationVisible(parent_7);
case 147 /* PropertyDeclaration */:
case 146 /* PropertySignature */:
case 151 /* GetAccessor */:
@@ -26757,15 +26865,15 @@ var ts;
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind);
+ return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression);
}
function getRestType(source, properties, symbol) {
ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now.");
var members = ts.createMap();
var names = ts.createMap();
for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) {
- var name_18 = properties_2[_i];
- names[ts.getTextOfPropertyName(name_18)] = true;
+ var name_17 = properties_2[_i];
+ names[ts.getTextOfPropertyName(name_17)] = true;
}
for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
var prop = _b[_a];
@@ -26808,7 +26916,7 @@ var ts;
var literalMembers = [];
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 198 /* OmittedExpression */ && !element.dotDotDotToken) {
+ if (!element.dotDotDotToken) {
literalMembers.push(element.propertyName || element.name);
}
}
@@ -26816,8 +26924,8 @@ var ts;
}
else {
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
- var name_19 = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name_19)) {
+ var name_18 = declaration.propertyName || declaration.name;
+ if (isComputedNonLiteralName(name_18)) {
// computed properties with non-literal names are treated as 'any'
return anyType;
}
@@ -26826,12 +26934,12 @@ var ts;
}
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
- var text = ts.getTextOfPropertyName(name_19);
+ var text = ts.getTextOfPropertyName(name_18);
type = getTypeOfPropertyOfType(parentType, text) ||
isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) ||
getIndexTypeOfType(parentType, 0 /* String */);
if (!type) {
- error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19));
+ error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18));
return unknownType;
}
}
@@ -26872,33 +26980,9 @@ var ts;
type;
}
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
- if (jsDocType) {
- return getTypeFromTypeNode(jsDocType);
- }
- }
- function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
- // First, see if this node has an @type annotation on it directly.
- var typeTag = ts.getJSDocTypeTag(declaration);
- if (typeTag && typeTag.typeExpression) {
- return typeTag.typeExpression.type;
- }
- if (declaration.kind === 223 /* VariableDeclaration */ &&
- declaration.parent.kind === 224 /* VariableDeclarationList */ &&
- declaration.parent.parent.kind === 205 /* VariableStatement */) {
- // @type annotation might have been on the variable statement, try that instead.
- var annotation = ts.getJSDocTypeTag(declaration.parent.parent);
- if (annotation && annotation.typeExpression) {
- return annotation.typeExpression.type;
- }
- }
- else if (declaration.kind === 144 /* Parameter */) {
- // If it's a parameter, see if the parent has a jsdoc comment with an @param
- // annotation.
- var paramTag = ts.getCorrespondingJSDocParameterTag(declaration);
- if (paramTag && paramTag.typeExpression) {
- return paramTag.typeExpression.type;
- }
+ var jsdocType = ts.getJSDocType(declaration);
+ if (jsdocType) {
+ return getTypeFromTypeNode(jsdocType);
}
return undefined;
}
@@ -26924,9 +27008,11 @@ var ts;
return type;
}
}
- // A variable declared in a for..in statement is always of type string
+ // A variable declared in a for..in statement is of type string, or of type keyof T when the
+ // right hand expression is of a type parameter type.
if (declaration.parent.parent.kind === 212 /* ForInStatement */) {
- return stringType;
+ var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression));
+ return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType;
}
if (declaration.parent.parent.kind === 213 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
@@ -26942,9 +27028,11 @@ var ts;
if (declaration.type) {
return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality);
}
- if (declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ if ((compilerOptions.noImplicitAny || declaration.flags & 2097152 /* JavaScriptFile */) &&
+ declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) {
- // Use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
+ // If --noImplicitAny is on or the declaration is in a Javascript file,
+ // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
// initializer or a 'null' or 'undefined' initializer.
if (!(ts.getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -27123,7 +27211,7 @@ var ts;
if (declaration.kind === 240 /* ExportAssignment */) {
return links.type = checkExpression(declaration.expression);
}
- if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 285 /* JSDocPropertyTag */ && declaration.typeExpression) {
+ if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) {
return links.type = getTypeFromTypeNode(declaration.typeExpression.type);
}
// Handle variable, parameter or property
@@ -27140,9 +27228,9 @@ var ts;
declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) {
// Use JS Doc type if present on parent expression statement
if (declaration.flags & 2097152 /* JavaScriptFile */) {
- var typeTag = ts.getJSDocTypeTag(declaration.parent);
- if (typeTag && typeTag.typeExpression) {
- return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
+ var jsdocType = ts.getJSDocType(declaration.parent);
+ if (jsdocType) {
+ return links.type = getTypeFromTypeNode(jsdocType);
}
}
var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ?
@@ -27477,6 +27565,14 @@ var ts;
}
baseType = getReturnTypeOfSignature(constructors[0]);
}
+ // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters
+ var valueDecl = type.symbol.valueDeclaration;
+ if (valueDecl && ts.isInJavaScriptFile(valueDecl)) {
+ var augTag = ts.getJSDocAugmentsTag(type.symbol.valueDeclaration);
+ if (augTag) {
+ baseType = getTypeFromTypeNode(augTag.typeExpression.type);
+ }
+ }
if (baseType === unknownType) {
return;
}
@@ -27485,7 +27581,7 @@ var ts;
return;
}
if (type === baseType || hasBaseType(baseType, type)) {
- error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));
+ error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */));
return;
}
if (type.resolvedBaseTypes === emptyArray) {
@@ -27599,7 +27695,7 @@ var ts;
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
return unknownType;
}
- var declaration = ts.getDeclarationOfKind(symbol, 284 /* JSDocTypedefTag */);
+ var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */);
var type = void 0;
if (declaration) {
if (declaration.jsDocTypeLiteral) {
@@ -28123,6 +28219,8 @@ var ts;
var members = ts.createMap();
var stringIndexInfo;
var numberIndexInfo;
+ // Resolve upfront such that recursive references see an empty object type.
+ setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
// In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type,
// and T as the template type.
var typeParameter = getTypeParameterFromMappedType(type);
@@ -28180,6 +28278,9 @@ var ts;
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
unknownType);
}
+ function getErasedTemplateTypeFromMappedType(type) {
+ return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
+ }
function isGenericMappedType(type) {
if (getObjectFlags(type) & 32 /* Mapped */) {
var constraintType = getConstraintTypeFromMappedType(type);
@@ -28278,18 +28379,25 @@ var ts;
return type.resolvedApparentType;
}
/**
+ * The apparent type of an indexed access T[K] is the type of T's string index signature, if any.
+ */
+ function getApparentTypeOfIndexedAccess(type) {
+ return getIndexTypeOfType(getApparentType(type.objectType), 0 /* String */) || type;
+ }
+ /**
* For a type parameter, return the base constraint of the type parameter. For the string, number,
* boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : type;
- return t.flags & 34 /* StringLike */ ? globalStringType :
+ var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) :
+ type.flags & 524288 /* IndexedAccess */ ? getApparentTypeOfIndexedAccess(type) :
+ type;
+ return t.flags & 262178 /* StringLike */ ? globalStringType :
t.flags & 340 /* NumberLike */ ? globalNumberType :
t.flags & 136 /* BooleanLike */ ? globalBooleanType :
t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() :
- t.flags & 262144 /* Index */ ? stringOrNumberType :
- t;
+ t;
}
function createUnionOrIntersectionProperty(containingType, name) {
var types = containingType.types;
@@ -28487,13 +28595,16 @@ var ts;
if (node.type && node.type.kind === 273 /* JSDocOptionalType */) {
return true;
}
- var paramTag = ts.getCorrespondingJSDocParameterTag(node);
- if (paramTag) {
- if (paramTag.isBracketed) {
- return true;
- }
- if (paramTag.typeExpression) {
- return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */;
+ var paramTags = ts.getJSDocParameterTags(node);
+ if (paramTags) {
+ for (var _i = 0, paramTags_1 = paramTags; _i < paramTags_1.length; _i++) {
+ var paramTag = paramTags_1[_i];
+ if (paramTag.isBracketed) {
+ return true;
+ }
+ if (paramTag.typeExpression) {
+ return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */;
+ }
}
}
}
@@ -29408,10 +29519,14 @@ var ts;
}
function getIndexType(type) {
return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) :
- type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringOrNumberType :
- getIndexInfoOfType(type, 1 /* Number */) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
+ getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType :
getLiteralTypeFromPropertyNames(type);
}
+ function getIndexTypeOrString(type) {
+ var indexType = getIndexType(type);
+ return indexType !== neverType ? indexType : stringType;
+ }
function getTypeFromTypeOperatorNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -29425,10 +29540,6 @@ var ts;
type.indexType = indexType;
return type;
}
- function getIndexedAccessTypeForTypeParameter(objectType, indexType) {
- var indexedAccessTypes = indexType.resolvedIndexedAccessTypes || (indexType.resolvedIndexedAccessTypes = []);
- return indexedAccessTypes[objectType.id] || (indexedAccessTypes[objectType.id] = createIndexedAccessType(objectType, indexType));
- }
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ?
@@ -29451,7 +29562,7 @@ var ts;
return getTypeOfSymbol(prop);
}
}
- if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
+ if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
if (isTypeAny(objectType)) {
return anyType;
}
@@ -29491,20 +29602,46 @@ var ts;
}
return unknownType;
}
+ function getIndexedAccessForMappedType(type, indexType, accessNode) {
+ var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined;
+ if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type));
+ return unknownType;
+ }
+ var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType);
+ var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
+ return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken);
+ }
function getIndexedAccessType(objectType, indexType, accessNode) {
- if (indexType.flags & 16384 /* TypeParameter */) {
- if (accessNode && !isTypeAssignableTo(getConstraintOfTypeParameter(indexType) || emptyObjectType, getIndexType(objectType))) {
- error(accessNode, ts.Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
- return unknownType;
+ if (indexType.flags & 16384 /* TypeParameter */ ||
+ objectType.flags & 16384 /* TypeParameter */ && indexType.flags & 262144 /* Index */ ||
+ isGenericMappedType(objectType)) {
+ // If either the object type or the index type are type parameters, or if the object type is a mapped
+ // type with a generic constraint, we are performing a higher-order index access where we cannot
+ // meaningfully access the properties of the object type. In those cases, we first check that the
+ // index type is assignable to 'keyof T' for the object type.
+ if (accessNode) {
+ if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
+ error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
+ return unknownType;
+ }
}
- return getIndexedAccessTypeForTypeParameter(objectType, indexType);
+ // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes
+ // the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the
+ // type Box<T[X]>.
+ if (isGenericMappedType(objectType)) {
+ return getIndexedAccessForMappedType(objectType, indexType, accessNode);
+ }
+ // Otherwise we defer the operation by creating an indexed access type.
+ var id = objectType.id + "," + indexType.id;
+ return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
}
- var apparentType = getApparentType(objectType);
+ var apparentObjectType = getApparentType(objectType);
if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) {
var propTypes = [];
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false);
+ var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false);
if (propType === unknownType) {
return unknownType;
}
@@ -29512,7 +29649,7 @@ var ts;
}
return getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true);
+ return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -29529,6 +29666,9 @@ var ts;
type.aliasSymbol = getAliasSymbolForTypeNode(node);
type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
links.resolvedType = type;
+ // Eagerly resolve the constraint type which forces an error if the constraint type circularly
+ // references itself through one or more type aliases.
+ getConstraintTypeFromMappedType(type);
}
return links.resolvedType;
}
@@ -29705,18 +29845,18 @@ var ts;
return nullType;
case 129 /* NeverKeyword */:
return neverType;
- case 288 /* JSDocNullKeyword */:
+ case 289 /* JSDocNullKeyword */:
return nullType;
- case 289 /* JSDocUndefinedKeyword */:
+ case 290 /* JSDocUndefinedKeyword */:
return undefinedType;
- case 290 /* JSDocNeverKeyword */:
+ case 291 /* JSDocNeverKeyword */:
return neverType;
case 167 /* ThisType */:
case 98 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
case 171 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 287 /* JSDocLiteralType */:
+ case 288 /* JSDocLiteralType */:
return getTypeFromLiteralTypeNode(node.literal);
case 157 /* TypeReference */:
case 272 /* JSDocTypeReference */:
@@ -29749,7 +29889,7 @@ var ts;
case 158 /* FunctionType */:
case 159 /* ConstructorType */:
case 161 /* TypeLiteral */:
- case 286 /* JSDocTypeLiteral */:
+ case 287 /* JSDocTypeLiteral */:
case 274 /* JSDocFunctionType */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
case 168 /* TypeOperator */:
@@ -29920,6 +30060,33 @@ var ts;
return result;
}
function instantiateMappedType(type, mapper) {
+ // Check if we have an isomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some
+ // type parameter T. If so, the mapped type is distributive over a union type and when T is instantiated
+ // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for
+ // isomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a
+ // union type A | undefined, we produce { [P in keyof A]: X } | undefined.
+ var constraintType = getConstraintTypeFromMappedType(type);
+ if (constraintType.flags & 262144 /* Index */) {
+ var typeParameter_1 = constraintType.type;
+ var mappedTypeParameter = mapper(typeParameter_1);
+ if (typeParameter_1 !== mappedTypeParameter) {
+ return mapType(mappedTypeParameter, function (t) {
+ if (isMappableType(t)) {
+ var replacementMapper = createUnaryTypeMapper(typeParameter_1, t);
+ var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper);
+ combinedMapper.mappedTypes = mapper.mappedTypes;
+ return instantiateMappedObjectType(type, combinedMapper);
+ }
+ return t;
+ });
+ }
+ }
+ return instantiateMappedObjectType(type, mapper);
+ }
+ function isMappableType(type) {
+ return type.flags & (16384 /* TypeParameter */ | 32768 /* Object */ | 131072 /* Intersection */ | 524288 /* IndexedAccess */);
+ }
+ function instantiateMappedObjectType(type, mapper) {
var result = createObjectType(32 /* Mapped */ | 64 /* Instantiated */, type.symbol);
result.declaration = type.declaration;
result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper;
@@ -30337,7 +30504,7 @@ var ts;
return false;
if (target.flags & 1 /* Any */ || source.flags & 8192 /* Never */)
return true;
- if (source.flags & 34 /* StringLike */ && target.flags & 2 /* String */)
+ if (source.flags & 262178 /* StringLike */ && target.flags & 2 /* String */)
return true;
if (source.flags & 340 /* NumberLike */ && target.flags & 4 /* Number */)
return true;
@@ -30476,12 +30643,6 @@ var ts;
}
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
- if (source.flags & 262144 /* Index */) {
- // A keyof T is related to a union type containing both string and number
- if (maybeTypeOfKind(target, 2 /* String */) && maybeTypeOfKind(target, 4 /* Number */)) {
- return -1 /* True */;
- }
- }
if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) {
if (hasExcessProperties(source, target, reportErrors)) {
if (reportErrors) {
@@ -30541,12 +30702,24 @@ var ts;
}
}
if (target.flags & 16384 /* TypeParameter */) {
- // Given a type parameter K with a constraint keyof T, a type S is
- // assignable to K if S is assignable to keyof T.
- var constraint = getConstraintOfTypeParameter(target);
- if (constraint && constraint.flags & 262144 /* Index */) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
- return result;
+ // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P].
+ if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
+ if (!source.declaration.questionToken) {
+ var templateType = getTemplateTypeFromMappedType(source);
+ var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
+ if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
+ return result;
+ }
+ }
+ }
+ else {
+ // Given a type parameter K with a constraint keyof T, a type S is
+ // assignable to K if S is assignable to keyof T.
+ var constraint = getConstraintOfTypeParameter(target);
+ if (constraint && constraint.flags & 262144 /* Index */) {
+ if (result = isRelatedTo(source, constraint, reportErrors)) {
+ return result;
+ }
}
}
}
@@ -30566,18 +30739,37 @@ var ts;
}
}
}
+ else if (target.flags & 524288 /* IndexedAccess */) {
+ // if we have indexed access types with identical index types, see if relationship holds for
+ // the two object types.
+ if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) {
+ if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
+ return result;
+ }
+ }
+ }
if (source.flags & 16384 /* TypeParameter */) {
- var constraint = getConstraintOfTypeParameter(source);
- if (!constraint || constraint.flags & 1 /* Any */) {
- constraint = emptyObjectType;
- }
- // The constraint may need to be further instantiated with its 'this' type.
- constraint = getTypeWithThisArgument(constraint, source);
- // Report constraint errors only if the constraint is not the empty object type
- var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
- errorInfo = saveErrorInfo;
- return result;
+ // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X.
+ if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
+ var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
+ var templateType = getTemplateTypeFromMappedType(target);
+ if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
+ return result;
+ }
+ }
+ else {
+ var constraint = getConstraintOfTypeParameter(source);
+ if (!constraint || constraint.flags & 1 /* Any */) {
+ constraint = emptyObjectType;
+ }
+ // The constraint may need to be further instantiated with its 'this' type.
+ constraint = getTypeWithThisArgument(constraint, source);
+ // Report constraint errors only if the constraint is not the empty object type
+ var reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
+ if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
+ }
}
}
else {
@@ -30587,29 +30779,18 @@ var ts;
return result;
}
}
- if (isGenericMappedType(target)) {
- // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.
- if (isGenericMappedType(source)) {
- if ((result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) &&
- (result = isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors))) {
- return result;
- }
- }
- }
- else {
- // Even if relationship doesn't hold for unions, intersections, or generic type references,
- // it may hold in a structural comparison.
- var apparentSource = getApparentType(source);
- // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
- // to X. Failing both of those we want to check if the aggregation of A and B's members structurally
- // relates to X. Thus, we include intersection types on the source side here.
- if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) {
- // Report structural errors only if we haven't reported any errors yet
- var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */);
- if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
- errorInfo = saveErrorInfo;
- return result;
- }
+ // Even if relationship doesn't hold for unions, intersections, or generic type references,
+ // it may hold in a structural comparison.
+ var apparentSource = getApparentType(source);
+ // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
+ // to X. Failing both of those we want to check if the aggregation of A and B's members structurally
+ // relates to X. Thus, we include intersection types on the source side here.
+ if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) {
+ // Report structural errors only if we haven't reported any errors yet
+ var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */);
+ if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) {
+ errorInfo = saveErrorInfo;
+ return result;
}
}
}
@@ -30832,6 +31013,9 @@ var ts;
if (expandingFlags === 3) {
result = 1 /* Maybe */;
}
+ else if (isGenericMappedType(source) || isGenericMappedType(target)) {
+ result = mappedTypeRelatedTo(source, target, reportErrors);
+ }
else {
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
@@ -30862,6 +31046,34 @@ var ts;
}
return result;
}
+ // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.
+ function mappedTypeRelatedTo(source, target, reportErrors) {
+ if (isGenericMappedType(target)) {
+ if (isGenericMappedType(source)) {
+ var result_2;
+ if (relation === identityRelation) {
+ var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken;
+ var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken;
+ if (readonlyMatches && optionalMatches) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ else {
+ if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) {
+ if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors);
+ }
+ }
+ }
+ }
+ }
+ else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) {
+ return -1 /* True */;
+ }
+ return 0 /* False */;
+ }
function propertiesRelatedTo(source, target, reportErrors) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source, target);
@@ -31401,7 +31613,7 @@ var ts;
return type;
}
var types = [type];
- if (flags & 34 /* StringLike */)
+ if (flags & 262178 /* StringLike */)
types.push(emptyStringType);
if (flags & 340 /* NumberLike */)
types.push(zeroType);
@@ -31791,19 +32003,6 @@ var ts;
}
}
else {
- if (getObjectFlags(target) & 32 /* Mapped */) {
- var constraintType = getConstraintTypeFromMappedType(target);
- if (getObjectFlags(source) & 32 /* Mapped */) {
- inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
- return;
- }
- if (constraintType.flags & 16384 /* TypeParameter */) {
- inferFromTypes(getIndexType(source), constraintType);
- inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
- return;
- }
- }
source = getApparentType(source);
if (source.flags & 32768 /* Object */) {
if (isInProcess(source, target)) {
@@ -31824,14 +32023,30 @@ var ts;
sourceStack[depth] = source;
targetStack[depth] = target;
depth++;
- inferFromProperties(source, target);
- inferFromSignatures(source, target, 0 /* Call */);
- inferFromSignatures(source, target, 1 /* Construct */);
- inferFromIndexTypes(source, target);
+ inferFromObjectTypes(source, target);
depth--;
}
}
}
+ function inferFromObjectTypes(source, target) {
+ if (getObjectFlags(target) & 32 /* Mapped */) {
+ var constraintType = getConstraintTypeFromMappedType(target);
+ if (getObjectFlags(source) & 32 /* Mapped */) {
+ inferFromTypes(getConstraintTypeFromMappedType(source), constraintType);
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ if (constraintType.flags & 16384 /* TypeParameter */) {
+ inferFromTypes(getIndexType(source), constraintType);
+ inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target));
+ return;
+ }
+ }
+ inferFromProperties(source, target);
+ inferFromSignatures(source, target, 0 /* Call */);
+ inferFromSignatures(source, target, 1 /* Construct */);
+ inferFromIndexTypes(source, target);
+ }
function inferFromProperties(source, target) {
var properties = getPropertiesOfObjectType(target);
for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
@@ -32200,7 +32415,7 @@ var ts;
}
function getTypeWithDefault(type, defaultExpression) {
if (defaultExpression) {
- var defaultType = checkExpression(defaultExpression);
+ var defaultType = getTypeOfExpression(defaultExpression);
return getUnionType([getTypeWithFacts(type, 131072 /* NEUndefined */), defaultType]);
}
return type;
@@ -32223,7 +32438,7 @@ var ts;
function getAssignedTypeOfBinaryExpression(node) {
return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ?
getTypeWithDefault(getAssignedType(node), node.right) :
- checkExpression(node.right);
+ getTypeOfExpression(node.right);
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element));
@@ -32274,7 +32489,7 @@ var ts;
// from its initializer, we'll already have cached the type. Otherwise we compute it now
// without caching such that transient types are reflected.
var links = getNodeLinks(node);
- return links.resolvedType || checkExpression(node);
+ return links.resolvedType || getTypeOfExpression(node);
}
function getInitialTypeOfVariableDeclaration(node) {
if (node.initializer) {
@@ -32327,7 +32542,7 @@ var ts;
}
function getTypeOfSwitchClause(clause) {
if (clause.kind === 253 /* CaseClause */) {
- var caseType = getRegularTypeOfLiteralType(checkExpression(clause.expression));
+ var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@@ -32419,7 +32634,7 @@ var ts;
// we defer subtype reduction until the evolving array type is finalized into a manifest
// array type.
function addEvolvingArrayElementType(evolvingArrayType, node) {
- var elementType = getBaseTypeOfLiteralType(checkExpression(node));
+ var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node));
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
}
function createFinalArrayType(elementType) {
@@ -32473,7 +32688,7 @@ var ts;
parent.parent.operatorToken.kind === 57 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
- isTypeAnyOrAllConstituentTypesHaveKind(checkExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */);
+ isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */);
return isLengthPushOrUnshift || isElementAssignment;
}
function maybeTypePredicateCall(node) {
@@ -32630,7 +32845,7 @@ var ts;
}
}
else {
- var indexType = checkExpression(node.left.argumentExpression);
+ var indexType = getTypeOfExpression(node.left.argumentExpression);
if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) {
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
}
@@ -32848,7 +33063,7 @@ var ts;
if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) {
assumeTrue = !assumeTrue;
}
- var valueType = checkExpression(value);
+ var valueType = getTypeOfExpression(value);
if (valueType.flags & 6144 /* Nullable */) {
if (!strictNullChecks) {
return type;
@@ -32930,7 +33145,7 @@ var ts;
return type;
}
// Check that right operand is a function type with a prototype property
- var rightType = checkExpression(expr.right);
+ var rightType = getTypeOfExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
return type;
}
@@ -32961,18 +33176,18 @@ var ts;
}
}
if (targetType) {
- return getNarrowedType(type, targetType, assumeTrue);
+ return getNarrowedType(type, targetType, assumeTrue, isTypeInstanceOf);
}
return type;
}
- function getNarrowedType(type, candidate, assumeTrue) {
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
if (!assumeTrue) {
- return filterType(type, function (t) { return !isTypeInstanceOf(t, candidate); });
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
}
// If the current type is a union type, remove all constituents that couldn't be instances of
// the candidate type. If one or more constituents remain, return a union of those.
if (type.flags & 65536 /* Union */) {
- var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); });
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
if (!(assignableType.flags & 8192 /* Never */)) {
return assignableType;
}
@@ -33005,7 +33220,7 @@ var ts;
var predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, predicateArgument)) {
return declaredType;
@@ -33018,7 +33233,7 @@ var ts;
var accessExpression = invokedExpression;
var possibleReference = ts.skipParentheses(accessExpression.expression);
if (isMatchingReference(reference, possibleReference)) {
- return getNarrowedType(type, predicate.type, assumeTrue);
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
}
if (containsMatchingReference(reference, possibleReference)) {
return declaredType;
@@ -33060,7 +33275,7 @@ var ts;
location = location.parent;
}
if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) {
- var type = checkExpression(location);
+ var type = getTypeOfExpression(location);
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
return type;
}
@@ -33473,9 +33688,9 @@ var ts;
return anyType;
}
function getTypeForThisExpressionFromJSDoc(node) {
- var typeTag = ts.getJSDocTypeTag(node);
- if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 274 /* JSDocFunctionType */) {
- var jsDocFunctionType = typeTag.typeExpression.type;
+ var jsdocType = ts.getJSDocType(node);
+ if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) {
+ var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) {
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
}
@@ -33745,11 +33960,11 @@ var ts;
}
if (ts.isBindingPattern(declaration.parent)) {
var parentDeclaration = declaration.parent.parent;
- var name_20 = declaration.propertyName || declaration.name;
+ var name_19 = declaration.propertyName || declaration.name;
if (ts.isVariableLike(parentDeclaration) &&
parentDeclaration.type &&
- !ts.isBindingPattern(name_20)) {
- var text = ts.getTextOfPropertyName(name_20);
+ !ts.isBindingPattern(name_19)) {
+ var text = ts.getTextOfPropertyName(name_19);
if (text) {
return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text);
}
@@ -33835,7 +34050,7 @@ var ts;
}
// In an assignment expression, the right operand is contextually typed by the type of the left operand.
if (node === binaryExpression.right) {
- return checkExpression(binaryExpression.left);
+ return getTypeOfExpression(binaryExpression.left);
}
}
else if (operator === 53 /* BarBarToken */) {
@@ -33843,7 +34058,7 @@ var ts;
// expression has no contextual type, the right operand is contextually typed by the type of the left operand.
var type = getContextualType(binaryExpression);
if (!type && node === binaryExpression.right) {
- type = checkExpression(binaryExpression.left);
+ type = getTypeOfExpression(binaryExpression.left);
}
return type;
}
@@ -34261,7 +34476,7 @@ var ts;
links.resolvedType = checkExpression(node.expression);
// This will allow types number, string, symbol or any. It will also allow enums, the unknown
// type, and any union of these types (like string | number).
- if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 34 /* StringLike */ | 512 /* ESSymbol */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 340 /* NumberLike */ | 262178 /* StringLike */ | 512 /* ESSymbol */)) {
error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
}
else {
@@ -34270,10 +34485,10 @@ var ts;
}
return links.resolvedType;
}
- function getObjectLiteralIndexInfo(node, properties, kind) {
+ function getObjectLiteralIndexInfo(propertyNodes, offset, properties, kind) {
var propTypes = [];
for (var i = 0; i < properties.length; i++) {
- if (kind === 0 /* String */ || isNumericName(node.properties[i].name)) {
+ if (kind === 0 /* String */ || isNumericName(propertyNodes[i + offset].name)) {
propTypes.push(getTypeOfSymbol(properties[i]));
}
}
@@ -34295,8 +34510,9 @@ var ts;
var patternWithComputedProperties = false;
var hasComputedStringProperty = false;
var hasComputedNumberProperty = false;
- for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
- var memberDecl = _a[_i];
+ var offset = 0;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
var member = memberDecl.symbol;
if (memberDecl.kind === 257 /* PropertyAssignment */ ||
memberDecl.kind === 258 /* ShorthandPropertyAssignment */ ||
@@ -34361,6 +34577,7 @@ var ts;
return unknownType;
}
spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false);
+ offset = i + 1;
continue;
}
else {
@@ -34388,8 +34605,8 @@ var ts;
// If object literal is contextually typed by the implied type of a binding pattern, augment the result
// type with those properties for which the binding pattern specifies a default value.
if (contextualTypeHasPattern) {
- for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) {
- var prop = _c[_b];
+ for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) {
+ var prop = _a[_i];
if (!propertiesTable[prop.name]) {
if (!(prop.flags & 536870912 /* Optional */)) {
error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
@@ -34409,8 +34626,8 @@ var ts;
}
return createObjectLiteralType();
function createObjectLiteralType() {
- var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined;
- var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined;
+ var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined;
+ var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined;
var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */;
result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */);
@@ -35085,7 +35302,7 @@ var ts;
if (node.kind === 212 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
- hasNumericPropertyNames(checkExpression(node.expression))) {
+ hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
return true;
}
child = node;
@@ -35191,13 +35408,13 @@ var ts;
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var signature = signatures_2[_i];
var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
- var parent_9 = signature.declaration && signature.declaration.parent;
+ var parent_8 = signature.declaration && signature.declaration.parent;
if (!lastSymbol || symbol === lastSymbol) {
- if (lastParent && parent_9 === lastParent) {
+ if (lastParent && parent_8 === lastParent) {
index++;
}
else {
- lastParent = parent_9;
+ lastParent = parent_8;
index = cutoffIndex;
}
}
@@ -35205,7 +35422,7 @@ var ts;
// current declaration belongs to a different symbol
// set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex
index = cutoffIndex = result.length;
- lastParent = parent_9;
+ lastParent = parent_8;
}
lastSymbol = symbol;
// specialized signatures always need to be placed before non-specialized signatures regardless
@@ -36537,7 +36754,7 @@ var ts;
if (!node.possiblyExhaustive) {
return false;
}
- var type = checkExpression(node.expression);
+ var type = getTypeOfExpression(node.expression);
if (!isLiteralType(type)) {
return false;
}
@@ -36944,10 +37161,10 @@ var ts;
// The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,
// and the right operand to be of type Any, an object type, or a type parameter type.
// The result is always of the Boolean primitive type.
- if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) {
+ if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) {
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
}
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) {
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -36956,20 +37173,21 @@ var ts;
var properties = node.properties;
for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property) {
+ /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) {
if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) {
- var name_21 = property.name;
- if (name_21.kind === 142 /* ComputedPropertyName */) {
- checkComputedPropertyName(name_21);
+ var name_20 = property.name;
+ if (name_20.kind === 142 /* ComputedPropertyName */) {
+ checkComputedPropertyName(name_20);
}
- if (isComputedNonLiteralName(name_21)) {
+ if (isComputedNonLiteralName(name_20)) {
return undefined;
}
- var text = ts.getTextOfPropertyName(name_21);
+ var text = ts.getTextOfPropertyName(name_20);
var type = isTypeAny(objectLiteralType)
? objectLiteralType
: getTypeOfPropertyOfType(objectLiteralType, text) ||
@@ -36985,13 +37203,18 @@ var ts;
}
}
else {
- error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21));
+ error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20));
}
}
else if (property.kind === 259 /* SpreadAssignment */) {
- if (property.expression.kind !== 70 /* Identifier */) {
- error(property.expression, ts.Diagnostics.An_object_rest_element_must_be_an_identifier);
+ var nonRestNames = [];
+ if (allProperties) {
+ for (var i = 0; i < allProperties.length - 1; i++) {
+ nonRestNames.push(allProperties[i].name);
+ }
}
+ var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
+ return checkDestructuringAssignment(property.expression, type);
}
else {
error(property, ts.Diagnostics.Property_assignment_expected);
@@ -37083,7 +37306,10 @@ var ts;
}
function checkReferenceAssignment(target, sourceType, contextualMapper) {
var targetType = checkExpression(target, contextualMapper);
- if (checkReferenceExpression(target, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ var error = target.parent.kind === 259 /* SpreadAssignment */ ?
+ ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
+ ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
+ if (checkReferenceExpression(target, error)) {
checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined);
}
return sourceType;
@@ -37246,7 +37472,7 @@ var ts;
resultType = numberType;
}
else {
- if (isTypeOfKind(leftType, 34 /* StringLike */) || isTypeOfKind(rightType, 34 /* StringLike */)) {
+ if (isTypeOfKind(leftType, 262178 /* StringLike */) || isTypeOfKind(rightType, 262178 /* StringLike */)) {
// If one or both operands are of the String primitive type, the result is of the String primitive type.
resultType = stringType;
}
@@ -37273,6 +37499,8 @@ var ts;
case 29 /* LessThanEqualsToken */:
case 30 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
+ leftType = getBaseTypeOfLiteralType(leftType);
+ rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}
@@ -37469,7 +37697,7 @@ var ts;
function checkDeclarationInitializer(declaration) {
var type = checkExpressionCached(declaration.initializer);
return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ ||
- ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ ||
+ ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) ||
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
}
function isLiteralContextualType(contextualType) {
@@ -37484,7 +37712,7 @@ var ts;
}
contextualType = apparentType;
}
- return maybeTypeOfKind(contextualType, 480 /* Literal */);
+ return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */));
}
return false;
}
@@ -37528,6 +37756,23 @@ var ts;
}
return type;
}
+ // Returns the type of an expression. Unlike checkExpression, this function is simply concerned
+ // with computing the type and may not fully check all contained sub-expressions for errors.
+ function getTypeOfExpression(node) {
+ // Optimize for the common case of a call to a function with a single non-generic call
+ // signature where we can just fetch the return type without checking the arguments.
+ if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) {
+ var funcType = checkNonNullExpression(node.expression);
+ var signature = getSingleCallSignature(funcType);
+ if (signature && !signature.typeParameters) {
+ return getReturnTypeOfSignature(signature);
+ }
+ }
+ // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions
+ // should have a parameter that indicates whether full error checking is required such that
+ // we can perform the optimizations locally.
+ return checkExpression(node);
+ }
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
// contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
// expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in
@@ -37730,9 +37975,9 @@ var ts;
else if (parameterName) {
var hasReportedError = false;
for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
- var name_22 = _a[_i].name;
- if (ts.isBindingPattern(name_22) &&
- checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) {
+ var name_21 = _a[_i].name;
+ if (ts.isBindingPattern(name_21) &&
+ checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) {
hasReportedError = true;
break;
}
@@ -37752,9 +37997,9 @@ var ts;
case 158 /* FunctionType */:
case 149 /* MethodDeclaration */:
case 148 /* MethodSignature */:
- var parent_10 = node.parent;
- if (node === parent_10.type) {
- return parent_10;
+ var parent_9 = node.parent;
+ if (node === parent_9.type) {
+ return parent_9;
}
}
}
@@ -37764,15 +38009,15 @@ var ts;
if (ts.isOmittedExpression(element)) {
continue;
}
- var name_23 = element.name;
- if (name_23.kind === 70 /* Identifier */ &&
- name_23.text === predicateVariableName) {
+ var name_22 = element.name;
+ if (name_22.kind === 70 /* Identifier */ &&
+ name_22.text === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name_23.kind === 173 /* ArrayBindingPattern */ ||
- name_23.kind === 172 /* ObjectBindingPattern */) {
- if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) {
+ else if (name_22.kind === 173 /* ArrayBindingPattern */ ||
+ name_22.kind === 172 /* ObjectBindingPattern */) {
+ if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) {
return true;
}
}
@@ -38040,8 +38285,8 @@ var ts;
if (superCallShouldBeFirst) {
var statements = node.body.statements;
var superCallStatement = void 0;
- for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
- var statement = statements_2[_i];
+ for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
+ var statement = statements_3[_i];
if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
@@ -38194,7 +38439,7 @@ var ts;
var type = getTypeFromMappedTypeNode(node);
var constraintType = getConstraintTypeFromMappedType(type);
var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
- checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint);
+ checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
}
function isPrivateWithinAmbient(node) {
return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node);
@@ -38475,10 +38720,10 @@ var ts;
case 229 /* EnumDeclaration */:
return 2097152 /* ExportType */ | 1048576 /* ExportValue */;
case 234 /* ImportEqualsDeclaration */:
- var result_2 = 0;
+ var result_3 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_2 |= getDeclarationSpaces(d); });
- return result_2;
+ ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); });
+ return result_3;
default:
return 1048576 /* ExportValue */;
}
@@ -39211,8 +39456,8 @@ var ts;
// otherwise if variable has an initializer - show error that initialization will fail
// since LHS will be block scoped name instead of function scoped
if (!namesShareScope) {
- var name_24 = symbolToString(localDeclarationSymbol);
- error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24);
+ var name_23 = symbolToString(localDeclarationSymbol);
+ error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23);
}
}
}
@@ -39303,13 +39548,13 @@ var ts;
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
- var parent_11 = node.parent.parent;
- var parentType = getTypeForBindingElementParent(parent_11);
- var name_25 = node.propertyName || node.name;
- var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25));
+ var parent_10 = node.parent.parent;
+ var parentType = getTypeForBindingElementParent(parent_10);
+ var name_24 = node.propertyName || node.name;
+ var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24));
markPropertyAsReferenced(property);
- if (parent_11.initializer && property && getParentOfSymbol(property)) {
- checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property);
+ if (parent_10.initializer && property && getParentOfSymbol(property)) {
+ checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property);
}
}
// For a binding pattern, check contained binding elements
@@ -39501,6 +39746,7 @@ var ts;
function checkForInStatement(node) {
// Grammar checking
checkGrammarForInOrForOfStatement(node);
+ var rightType = checkNonNullExpression(node.expression);
// TypeScript 1.0 spec (April 2014): 5.4
// In a 'for-in' statement of the form
// for (let VarDecl in Expr) Statement
@@ -39523,7 +39769,7 @@ var ts;
if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
- else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 34 /* StringLike */)) {
+ else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
}
else {
@@ -39531,10 +39777,9 @@ var ts;
checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access);
}
}
- var rightType = checkNonNullExpression(node.expression);
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
// in this case error about missing name is already reported - do not report extra one
- if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */)) {
+ if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) {
error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
checkSourceElement(node.statement);
@@ -39724,12 +39969,12 @@ var ts;
// After we remove all types that are StringLike, we will know if there was a string constituent
// based on whether the result of filter is a new array.
var arrayTypes = arrayOrStringType.types;
- var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 34 /* StringLike */); });
+ var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); });
if (filteredTypes !== arrayTypes) {
arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true);
}
}
- else if (arrayOrStringType.flags & 34 /* StringLike */) {
+ else if (arrayOrStringType.flags & 262178 /* StringLike */) {
arrayType = neverType;
}
var hasStringConstituent = arrayOrStringType !== arrayType;
@@ -39761,7 +40006,7 @@ var ts;
var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType;
if (hasStringConstituent) {
// This is just an optimization for the case where arrayOrStringType is string | string[]
- if (arrayElementType.flags & 34 /* StringLike */) {
+ if (arrayElementType.flags & 262178 /* StringLike */) {
return stringType;
}
return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true);
@@ -40532,7 +40777,7 @@ var ts;
return undefined;
}
}
- enumType_1 = checkExpression(expression);
+ enumType_1 = getTypeOfExpression(expression);
// allow references to constant members of other enums
if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) {
return undefined;
@@ -40753,9 +40998,9 @@ var ts;
break;
case 174 /* BindingElement */:
case 223 /* VariableDeclaration */:
- var name_26 = node.name;
- if (ts.isBindingPattern(name_26)) {
- for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) {
+ var name_25 = node.name;
+ if (ts.isBindingPattern(name_25)) {
+ for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) {
var el = _c[_b];
// mark individual names in binding pattern
checkModuleAugmentationElement(el, isGlobalAugmentation);
@@ -41587,7 +41832,7 @@ var ts;
}
// fallthrough
case 96 /* SuperKeyword */:
- var type = ts.isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node);
+ var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node);
return type.symbol;
case 167 /* ThisType */:
return getTypeFromTypeNode(node).symbol;
@@ -41613,7 +41858,7 @@ var ts;
case 8 /* NumericLiteral */:
// index access
if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) {
- var objectType = checkExpression(node.parent.expression);
+ var objectType = getTypeOfExpression(node.parent.expression);
if (objectType === unknownType)
return undefined;
var apparentType = getApparentType(objectType);
@@ -41649,7 +41894,7 @@ var ts;
return getTypeFromTypeNode(node);
}
if (ts.isPartOfExpression(node)) {
- return getTypeOfExpression(node);
+ return getRegularTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
// A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the
@@ -41702,7 +41947,7 @@ var ts;
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
if (expr.parent.kind === 192 /* BinaryExpression */) {
- var iteratedType = checkExpression(expr.parent.right);
+ var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || unknownType);
}
// If this is from nested object binding pattern
@@ -41729,11 +41974,11 @@ var ts;
var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text);
}
- function getTypeOfExpression(expr) {
+ function getRegularTypeOfExpression(expr) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
- return getRegularTypeOfLiteralType(checkExpression(expr));
+ return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
/**
* Gets either the static or instance type of a class element, based on
@@ -41762,9 +42007,9 @@ var ts;
function getRootSymbols(symbol) {
if (symbol.flags & 268435456 /* SyntheticProperty */) {
var symbols_3 = [];
- var name_27 = symbol.name;
+ var name_26 = symbol.name;
ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) {
- var symbol = getPropertyOfType(t, name_27);
+ var symbol = getPropertyOfType(t, name_26);
if (symbol) {
symbols_3.push(symbol);
}
@@ -41823,7 +42068,7 @@ var ts;
}
function isNameOfModuleOrEnumDeclaration(node) {
var parent = node.parent;
- return ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
+ return parent && ts.isModuleOrEnumDeclaration(parent) && node === parent.name;
}
// When resolved as an expression identifier, if the given node references an exported entity, return the declaration
// node of the exported entity's container. Otherwise, return undefined.
@@ -42084,7 +42329,7 @@ var ts;
else if (isTypeOfKind(type, 340 /* NumberLike */)) {
return ts.TypeReferenceSerializationKind.NumberLikeType;
}
- else if (isTypeOfKind(type, 34 /* StringLike */)) {
+ else if (isTypeOfKind(type, 262178 /* StringLike */)) {
return ts.TypeReferenceSerializationKind.StringLikeType;
}
else if (isTupleType(type)) {
@@ -42116,7 +42361,7 @@ var ts;
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
}
function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) {
- var type = getWidenedType(getTypeOfExpression(expr));
+ var type = getWidenedType(getRegularTypeOfExpression(expr));
getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags);
}
function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) {
@@ -42137,9 +42382,9 @@ var ts;
if (startInDeclarationContainer) {
// When resolving the name of a declaration as a value, we need to start resolution
// at a point outside of the declaration.
- var parent_12 = reference.parent;
- if (ts.isDeclaration(parent_12) && reference === parent_12.name) {
- location = getDeclarationContainer(parent_12);
+ var parent_11 = reference.parent;
+ if (ts.isDeclaration(parent_11) && reference === parent_11.name) {
+ location = getDeclarationContainer(parent_11);
}
}
return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
@@ -42268,9 +42513,9 @@ var ts;
// external modules cannot define or contribute to type declaration files
var current = symbol;
while (true) {
- var parent_13 = getParentOfSymbol(current);
- if (parent_13) {
- current = parent_13;
+ var parent_12 = getParentOfSymbol(current);
+ if (parent_12) {
+ current = parent_12;
}
else {
break;
@@ -42973,10 +43218,10 @@ var ts;
if (prop.kind === 259 /* SpreadAssignment */) {
continue;
}
- var name_28 = prop.name;
- if (name_28.kind === 142 /* ComputedPropertyName */) {
+ var name_27 = prop.name;
+ if (name_27.kind === 142 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
- checkGrammarComputedPropertyName(name_28);
+ checkGrammarComputedPropertyName(name_27);
}
if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
@@ -43004,8 +43249,8 @@ var ts;
if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) {
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
- if (name_28.kind === 8 /* NumericLiteral */) {
- checkGrammarNumericLiteral(name_28);
+ if (name_27.kind === 8 /* NumericLiteral */) {
+ checkGrammarNumericLiteral(name_27);
}
currentKind = Property;
}
@@ -43021,7 +43266,7 @@ var ts;
else {
ts.Debug.fail("Unexpected syntax kind:" + prop.kind);
}
- var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28);
+ var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27);
if (effectiveName === undefined) {
continue;
}
@@ -43031,18 +43276,18 @@ var ts;
else {
var existingKind = seen[effectiveName];
if (currentKind === Property && existingKind === Property) {
- grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28));
+ grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27));
}
else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
seen[effectiveName] = currentKind | existingKind;
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
}
}
else {
- return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
+ return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
}
}
}
@@ -43055,12 +43300,12 @@ var ts;
continue;
}
var jsxAttr = attr;
- var name_29 = jsxAttr.name;
- if (!seen[name_29.text]) {
- seen[name_29.text] = true;
+ var name_28 = jsxAttr.name;
+ if (!seen[name_28.text]) {
+ seen[name_28.text] = true;
}
else {
- return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
+ return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
var initializer = jsxAttr.initializer;
if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) {
@@ -43577,19 +43822,24 @@ var ts;
function reduceNode(node, f, initial) {
return node ? f(initial, node) : initial;
}
+ function reduceNodeArray(nodes, f, initial) {
+ return nodes ? f(initial, nodes) : initial;
+ }
/**
* Similar to `reduceLeft`, performs a reduction against each child of a node.
* NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the
* `nodeEdgeTraversalMap` above will be visited.
*
* @param node The node containing the children to reduce.
- * @param f The callback function
* @param initial The initial value to supply to the reduction.
+ * @param f The callback function
*/
- function reduceEachChild(node, f, initial) {
+ function reduceEachChild(node, initial, cbNode, cbNodeArray) {
if (node === undefined) {
return initial;
}
+ var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
+ var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) {
@@ -43606,114 +43856,114 @@ var ts;
case 206 /* EmptyStatement */:
case 198 /* OmittedExpression */:
case 222 /* DebuggerStatement */:
- case 292 /* NotEmittedStatement */:
+ case 293 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
case 142 /* ComputedPropertyName */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
case 144 /* Parameter */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 145 /* Decorator */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Type member
case 147 /* PropertyDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 149 /* MethodDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 150 /* Constructor */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 151 /* GetAccessor */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 152 /* SetAccessor */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
case 172 /* ObjectBindingPattern */:
case 173 /* ArrayBindingPattern */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 174 /* BindingElement */:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
case 175 /* ArrayLiteralExpression */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 176 /* ObjectLiteralExpression */:
- result = ts.reduceLeft(node.properties, f, result);
+ result = reduceNodes(node.properties, cbNodes, result);
break;
case 177 /* PropertyAccessExpression */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 178 /* ElementAccessExpression */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.argumentExpression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.argumentExpression, cbNode, result);
break;
case 179 /* CallExpression */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 180 /* NewExpression */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
- result = ts.reduceLeft(node.arguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
+ result = reduceNodes(node.arguments, cbNodes, result);
break;
case 181 /* TaggedTemplateExpression */:
- result = reduceNode(node.tag, f, result);
- result = reduceNode(node.template, f, result);
+ result = reduceNode(node.tag, cbNode, result);
+ result = reduceNode(node.template, cbNode, result);
break;
case 184 /* FunctionExpression */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 185 /* ArrowFunction */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 183 /* ParenthesizedExpression */:
case 186 /* DeleteExpression */:
@@ -43723,212 +43973,212 @@ var ts;
case 195 /* YieldExpression */:
case 196 /* SpreadElement */:
case 201 /* NonNullExpression */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 190 /* PrefixUnaryExpression */:
case 191 /* PostfixUnaryExpression */:
- result = reduceNode(node.operand, f, result);
+ result = reduceNode(node.operand, cbNode, result);
break;
case 192 /* BinaryExpression */:
- result = reduceNode(node.left, f, result);
- result = reduceNode(node.right, f, result);
+ result = reduceNode(node.left, cbNode, result);
+ result = reduceNode(node.right, cbNode, result);
break;
case 193 /* ConditionalExpression */:
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.whenTrue, f, result);
- result = reduceNode(node.whenFalse, f, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.whenTrue, cbNode, result);
+ result = reduceNode(node.whenFalse, cbNode, result);
break;
case 194 /* TemplateExpression */:
- result = reduceNode(node.head, f, result);
- result = ts.reduceLeft(node.templateSpans, f, result);
+ result = reduceNode(node.head, cbNode, result);
+ result = reduceNodes(node.templateSpans, cbNodes, result);
break;
case 197 /* ClassExpression */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 199 /* ExpressionWithTypeArguments */:
- result = reduceNode(node.expression, f, result);
- result = ts.reduceLeft(node.typeArguments, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNodes(node.typeArguments, cbNodes, result);
break;
// Misc
case 202 /* TemplateSpan */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.literal, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.literal, cbNode, result);
break;
// Element
case 204 /* Block */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 205 /* VariableStatement */:
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.declarationList, f, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.declarationList, cbNode, result);
break;
case 207 /* ExpressionStatement */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 208 /* IfStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.thenStatement, f, result);
- result = reduceNode(node.elseStatement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.thenStatement, cbNode, result);
+ result = reduceNode(node.elseStatement, cbNode, result);
break;
case 209 /* DoStatement */:
- result = reduceNode(node.statement, f, result);
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.statement, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 210 /* WhileStatement */:
case 217 /* WithStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 211 /* ForStatement */:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.condition, f, result);
- result = reduceNode(node.incrementor, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.condition, cbNode, result);
+ result = reduceNode(node.incrementor, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 212 /* ForInStatement */:
case 213 /* ForOfStatement */:
- result = reduceNode(node.initializer, f, result);
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.initializer, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 216 /* ReturnStatement */:
case 220 /* ThrowStatement */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 218 /* SwitchStatement */:
- result = reduceNode(node.expression, f, result);
- result = reduceNode(node.caseBlock, f, result);
+ result = reduceNode(node.expression, cbNode, result);
+ result = reduceNode(node.caseBlock, cbNode, result);
break;
case 219 /* LabeledStatement */:
- result = reduceNode(node.label, f, result);
- result = reduceNode(node.statement, f, result);
+ result = reduceNode(node.label, cbNode, result);
+ result = reduceNode(node.statement, cbNode, result);
break;
case 221 /* TryStatement */:
- result = reduceNode(node.tryBlock, f, result);
- result = reduceNode(node.catchClause, f, result);
- result = reduceNode(node.finallyBlock, f, result);
+ result = reduceNode(node.tryBlock, cbNode, result);
+ result = reduceNode(node.catchClause, cbNode, result);
+ result = reduceNode(node.finallyBlock, cbNode, result);
break;
case 223 /* VariableDeclaration */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 224 /* VariableDeclarationList */:
- result = ts.reduceLeft(node.declarations, f, result);
+ result = reduceNodes(node.declarations, cbNodes, result);
break;
case 225 /* FunctionDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.parameters, f, result);
- result = reduceNode(node.type, f, result);
- result = reduceNode(node.body, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.parameters, cbNodes, result);
+ result = reduceNode(node.type, cbNode, result);
+ result = reduceNode(node.body, cbNode, result);
break;
case 226 /* ClassDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.name, f, result);
- result = ts.reduceLeft(node.typeParameters, f, result);
- result = ts.reduceLeft(node.heritageClauses, f, result);
- result = ts.reduceLeft(node.members, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNodes(node.typeParameters, cbNodes, result);
+ result = reduceNodes(node.heritageClauses, cbNodes, result);
+ result = reduceNodes(node.members, cbNodes, result);
break;
case 232 /* CaseBlock */:
- result = ts.reduceLeft(node.clauses, f, result);
+ result = reduceNodes(node.clauses, cbNodes, result);
break;
case 235 /* ImportDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.importClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = reduceNodes(node.decorators, cbNodes, result);
+ result = reduceNodes(node.modifiers, cbNodes, result);
+ result = reduceNode(node.importClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
case 236 /* ImportClause */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.namedBindings, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 237 /* NamespaceImport */:
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 238 /* NamedImports */:
case 242 /* NamedExports */:
- result = ts.reduceLeft(node.elements, f, result);
+ result = reduceNodes(node.elements, cbNodes, result);
break;
case 239 /* ImportSpecifier */:
case 243 /* ExportSpecifier */:
- result = reduceNode(node.propertyName, f, result);
- result = reduceNode(node.name, f, result);
+ result = reduceNode(node.propertyName, cbNode, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 240 /* ExportAssignment */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.expression, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 241 /* ExportDeclaration */:
- result = ts.reduceLeft(node.decorators, f, result);
- result = ts.reduceLeft(node.modifiers, f, result);
- result = reduceNode(node.exportClause, f, result);
- result = reduceNode(node.moduleSpecifier, f, result);
+ result = ts.reduceLeft(node.decorators, cbNode, result);
+ result = ts.reduceLeft(node.modifiers, cbNode, result);
+ result = reduceNode(node.exportClause, cbNode, result);
+ result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// JSX
case 246 /* JsxElement */:
- result = reduceNode(node.openingElement, f, result);
- result = ts.reduceLeft(node.children, f, result);
- result = reduceNode(node.closingElement, f, result);
+ result = reduceNode(node.openingElement, cbNode, result);
+ result = ts.reduceLeft(node.children, cbNode, result);
+ result = reduceNode(node.closingElement, cbNode, result);
break;
case 247 /* JsxSelfClosingElement */:
case 248 /* JsxOpeningElement */:
- result = reduceNode(node.tagName, f, result);
- result = ts.reduceLeft(node.attributes, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
+ result = reduceNodes(node.attributes, cbNodes, result);
break;
case 249 /* JsxClosingElement */:
- result = reduceNode(node.tagName, f, result);
+ result = reduceNode(node.tagName, cbNode, result);
break;
case 250 /* JsxAttribute */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 251 /* JsxSpreadAttribute */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
case 252 /* JsxExpression */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
case 253 /* CaseClause */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
// fall-through
case 254 /* DefaultClause */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
case 255 /* HeritageClause */:
- result = ts.reduceLeft(node.types, f, result);
+ result = reduceNodes(node.types, cbNodes, result);
break;
case 256 /* CatchClause */:
- result = reduceNode(node.variableDeclaration, f, result);
- result = reduceNode(node.block, f, result);
+ result = reduceNode(node.variableDeclaration, cbNode, result);
+ result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
case 257 /* PropertyAssignment */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.initializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.initializer, cbNode, result);
break;
case 258 /* ShorthandPropertyAssignment */:
- result = reduceNode(node.name, f, result);
- result = reduceNode(node.objectAssignmentInitializer, f, result);
+ result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
case 259 /* SpreadAssignment */:
- result = reduceNode(node.expression, f, result);
+ result = reduceNode(node.expression, cbNode, result);
break;
// Top-level nodes
case 261 /* SourceFile */:
- result = ts.reduceLeft(node.statements, f, result);
+ result = reduceNodes(node.statements, cbNodes, result);
break;
- case 293 /* PartiallyEmittedExpression */:
- result = reduceNode(node.expression, f, result);
+ case 294 /* PartiallyEmittedExpression */:
+ result = reduceNode(node.expression, cbNode, result);
break;
default:
var edgeTraversalPath = nodeEdgeTraversalMap[kind];
@@ -43938,8 +44188,8 @@ var ts;
var value = node[edge.name];
if (value !== undefined) {
result = ts.isArray(value)
- ? ts.reduceLeft(value, f, result)
- : f(result, value);
+ ? reduceNodes(value, cbNodes, result)
+ : cbNode(result, value);
}
}
}
@@ -43949,8 +44199,8 @@ var ts;
}
ts.reduceEachChild = reduceEachChild;
function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) {
- if (node === undefined) {
- return undefined;
+ if (node === undefined || visitor === undefined) {
+ return node;
}
aggregateTransformFlags(node);
var visited = visitor(node);
@@ -44034,6 +44284,43 @@ var ts;
return updated || nodes;
}
ts.visitNodes = visitNodes;
+ /**
+ * Starts a new lexical environment and visits a statement list, ending the lexical environment
+ * and merging hoisted declarations upon completion.
+ */
+ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
+ context.startLexicalEnvironment();
+ statements = visitNodes(statements, visitor, ts.isStatement, start);
+ if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
+ statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements);
+ }
+ var declarations = context.endLexicalEnvironment();
+ return ts.createNodeArray(ts.concatenate(statements, declarations), statements);
+ }
+ ts.visitLexicalEnvironment = visitLexicalEnvironment;
+ /**
+ * Starts a new lexical environment and visits a parameter list, suspending the lexical
+ * environment upon completion.
+ */
+ function visitParameterList(nodes, visitor, context) {
+ context.startLexicalEnvironment();
+ var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration);
+ context.suspendLexicalEnvironment();
+ return updated;
+ }
+ ts.visitParameterList = visitParameterList;
+ function visitFunctionBody(node, visitor, context) {
+ context.resumeLexicalEnvironment();
+ var updated = visitNode(node, visitor, ts.isConciseBody);
+ var declarations = context.endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(updated);
+ var statements = mergeLexicalEnvironment(block.statements, declarations);
+ return ts.updateBlock(block, statements);
+ }
+ return updated;
+ }
+ ts.visitFunctionBody = visitFunctionBody;
function visitEachChild(node, visitor, context) {
if (node === undefined) {
return undefined;
@@ -44059,25 +44346,25 @@ var ts;
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
case 144 /* Parameter */:
- return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
+ return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Type member
case 147 /* PropertyDeclaration */:
return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
case 149 /* MethodDeclaration */:
- return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 150 /* Constructor */:
- return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
case 151 /* GetAccessor */:
- return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 152 /* SetAccessor */:
- return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context));
// Binding patterns
case 172 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement));
case 173 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement));
case 174 /* BindingElement */:
- return ts.updateBindingElement(node, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
+ return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true));
// Expression
case 175 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression));
@@ -44096,9 +44383,9 @@ var ts;
case 183 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 184 /* FunctionExpression */:
- return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 185 /* ArrowFunction */:
- return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isConciseBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 186 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 187 /* TypeOfExpression */:
@@ -44168,7 +44455,7 @@ var ts;
case 224 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration));
case 225 /* FunctionDeclaration */:
- return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), (context.startLexicalEnvironment(), visitNodes(node.parameters, visitor, ts.isParameter)), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), mergeFunctionBodyLexicalEnvironment(visitNode(node.body, visitor, ts.isFunctionBody, /*optional*/ true), context.endLexicalEnvironment()));
+ return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context));
case 226 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement));
case 232 /* CaseBlock */:
@@ -44224,10 +44511,9 @@ var ts;
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Top-level nodes
case 261 /* SourceFile */:
- context.startLexicalEnvironment();
- return ts.updateSourceFileNode(node, ts.createNodeArray(ts.concatenate(visitNodes(node.statements, visitor, ts.isStatement), context.endLexicalEnvironment()), node.statements));
+ return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
default:
var updated = void 0;
@@ -44256,6 +44542,15 @@ var ts;
// return node;
}
ts.visitEachChild = visitEachChild;
+ function mergeLexicalEnvironment(statements, declarations) {
+ if (!ts.some(declarations)) {
+ return statements;
+ }
+ return ts.isNodeArray(statements)
+ ? ts.createNodeArray(ts.concatenate(statements, declarations), statements)
+ : ts.addRange(statements, declarations);
+ }
+ ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function mergeFunctionBodyLexicalEnvironment(body, declarations) {
if (body && declarations !== undefined && declarations.length > 0) {
if (ts.isBlock(body)) {
@@ -44308,13 +44603,25 @@ var ts;
if (node === undefined) {
return 0 /* None */;
}
- else if (node.transformFlags & 536870912 /* HasComputedFlags */) {
+ if (node.transformFlags & 536870912 /* HasComputedFlags */) {
return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind);
}
- else {
- var subtreeFlags = aggregateTransformFlagsForSubtree(node);
- return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ var subtreeFlags = aggregateTransformFlagsForSubtree(node);
+ return ts.computeTransformFlagsForNode(node, subtreeFlags);
+ }
+ function aggregateTransformFlagsForNodeArray(nodes) {
+ if (nodes === undefined) {
+ return 0 /* None */;
+ }
+ var subtreeFlags = 0 /* None */;
+ var nodeArrayFlags = 0 /* None */;
+ for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
+ var node = nodes_3[_i];
+ subtreeFlags |= aggregateTransformFlagsForNode(node);
+ nodeArrayFlags |= node.transformFlags & ~536870912 /* HasComputedFlags */;
}
+ nodes.transformFlags = nodeArrayFlags | 536870912 /* HasComputedFlags */;
+ return subtreeFlags;
}
/**
* Aggregates the transform flags for the subtree of a node.
@@ -44326,14 +44633,17 @@ var ts;
return 0 /* None */;
}
// Aggregate the transform flags of each child.
- return reduceEachChild(node, aggregateTransformFlagsForChildNode, 0 /* None */);
+ return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
}
/**
* Aggregates the TransformFlags of a child node with the TransformFlags of its
* siblings.
*/
- function aggregateTransformFlagsForChildNode(transformFlags, child) {
- return transformFlags | aggregateTransformFlagsForNode(child);
+ function aggregateTransformFlagsForChildNode(transformFlags, node) {
+ return transformFlags | aggregateTransformFlagsForNode(node);
+ }
+ function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
+ return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
var Debug;
(function (Debug) {
@@ -44343,9 +44653,21 @@ var ts;
Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */)
? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); }
: ts.noop;
+ Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
: ts.noop;
+ Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }); }
+ : ts.noop;
+ Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }); }
+ : ts.noop;
+ Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
+ ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }); }
+ : ts.noop;
function getFunctionName(func) {
if (typeof func !== "function") {
return "";
@@ -44367,504 +44689,348 @@ var ts;
/*@internal*/
var ts;
(function (ts) {
+ var FlattenLevel;
+ (function (FlattenLevel) {
+ FlattenLevel[FlattenLevel["All"] = 0] = "All";
+ FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest";
+ })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {}));
/**
- * Flattens a destructuring assignment expression.
+ * Flattens a DestructuringAssignment or a VariableDeclaration to an expression.
*
- * @param root The destructuring assignment expression.
- * @param needsValue Indicates whether the value from the right-hand-side of the
- * destructuring assignment is needed as part of a larger expression.
- * @param recordTempVariable A callback used to record new temporary variables.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param node The node to flatten.
+ * @param visitor An optional visitor used to visit initializers.
+ * @param context The transformation context.
+ * @param level Indicates the extent to which flattening should occur.
+ * @param needsValue An optional value indicating whether the value from the right-hand-side of
+ * the destructuring assignment is needed as part of a larger expression.
+ * @param createAssignmentCallback An optional callback used to create the assignment expression.
*/
- function flattenDestructuringAssignment(context, node, needsValue, recordTempVariable, visitor, transformRest) {
- if (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
- var right = node.right;
- if (ts.isDestructuringAssignment(right)) {
- return flattenDestructuringAssignment(context, right, needsValue, recordTempVariable, visitor);
- }
- else {
- return node.right;
- }
- }
+ function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
var location = node;
- var value = node.right;
- var expressions = [];
- if (needsValue) {
- // If the right-hand value of the destructuring assignment needs to be preserved (as
- // is the case when the destructuring assignmen) is part of a larger expression),
- // then we need to cache the right-hand value.
- //
- // The source map location for the assignment should point to the entire binary
- // expression.
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment, visitor);
+ var value;
+ if (ts.isDestructuringAssignment(node)) {
+ value = node.right;
+ while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) {
+ if (ts.isDestructuringAssignment(value)) {
+ location = node = value;
+ value = node.right;
+ }
+ else {
+ return value;
+ }
+ }
}
- else if (ts.nodeIsSynthesized(node)) {
- // Generally, the source map location for a destructuring assignment is the root
- // expression.
- //
- // However, if the root expression is synthesized (as in the case
- // of the initializer when transforming a ForOfStatement), then the source map
- // location should point to the right-hand value of the expression.
- location = value;
+ var expressions;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: true,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayAssignmentPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectAssignmentPattern,
+ createArrayBindingOrAssignmentElement: makeAssignmentElement,
+ visitor: visitor
+ };
+ if (value) {
+ value = ts.visitNode(value, visitor, ts.isExpression);
+ if (needsValue) {
+ // If the right-hand value of the destructuring assignment needs to be preserved (as
+ // is the case when the destructuring assignment is part of a larger expression),
+ // then we need to cache the right-hand value.
+ //
+ // The source map location for the assignment should point to the entire binary
+ // expression.
+ value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);
+ }
+ else if (ts.nodeIsSynthesized(node)) {
+ // Generally, the source map location for a destructuring assignment is the root
+ // expression.
+ //
+ // However, if the root expression is synthesized (as in the case
+ // of the initializer when transforming a ForOfStatement), then the source map
+ // location should point to the right-hand value of the expression.
+ location = value;
+ }
}
- flattenDestructuring(node, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
- if (needsValue) {
+ flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node));
+ if (value && needsValue) {
+ if (!ts.some(expressions)) {
+ return value;
+ }
expressions.push(value);
}
- var expression = ts.inlineExpressions(expressions);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location) {
- var expression = ts.createAssignment(name, value, location);
+ return ts.aggregateTransformFlags(ts.inlineExpressions(expressions)) || ts.createOmittedExpression();
+ function emitExpression(expression) {
// NOTE: this completely disables source maps, but aligns with the behavior of
// `emitAssignment` in the old emitter.
- ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */);
+ ts.setEmitFlags(expression, 64 /* NoNestedSourceMaps */);
ts.aggregateTransformFlags(expression);
- expressions.push(expression);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitAssignment(name, value, location);
- return name;
+ expressions = ts.append(expressions, expression);
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectLiteral(elements), value, location);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
+ var expression = createAssignmentCallback
+ ? createAssignmentCallback(target, value, location)
+ : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location);
+ expression.original = original;
+ emitExpression(expression);
}
}
ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
/**
- * Flattens binding patterns in a parameter declaration.
+ * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations.
*
- * @param node The ParameterDeclaration to flatten.
- * @param value The rhs value for the binding pattern.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param node The node to flatten.
+ * @param visitor An optional visitor used to visit initializers.
+ * @param context The transformation context.
+ * @param boundValue The value bound to the declaration.
+ * @param skipInitializer A value indicating whether to ignore the initializer of `node`.
+ * @param hoistTempVariables Indicates whether temporary variables should not be recorded in-line.
+ * @param level Indicates the extent to which flattening should occur.
*/
- function flattenParameterDestructuring(node, value, visitor, transformRest) {
+ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
+ var pendingExpressions;
+ var pendingDeclarations = [];
var declarations = [];
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, transformRest, visitor);
- return declarations;
- function emitAssignment(name, value, location) {
- var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location);
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */);
- ts.aggregateTransformFlags(declaration);
- declarations.push(declaration);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(/*recordTempVariable*/ undefined);
- emitAssignment(name, value, location);
- return name;
+ var flattenContext = {
+ context: context,
+ level: level,
+ hoistTempVariables: hoistTempVariables,
+ emitExpression: emitExpression,
+ emitBindingOrAssignment: emitBindingOrAssignment,
+ createArrayBindingOrAssignmentPattern: makeArrayBindingPattern,
+ createObjectBindingOrAssignmentPattern: makeObjectBindingPattern,
+ createArrayBindingOrAssignmentElement: makeBindingElement,
+ visitor: visitor
+ };
+ flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
+ if (pendingExpressions) {
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (hoistTempVariables) {
+ var value = ts.inlineExpressions(pendingExpressions);
+ pendingExpressions = undefined;
+ emitBindingOrAssignment(temp, value, /*location*/ undefined, /*original*/ undefined);
+ }
+ else {
+ context.hoistVariableDeclaration(temp);
+ var pendingDeclaration = ts.lastOrUndefined(pendingDeclarations);
+ pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, ts.createAssignment(temp, pendingDeclaration.value));
+ ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
+ pendingDeclaration.value = temp;
+ }
}
- function emitRestAssignment(elements, value, location) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location);
+ for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
+ var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original;
+ var variable = ts.createVariableDeclaration(name_29,
+ /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2);
+ variable.original = original;
+ if (ts.isIdentifier(name_29)) {
+ ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */);
+ }
+ ts.aggregateTransformFlags(variable);
+ declarations.push(variable);
}
- }
- ts.flattenParameterDestructuring = flattenParameterDestructuring;
- /**
- * Flattens binding patterns in a variable declaration.
- *
- * @param node The VariableDeclaration to flatten.
- * @param value An optional rhs value for the binding pattern.
- * @param visitor An optional visitor to use to visit expressions.
- */
- function flattenVariableDestructuring(node, value, visitor, recordTempVariable, transformRest) {
- var declarations = [];
- var pendingAssignments;
- flattenDestructuring(node, value, node, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor);
return declarations;
- function emitAssignment(name, value, location, original) {
- if (pendingAssignments) {
- pendingAssignments.push(value);
- value = ts.inlineExpressions(pendingAssignments);
- pendingAssignments = undefined;
- }
- var declaration = ts.createVariableDeclaration(name, /*type*/ undefined, value, location);
- declaration.original = original;
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(declaration, 2048 /* NoNestedSourceMaps */);
- declarations.push(declaration);
- ts.aggregateTransformFlags(declaration);
+ function emitExpression(value) {
+ pendingExpressions = ts.append(pendingExpressions, value);
}
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- if (recordTempVariable) {
- var assignment = ts.createAssignment(name, value, location);
- if (pendingAssignments) {
- pendingAssignments.push(assignment);
- }
- else {
- pendingAssignments = [assignment];
- }
- }
- else {
- emitAssignment(name, value, location, /*original*/ undefined);
+ function emitBindingOrAssignment(target, value, location, original) {
+ ts.Debug.assertNode(target, ts.isBindingName);
+ if (pendingExpressions) {
+ value = ts.inlineExpressions(ts.append(pendingExpressions, value));
+ pendingExpressions = undefined;
}
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectBindingPattern(elements), value, location, original);
+ pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
}
}
- ts.flattenVariableDestructuring = flattenVariableDestructuring;
+ ts.flattenDestructuringBinding = flattenDestructuringBinding;
/**
- * Flattens binding patterns in a variable declaration and transforms them into an expression.
+ * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments.
*
- * @param node The VariableDeclaration to flatten.
- * @param recordTempVariable A callback used to record new temporary variables.
- * @param createAssignmentCallback An optional callback used to create assignment expressions
- * for non-temporary variables.
- * @param visitor An optional visitor to use to visit expressions.
+ * @param flattenContext Options used to control flattening.
+ * @param element The element to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ * @param skipInitializer An optional value indicating whether to include the initializer
+ * for the element.
*/
- function flattenVariableDestructuringToExpression(node, recordTempVariable, createAssignmentCallback, visitor) {
- var pendingAssignments = [];
- flattenDestructuring(node, /*value*/ undefined, node, emitAssignment, emitTempVariableAssignment, ts.noop, emitRestAssignment, /*transformRest*/ false, visitor);
- var expression = ts.inlineExpressions(pendingAssignments);
- ts.aggregateTransformFlags(expression);
- return expression;
- function emitAssignment(name, value, location, original) {
- var expression = createAssignmentCallback
- ? createAssignmentCallback(name.kind === 70 /* Identifier */ ? name : emitTempVariableAssignment(name, location), value, location)
- : ts.createAssignment(name, value, location);
- emitPendingAssignment(expression, original);
- }
- function emitTempVariableAssignment(value, location) {
- var name = ts.createTempVariable(recordTempVariable);
- emitPendingAssignment(ts.createAssignment(name, value, location), /*original*/ undefined);
- return name;
- }
- function emitRestAssignment(elements, value, location, original) {
- emitAssignment(ts.createObjectLiteral(elements), value, location, original);
- }
- function emitPendingAssignment(expression, original) {
- expression.original = original;
- // NOTE: this completely disables source maps, but aligns with the behavior of
- // `emitAssignment` in the old emitter.
- ts.setEmitFlags(expression, 2048 /* NoNestedSourceMaps */);
- pendingAssignments.push(expression);
- }
- }
- ts.flattenVariableDestructuringToExpression = flattenVariableDestructuringToExpression;
- function flattenDestructuring(root, value, location, emitAssignment, emitTempVariableAssignment, recordTempVariable, emitRestAssignment, transformRest, visitor) {
- if (value && visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
- }
- if (ts.isBinaryExpression(root)) {
- emitDestructuringAssignment(root.left, value, location);
- }
- else {
- emitBindingElement(root, value);
- }
- function emitDestructuringAssignment(bindingTarget, value, location) {
- // When emitting target = value use source map node to highlight, including any temporary assignments needed for this
- var target;
- if (ts.isShorthandPropertyAssignment(bindingTarget)) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.objectAssignmentInitializer, visitor, ts.isExpression)
- : bindingTarget.objectAssignmentInitializer;
- if (initializer) {
- value = createDefaultValueCheck(value, initializer, location);
- }
- target = bindingTarget.name;
- }
- else if (ts.isBinaryExpression(bindingTarget) && bindingTarget.operatorToken.kind === 57 /* EqualsToken */) {
- var initializer = visitor
- ? ts.visitNode(bindingTarget.right, visitor, ts.isExpression)
- : bindingTarget.right;
- value = createDefaultValueCheck(value, initializer, location);
- target = bindingTarget.left;
- }
- else {
- target = bindingTarget;
- }
- if (target.kind === 176 /* ObjectLiteralExpression */) {
- emitObjectLiteralAssignment(target, value, location);
- }
- else if (target.kind === 175 /* ArrayLiteralExpression */) {
- emitArrayLiteralAssignment(target, value, location);
+ function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
+ if (!skipInitializer) {
+ var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
+ if (initializer) {
+ // Combine value and initializer
+ value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer;
}
- else {
- var name_30 = ts.getMutableClone(target);
- ts.setSourceMapRange(name_30, target);
- ts.setCommentRange(name_30, target);
- emitAssignment(name_30, value, location, /*original*/ undefined);
+ else if (!value) {
+ // Use 'void 0' in absence of value and initializer
+ value = ts.createVoidZero();
}
}
- function emitObjectLiteralAssignment(target, value, location) {
- var properties = target.properties;
- if (properties.length !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- var bindingElements = [];
- for (var i = 0; i < properties.length; i++) {
- var p = properties[i];
- if (p.kind === 257 /* PropertyAssignment */ || p.kind === 258 /* ShorthandPropertyAssignment */) {
- if (!transformRest ||
- p.transformFlags & 8388608 /* ContainsSpreadExpression */ ||
- (p.kind === 257 /* PropertyAssignment */ && p.initializer.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.name;
- var bindingTarget = p.kind === 258 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName;
- // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
- emitDestructuringAssignment(bindingTarget, createDestructuringPropertyAccess(value, propName), p);
- }
- else {
- bindingElements.push(p);
- }
- }
- else if (i === properties.length - 1 &&
- p.kind === 259 /* SpreadAssignment */ &&
- p.expression.kind === 70 /* Identifier */) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
- var propName = p.expression;
- var restCall = createRestCall(value, target.properties, function (p) { return p.name; }, target);
- emitDestructuringAssignment(propName, restCall, p);
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, location, target);
- bindingElements = [];
- }
+ var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
+ if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
+ flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitArrayLiteralAssignment(target, value, location) {
- if (transformRest) {
- emitESNextArrayLiteralAssignment(target, value, location);
- }
- else {
- emitES2015ArrayLiteralAssignment(target, value, location);
- }
+ else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
+ flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
}
- function emitESNextArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- var expressions = [];
- var spreadContainingExpressions = [];
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind === 198 /* OmittedExpression */) {
- continue;
- }
- if (e.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
- var tmp = ts.createTempVariable(recordTempVariable);
- spreadContainingExpressions.push([e, tmp]);
- expressions.push(tmp);
+ else {
+ flattenContext.emitBindingOrAssignment(bindingTarget, value, location, /*original*/ element);
+ }
+ }
+ /**
+ * Flattens an ObjectBindingOrAssignmentPattern into zero or more bindings or assignments.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param parent The parent element of the pattern.
+ * @param pattern The ObjectBindingOrAssignmentPattern to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ */
+ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1) {
+ // For anything other than a single-element destructuring we need to generate a temporary
+ // to ensure value is evaluated exactly once. Additionally, if we have zero elements
+ // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
+ // so in that case, we'll intentionally create that temporary.
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var computedTempVariables;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
+ if (flattenContext.level >= 1 /* ObjectRest */
+ && !(element.transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))
+ && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (524288 /* ContainsRest */ | 1048576 /* ContainsObjectRest */))
+ && !ts.isComputedPropertyName(propertyName)) {
+ bindingElements = ts.append(bindingElements, element);
}
else {
- expressions.push(e);
- }
- }
- emitAssignment(ts.updateArrayLiteral(target, expressions), value, undefined, undefined);
- for (var _i = 0, spreadContainingExpressions_1 = spreadContainingExpressions; _i < spreadContainingExpressions_1.length; _i++) {
- var _a = spreadContainingExpressions_1[_i], e = _a[0], tmp = _a[1];
- emitDestructuringAssignment(e, tmp, e);
- }
- }
- function emitES2015ArrayLiteralAssignment(target, value, location) {
- var elements = target.elements;
- var numElements = elements.length;
- if (numElements !== 1) {
- // For anything but a single element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once.
- // When doing so we want to highlight the passed-in source map node since thats the one needing this temp assignment
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- }
- for (var i = 0; i < numElements; i++) {
- var e = elements[i];
- if (e.kind !== 198 /* OmittedExpression */) {
- // Assignment for target = value.propName should highligh whole property, hence use e as source map node
- if (e.kind !== 196 /* SpreadElement */) {
- emitDestructuringAssignment(e, ts.createElementAccess(value, ts.createLiteral(i)), e);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- else if (i === numElements - 1) {
- emitDestructuringAssignment(e.expression, ts.createArraySlice(value, i), e);
+ var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
+ if (ts.isComputedPropertyName(propertyName)) {
+ computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
}
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
}
- }
- /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
- * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
- function createRestCall(value, elements, getPropertyName, location) {
- var propertyNames = [];
- for (var i = 0; i < elements.length - 1; i++) {
- if (ts.isOmittedExpression(elements[i])) {
- continue;
+ else if (i === numElements - 1) {
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ bindingElements = undefined;
}
- var str = ts.createSynthesizedNode(9 /* StringLiteral */);
- str.pos = location.pos;
- str.end = location.end;
- str.text = ts.getTextOfPropertyName(getPropertyName(elements[i]));
- propertyNames.push(str);
+ var rhsValue = createRestCall(flattenContext.context, value, elements, computedTempVariables, pattern);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
}
- var args = ts.createSynthesizedNodeArray([value, ts.createArrayLiteral(propertyNames, location)]);
- return ts.createCall(ts.createIdentifier("__rest"), undefined, args);
}
- function emitBindingElement(target, value) {
- // Any temporary assignments needed to emit target = value should point to target
- var initializer = visitor ? ts.visitNode(target.initializer, visitor, ts.isExpression) : target.initializer;
- if (transformRest) {
- value = value || initializer;
- }
- else if (initializer) {
- // Combine value and initializer
- value = value ? createDefaultValueCheck(value, initializer, target) : initializer;
- }
- else if (!value) {
- // Use 'void 0' in absence of value and initializer
- value = ts.createVoidZero();
- }
- var name = target.name;
- if (!ts.isBindingPattern(name)) {
- emitAssignment(name, value, target, target);
- }
- else {
- var numElements = name.elements.length;
- if (numElements !== 1) {
- // For anything other than a single-element destructuring we need to generate a temporary
- // to ensure value is evaluated exactly once. Additionally, if we have zero elements
- // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
- // so in that case, we'll intentionally create that temporary.
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target, emitTempVariableAssignment);
- }
- if (name.kind === 173 /* ArrayBindingPattern */) {
- emitArrayBindingElement(name, value);
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
+ }
+ }
+ /**
+ * Flattens an ArrayBindingOrAssignmentPattern into zero or more bindings or assignments.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param parent The parent element of the pattern.
+ * @param pattern The ArrayBindingOrAssignmentPattern to flatten.
+ * @param value The current RHS value to assign to the element.
+ * @param location The location to use for source maps and comments.
+ */
+ function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
+ var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
+ var numElements = elements.length;
+ if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) {
+ // For anything other than a single-element destructuring we need to generate a temporary
+ // to ensure value is evaluated exactly once. Additionally, if we have zero elements
+ // we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
+ // so in that case, we'll intentionally create that temporary.
+ var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
+ value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
+ }
+ var bindingElements;
+ var restContainingElements;
+ for (var i = 0; i < numElements; i++) {
+ var element = elements[i];
+ if (flattenContext.level >= 1 /* ObjectRest */) {
+ // If an array pattern contains an ObjectRest, we must cache the result so that we
+ // can perform the ObjectRest destructuring in a different declaration
+ if (element.transformFlags & 1048576 /* ContainsObjectRest */) {
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ }
+ restContainingElements = ts.append(restContainingElements, [temp, element]);
+ bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
}
else {
- emitObjectBindingElement(target, value);
+ bindingElements = ts.append(bindingElements, element);
}
}
- }
- function emitArrayBindingElement(name, value) {
- if (transformRest) {
- emitESNextArrayBindingElement(name, value);
+ else if (ts.isOmittedExpression(element)) {
+ continue;
}
- else {
- emitES2015ArrayBindingElement(name, value);
+ else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
+ var rhsValue = ts.createElementAccess(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
- }
- function emitES2015ArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (!element.dotDotDotToken) {
- // Rewrite element to a declaration that accesses array element at index i
- emitBindingElement(element, ts.createElementAccess(value, i));
- }
- else if (i === numElements - 1) {
- emitBindingElement(element, ts.createArraySlice(value, i));
- }
+ else if (i === numElements - 1) {
+ var rhsValue = ts.createArraySlice(value, i);
+ flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element);
}
}
- function emitESNextArrayBindingElement(name, value) {
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- var spreadContainingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (element.transformFlags & 8388608 /* ContainsSpreadExpression */ && i < numElements - 1) {
- spreadContainingElements.push(element);
- bindingElements.push(ts.createBindingElement(undefined, undefined, ts.getGeneratedNameForNode(element), undefined, value));
- }
- else {
- bindingElements.push(element);
- }
- }
- emitAssignment(ts.updateArrayBindingPattern(name, bindingElements), value, undefined, undefined);
- for (var _i = 0, spreadContainingElements_1 = spreadContainingElements; _i < spreadContainingElements_1.length; _i++) {
- var element = spreadContainingElements_1[_i];
- emitBindingElement(element, ts.getGeneratedNameForNode(element));
- }
+ if (bindingElements) {
+ flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
}
- function emitObjectBindingElement(target, value) {
- var name = target.name;
- var elements = name.elements;
- var numElements = elements.length;
- var bindingElements = [];
- for (var i = 0; i < numElements; i++) {
- var element = elements[i];
- if (ts.isOmittedExpression(element)) {
- continue;
- }
- if (i === numElements - 1 && element.dotDotDotToken) {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- var restCall = createRestCall(value, name.elements, function (element) { return element.propertyName || element.name; }, name);
- emitBindingElement(element, restCall);
- }
- else if (transformRest && !(element.transformFlags & 8388608 /* ContainsSpreadExpression */)) {
- // do not emit until we have a complete bundle of ES2015 syntax
- bindingElements.push(element);
- }
- else {
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
- }
- // Rewrite element to a declaration with an initializer that fetches property
- var propName = element.propertyName || element.name;
- emitBindingElement(element, createDestructuringPropertyAccess(value, propName));
- }
- }
- if (bindingElements.length) {
- emitRestAssignment(bindingElements, value, target, target);
- bindingElements = [];
+ if (restContainingElements) {
+ for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
+ var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
+ flattenBindingOrAssignmentElement(flattenContext, element, id, element);
}
}
- function createDefaultValueCheck(value, defaultValue, location) {
- value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
- return ts.createConditional(ts.createStrictEquality(value, ts.createVoidZero()), ts.createToken(54 /* QuestionToken */), defaultValue, ts.createToken(55 /* ColonToken */), value);
+ }
+ /**
+ * Creates an expression used to provide a default value if a value is `undefined` at runtime.
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param value The RHS value to test.
+ * @param defaultValue The default value to use if `value` is `undefined` at runtime.
+ * @param location The location to use for source maps and comments.
+ */
+ function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
+ value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);
+ return ts.createConditional(ts.createTypeCheck(value, "undefined"), defaultValue, value);
+ }
+ /**
+ * Creates either a PropertyAccessExpression or an ElementAccessExpression for the
+ * right-hand side of a transformed destructuring assignment.
+ *
+ * @link https://tc39.github.io/ecma262/#sec-runtime-semantics-keyeddestructuringassignmentevaluation
+ *
+ * @param flattenContext Options used to control flattening.
+ * @param value The RHS value that is the source of the property.
+ * @param propertyName The destructuring property name.
+ */
+ function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var argumentExpression = ensureIdentifier(flattenContext, propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName);
+ return ts.createElementAccess(value, argumentExpression);
}
- /**
- * Creates either a PropertyAccessExpression or an ElementAccessExpression for the
- * right-hand side of a transformed destructuring assignment.
- *
- * @param expression The right-hand expression that is the source of the property.
- * @param propertyName The destructuring property name.
- */
- function createDestructuringPropertyAccess(expression, propertyName) {
- if (ts.isComputedPropertyName(propertyName)) {
- return ts.createElementAccess(expression, ensureIdentifier(propertyName.expression, /*reuseIdentifierExpressions*/ false, /*location*/ propertyName, emitTempVariableAssignment));
- }
- else if (ts.isLiteralExpression(propertyName)) {
- var clone_2 = ts.getSynthesizedClone(propertyName);
- clone_2.text = ts.unescapeIdentifier(clone_2.text);
- return ts.createElementAccess(expression, clone_2);
- }
- else {
- if (ts.isGeneratedIdentifier(propertyName)) {
- var clone_3 = ts.getSynthesizedClone(propertyName);
- clone_3.text = ts.unescapeIdentifier(clone_3.text);
- return ts.createPropertyAccess(expression, clone_3);
- }
- else {
- return ts.createPropertyAccess(expression, ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)));
- }
- }
+ else if (ts.isStringOrNumericLiteral(propertyName)) {
+ var argumentExpression = ts.getSynthesizedClone(propertyName);
+ argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text);
+ return ts.createElementAccess(value, argumentExpression);
+ }
+ else {
+ var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text));
+ return ts.createPropertyAccess(value, name_30);
}
}
/**
@@ -44872,23 +45038,74 @@ var ts;
* This function is useful to ensure that the expression's value can be read from in subsequent expressions.
* Unless 'reuseIdentifierExpressions' is false, 'value' will be returned if it is just an identifier.
*
+ * @param flattenContext Options used to control flattening.
* @param value the expression whose value needs to be bound.
* @param reuseIdentifierExpressions true if identifier expressions can simply be returned;
- * false if it is necessary to always emit an identifier.
+ * false if it is necessary to always emit an identifier.
* @param location The location to use for source maps and comments.
- * @param emitTempVariableAssignment A callback used to emit a temporary variable.
- * @param visitor An optional callback used to visit the value.
*/
- function ensureIdentifier(value, reuseIdentifierExpressions, location, emitTempVariableAssignment, visitor) {
+ function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
return value;
}
else {
- if (visitor) {
- value = ts.visitNode(value, visitor, ts.isExpression);
+ var temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ if (flattenContext.hoistTempVariables) {
+ flattenContext.context.hoistVariableDeclaration(temp);
+ flattenContext.emitExpression(ts.createAssignment(temp, value, location));
+ }
+ else {
+ flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined);
+ }
+ return temp;
+ }
+ }
+ function makeArrayBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
+ return ts.createArrayBindingPattern(elements);
+ }
+ function makeArrayAssignmentPattern(elements) {
+ return ts.createArrayLiteral(ts.map(elements, ts.convertToArrayAssignmentElement));
+ }
+ function makeObjectBindingPattern(elements) {
+ ts.Debug.assertEachNode(elements, ts.isBindingElement);
+ return ts.createObjectBindingPattern(elements);
+ }
+ function makeObjectAssignmentPattern(elements) {
+ return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement));
+ }
+ function makeBindingElement(name) {
+ return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name);
+ }
+ function makeAssignmentElement(name) {
+ return name;
+ }
+ var restHelper = {
+ name: "typescript:rest",
+ scoped: false,
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ };
+ /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
+ * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/
+ function createRestCall(context, value, elements, computedTempVariables, location) {
+ context.requestEmitHelper(restHelper);
+ var propertyNames = [];
+ var computedTempVariableOffset = 0;
+ for (var i = 0; i < elements.length - 1; i++) {
+ var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
+ if (propertyName) {
+ if (ts.isComputedPropertyName(propertyName)) {
+ var temp = computedTempVariables[computedTempVariableOffset];
+ computedTempVariableOffset++;
+ // typeof _tmp === "symbol" ? _tmp : _tmp + ""
+ propertyNames.push(ts.createConditional(ts.createTypeCheck(temp, "symbol"), temp, ts.createAdd(temp, ts.createLiteral(""))));
+ }
+ else {
+ propertyNames.push(ts.createLiteral(propertyName));
+ }
}
- return emitTempVariableAssignment(value, location);
}
+ return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]);
}
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
@@ -44911,7 +45128,7 @@ var ts;
TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers";
})(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {}));
function transformTypeScript(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
@@ -44931,7 +45148,6 @@ var ts;
var currentNamespaceContainerName;
var currentScope;
var currentScopeFirstDeclarationsOfName;
- var currentExternalHelpersModuleName;
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
* They are persisted between each SourceFile transformation and should not be reset.
@@ -44957,7 +45173,11 @@ var ts;
if (ts.isDeclarationFile(node)) {
return node;
}
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ currentSourceFile = node;
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
/**
* Visits a node, saving and restoring state variables on the stack.
@@ -44979,6 +45199,29 @@ var ts;
return visited;
}
/**
+ * Performs actions that should always occur immediately before visiting a node.
+ *
+ * @param node The node to visit.
+ */
+ function onBeforeVisitNode(node) {
+ switch (node.kind) {
+ case 261 /* SourceFile */:
+ case 232 /* CaseBlock */:
+ case 231 /* ModuleBlock */:
+ case 204 /* Block */:
+ currentScope = node;
+ currentScopeFirstDeclarationsOfName = undefined;
+ break;
+ case 226 /* ClassDeclaration */:
+ case 225 /* FunctionDeclaration */:
+ if (ts.hasModifier(node, 2 /* Ambient */)) {
+ break;
+ }
+ recordEmittedDeclarationInScope(node);
+ break;
+ }
+ }
+ /**
* General-purpose node visitor.
*
* @param node The node to visit.
@@ -44992,10 +45235,7 @@ var ts;
* @param node The node to visit.
*/
function visitorWorker(node) {
- if (node.kind === 261 /* SourceFile */) {
- return visitSourceFile(node);
- }
- else if (node.transformFlags & 1 /* TypeScript */) {
+ if (node.transformFlags & 1 /* TypeScript */) {
// This node is explicitly marked as TypeScript, so we should transform the node.
return visitTypeScript(node);
}
@@ -45265,67 +45505,9 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- /**
- * Performs actions that should always occur immediately before visiting a node.
- *
- * @param node The node to visit.
- */
- function onBeforeVisitNode(node) {
- switch (node.kind) {
- case 261 /* SourceFile */:
- case 232 /* CaseBlock */:
- case 231 /* ModuleBlock */:
- case 204 /* Block */:
- currentScope = node;
- currentScopeFirstDeclarationsOfName = undefined;
- break;
- case 226 /* ClassDeclaration */:
- case 225 /* FunctionDeclaration */:
- if (ts.hasModifier(node, 2 /* Ambient */)) {
- break;
- }
- recordEmittedDeclarationInScope(node);
- break;
- }
- }
function visitSourceFile(node) {
- currentSourceFile = node;
- // ensure "use strict" is emitted in all scenarios in alwaysStrict mode
- // There is no need to emit "use strict" in the following cases:
- // 1. The file is an external module and target is es2015 or higher
- // or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower
- if (compilerOptions.alwaysStrict &&
- !(ts.isExternalModule(node) && (compilerOptions.target >= 2 /* ES2015 */ || compilerOptions.module === ts.ModuleKind.ES2015))) {
- node = ts.ensureUseStrict(node);
- }
- // If the source file requires any helpers and is an external module, and
- // the importHelpers compiler option is enabled, emit a synthesized import
- // statement for the helpers library.
- if (node.flags & 64512 /* EmitHelperFlags */
- && compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- startLexicalEnvironment();
- var statements = [];
- var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor);
- var externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText);
- var externalHelpersModuleImport = ts.createImportDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText));
- externalHelpersModuleImport.parent = node;
- externalHelpersModuleImport.flags &= ~8 /* Synthesized */;
- statements.push(externalHelpersModuleImport);
- currentExternalHelpersModuleName = externalHelpersModuleName;
- ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
- ts.addRange(statements, endLexicalEnvironment());
- currentExternalHelpersModuleName = undefined;
- node = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
- node.externalHelpersModuleName = externalHelpersModuleName;
- }
- else {
- node = ts.visitEachChild(node, sourceElementVisitor, context);
- }
- ts.setEmitFlags(node, 1 /* EmitEmitHelpers */ | ts.getEmitFlags(node));
- return node;
+ var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015);
+ return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));
}
/**
* Tests whether we should emit a __decorate call for a class declaration.
@@ -45402,7 +45584,7 @@ var ts;
if (statements.length > 1) {
// Add a DeclarationMarker as a marker for the end of the declaration
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 2097152 /* HasEndOfDeclarationMarker */);
}
return ts.singleOrMany(statements);
}
@@ -45425,7 +45607,7 @@ var ts;
// To better align with the old emitter, we should not emit a trailing source map
// entry if the class has static properties.
if (hasStaticProperties) {
- emitFlags |= 1024 /* NoTrailingSourceMap */;
+ emitFlags |= 32 /* NoTrailingSourceMap */;
}
ts.setOriginalNode(classDeclaration, node);
ts.setEmitFlags(classDeclaration, emitFlags);
@@ -45570,7 +45752,7 @@ var ts;
}
// To preserve the behavior of the old emitter, we explicitly indent
// the body of a class with static initializers.
- ts.setEmitFlags(classExpression, 524288 /* Indented */ | ts.getEmitFlags(classExpression));
+ ts.setEmitFlags(classExpression, 32768 /* Indented */ | ts.getEmitFlags(classExpression));
expressions.push(ts.startOnNewLine(ts.createAssignment(temp, classExpression)));
ts.addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp));
expressions.push(ts.startOnNewLine(temp));
@@ -45604,7 +45786,7 @@ var ts;
// If there is a property assignment, we need to emit constructor whether users define it or not
// If there is no property assignment, we can omit constructor if users do not define it
var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty);
- var hasParameterPropertyAssignments = node.transformFlags & 4194304 /* ContainsParameterPropertyAssignments */;
+ var hasParameterPropertyAssignments = node.transformFlags & 262144 /* ContainsParameterPropertyAssignments */;
var constructor = ts.getFirstConstructorWithBody(node);
// If the class does not contain nodes that require a synthesized constructor,
// accept the current constructor if it exists.
@@ -45644,9 +45826,8 @@ var ts;
// downlevel the '...args' portion less efficiently by naively copying the contents of 'arguments' to an array.
// Instead, we'll avoid using a rest parameter and spread into the super call as
// 'super(...arguments)' instead of 'super(...args)', as you can see in "transformConstructorBody".
- return constructor
- ? ts.visitNodes(constructor.parameters, visitor, ts.isParameter)
- : [];
+ return ts.visitParameterList(constructor && constructor.parameters, visitor, context)
+ || [];
}
/**
* Transforms (or creates) a constructor body for a class with parameter property
@@ -45659,8 +45840,7 @@ var ts;
function transformConstructorBody(node, constructor, hasExtendsClause) {
var statements = [];
var indexOfFirstStatement = 0;
- // The body of a constructor is a new lexical environment
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
if (constructor) {
indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements);
// Add parameters with property assignments. Transforms this:
@@ -45704,9 +45884,10 @@ var ts;
}
// End the lexical environment.
ts.addRange(statements, endLexicalEnvironment());
- return ts.setMultiLine(ts.createBlock(ts.createNodeArray(statements,
+ return ts.createBlock(ts.createNodeArray(statements,
/*location*/ constructor ? constructor.body.statements : node.members),
- /*location*/ constructor ? constructor.body : undefined), true);
+ /*location*/ constructor ? constructor.body : undefined,
+ /*multiLine*/ true);
}
/**
* Adds super call and preceding prologue directives into the list of statements.
@@ -45758,9 +45939,9 @@ var ts;
ts.Debug.assert(ts.isIdentifier(node.name));
var name = node.name;
var propertyName = ts.getMutableClone(name);
- ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 1536 /* NoSourceMap */);
+ ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */);
var localName = ts.getMutableClone(name);
- ts.setEmitFlags(localName, 49152 /* NoComments */);
+ ts.setEmitFlags(localName, 1536 /* NoComments */);
return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName,
/*location*/ node.name), localName),
/*location*/ ts.moveRangePos(node, -1)));
@@ -46072,13 +46253,13 @@ var ts;
// __metadata("design:type", Function),
// __metadata("design:paramtypes", [Object]),
// __metadata("design:returntype", void 0)
- // ], C.prototype, "method", undefined);
+ // ], C.prototype, "method", null);
//
// The emit for an accessor is:
//
// __decorate([
// dec
- // ], C.prototype, "accessor", undefined);
+ // ], C.prototype, "accessor", null);
//
// The emit for a property is:
//
@@ -46093,8 +46274,8 @@ var ts;
? ts.createVoidZero()
: ts.createNull()
: undefined;
- var helper = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
- ts.setEmitFlags(helper, 49152 /* NoComments */);
+ var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member));
+ ts.setEmitFlags(helper, 1536 /* NoComments */);
return helper;
}
/**
@@ -46121,9 +46302,9 @@ var ts;
}
var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true);
- var decorate = ts.createDecorateHelper(currentExternalHelpersModuleName, decoratorExpressions, localName);
+ var decorate = createDecorateHelper(context, decoratorExpressions, localName);
var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate);
- ts.setEmitFlags(expression, 49152 /* NoComments */);
+ ts.setEmitFlags(expression, 1536 /* NoComments */);
ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
return expression;
}
@@ -46147,9 +46328,9 @@ var ts;
expressions = [];
for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
var decorator = decorators_1[_i];
- var helper = ts.createParamHelper(currentExternalHelpersModuleName, transformDecorator(decorator), parameterOffset,
+ var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset,
/*location*/ decorator.expression);
- ts.setEmitFlags(helper, 49152 /* NoComments */);
+ ts.setEmitFlags(helper, 1536 /* NoComments */);
expressions.push(helper);
}
}
@@ -46172,13 +46353,13 @@ var ts;
function addOldTypeMetadata(node, decoratorExpressions) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
}
if (shouldAddReturnTypeMetadata(node)) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -46195,7 +46376,7 @@ var ts;
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node))));
}
if (properties) {
- decoratorExpressions.push(ts.createMetadataHelper(currentExternalHelpersModuleName, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
+ decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
}
}
}
@@ -46435,7 +46616,7 @@ var ts;
case ts.TypeReferenceSerializationKind.Unknown:
var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true);
var temp = ts.createTempVariable(hoistVariableDeclaration);
- return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictEquality(ts.createTypeOf(ts.createAssignment(temp, serialized)), ts.createLiteral("function")), temp), ts.createIdentifier("Object"));
+ return ts.createLogicalOr(ts.createLogicalAnd(ts.createTypeCheck(ts.createAssignment(temp, serialized), "function"), temp), ts.createIdentifier("Object"));
case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false);
case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
@@ -46511,7 +46692,7 @@ var ts;
* available.
*/
function getGlobalSymbolNameWithFallback() {
- return ts.createConditional(ts.createStrictEquality(ts.createTypeOf(ts.createIdentifier("Symbol")), ts.createLiteral("function")), ts.createToken(54 /* QuestionToken */), ts.createIdentifier("Symbol"), ts.createToken(55 /* ColonToken */), ts.createIdentifier("Object"));
+ return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
/**
* Gets an expression that represents a property name. For a computed property, a
@@ -46613,17 +46794,17 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
}
- var method = ts.createMethod(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ var updated = ts.updateMethod(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Determines whether to emit an accessor declaration. We should not emit the
@@ -46647,16 +46828,16 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createGetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateGetAccessor(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Visits a set accessor declaration of a class.
@@ -46671,15 +46852,15 @@ var ts;
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
}
- var accessor = ts.createSetAccessor(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitNodes(node.parameters, visitor, ts.isParameter), node.body ? ts.visitEachChild(node.body, visitor, context) : ts.createBlock([]),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setOriginalNode(accessor, node);
- ts.setCommentRange(accessor, node);
- ts.setSourceMapRange(accessor, ts.moveRangePastDecorators(node));
- return accessor;
+ var updated = ts.updateSetAccessor(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
+ if (updated !== node) {
+ // While we emit the source map for the node after skipping decorators and modifiers,
+ // we need to emit the comments for the original range.
+ ts.setCommentRange(updated, node);
+ ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
+ }
+ return updated;
}
/**
* Visits a function declaration.
@@ -46695,18 +46876,16 @@ var ts;
if (!shouldEmitFunctionLikeDeclaration(node)) {
return ts.createNotEmittedStatement(node);
}
- var func = ts.createFunctionDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
+ var updated = ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([]));
if (isNamespaceExport(node)) {
- var statements = [func];
+ var statements = [updated];
addExportMemberAssignment(statements, node);
return statements;
}
- return func;
+ return updated;
}
/**
* Visits a function expression node.
@@ -46720,12 +46899,10 @@ var ts;
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
/**
* @remarks
@@ -46733,51 +46910,10 @@ var ts;
* - The node has type annotations
*/
function visitArrowFunction(node) {
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformFunctionBodyWorker(node.body);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- currentScope = body;
- currentScopeFirstDeclarationsOfName = ts.createMap();
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- }
- function transformConciseBody(node) {
- return transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ false);
- }
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
- if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
- }
- else {
- startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
- var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
- }
+ var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context));
+ return updated;
}
/**
* Visits a parameter declaration node.
@@ -46804,7 +46940,7 @@ var ts;
ts.setOriginalNode(parameter, node);
ts.setCommentRange(parameter, node);
ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node));
- ts.setEmitFlags(parameter.name, 1024 /* NoTrailingSourceMap */);
+ ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */);
return parameter;
}
/**
@@ -46830,7 +46966,8 @@ var ts;
function transformInitializedVariable(node) {
var name = node.name;
if (ts.isBindingPattern(name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createNamespaceExportExpression, visitor);
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */,
+ /*needsValue*/ false, createNamespaceExportExpression);
}
else {
return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression),
@@ -46910,14 +47047,14 @@ var ts;
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
// us to set up the correct state for later substitutions.
- var emitFlags = 64 /* AdviseOnEmitNode */;
+ var emitFlags = 2 /* AdviseOnEmitNode */;
// If needed, we should emit a variable declaration for the enum. If we emit
// a leading variable declaration, we should not emit leading comments for the
// enum body.
if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384 /* NoLeadingComments */;
+ emitFlags |= 512 /* NoLeadingComments */;
}
}
// `parameterName` is the declaration name used inside of the enum.
@@ -47094,7 +47231,7 @@ var ts;
// })(m1 || (m1 = {})); // trailing comment module
//
ts.setCommentRange(statement, node);
- ts.setEmitFlags(statement, 32768 /* NoTrailingComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */);
statements.push(statement);
return true;
}
@@ -47104,7 +47241,7 @@ var ts;
// begin/end semantics of the declararation and to properly handle exports
// we wrap the leading variable declaration in a `MergeDeclarationMarker`.
var mergeMarker = ts.createMergeDeclarationMarker(statement);
- ts.setEmitFlags(mergeMarker, 49152 /* NoComments */ | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(mergeMarker, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */);
statements.push(mergeMarker);
return false;
}
@@ -47125,14 +47262,14 @@ var ts;
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
// us to set up the correct state for later substitutions.
- var emitFlags = 64 /* AdviseOnEmitNode */;
+ var emitFlags = 2 /* AdviseOnEmitNode */;
// If needed, we should emit a variable declaration for the module. If we emit
// a leading variable declaration, we should not emit leading comments for the
// module body.
if (addVarForEnumOrModuleDeclaration(statements, node)) {
// We should still emit the comments if we are emitting a system module.
if (moduleKind !== ts.ModuleKind.System || currentScope !== currentSourceFile) {
- emitFlags |= 16384 /* NoLeadingComments */;
+ emitFlags |= 512 /* NoLeadingComments */;
}
}
// `parameterName` is the declaration name used inside of the namespace.
@@ -47235,7 +47372,7 @@ var ts;
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
if (body.kind !== 231 /* ModuleBlock */) {
- ts.setEmitFlags(block, ts.getEmitFlags(block) | 49152 /* NoComments */);
+ ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
@@ -47384,7 +47521,7 @@ var ts;
return undefined;
}
var moduleReference = ts.createExpressionFromEntityName(node.moduleReference);
- ts.setEmitFlags(moduleReference, 49152 /* NoComments */ | 65536 /* NoNestedComments */);
+ ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */);
if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) {
// export var ${name} = ${moduleReference};
// var ${name} = ${moduleReference};
@@ -47602,10 +47739,10 @@ var ts;
if (declaration) {
var classAlias = classAliases[declaration.id];
if (classAlias) {
- var clone_4 = ts.getSynthesizedClone(classAlias);
- ts.setSourceMapRange(clone_4, node);
- ts.setCommentRange(clone_4, node);
- return clone_4;
+ var clone_2 = ts.getSynthesizedClone(classAlias);
+ ts.setSourceMapRange(clone_2, node);
+ ts.setCommentRange(clone_2, node);
+ return clone_2;
}
}
}
@@ -47614,7 +47751,7 @@ var ts;
}
function trySubstituteNamespaceExportedName(node) {
// If this is explicitly a local name, do not substitute.
- if (enabledSubstitutions & applicableSubstitutions && !ts.isLocalName(node)) {
+ if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
@@ -47661,13 +47798,335 @@ var ts;
}
}
ts.transformTypeScript = transformTypeScript;
+ var paramHelper = {
+ name: "typescript:param",
+ scoped: false,
+ priority: 4,
+ text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };"
+ };
+ function createParamHelper(context, expression, parameterOffset, location) {
+ context.requestEmitHelper(paramHelper);
+ return ts.createCall(ts.getHelperName("__param"),
+ /*typeArguments*/ undefined, [
+ ts.createLiteral(parameterOffset),
+ expression
+ ], location);
+ }
+ var metadataHelper = {
+ name: "typescript:metadata",
+ scoped: false,
+ priority: 3,
+ text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };"
+ };
+ function createMetadataHelper(context, metadataKey, metadataValue) {
+ context.requestEmitHelper(metadataHelper);
+ return ts.createCall(ts.getHelperName("__metadata"),
+ /*typeArguments*/ undefined, [
+ ts.createLiteral(metadataKey),
+ metadataValue
+ ]);
+ }
+ var decorateHelper = {
+ name: "typescript:decorate",
+ scoped: false,
+ priority: 2,
+ text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };"
+ };
+ function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) {
+ context.requestEmitHelper(decorateHelper);
+ var argumentsArray = [];
+ argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
+ argumentsArray.push(target);
+ if (memberName) {
+ argumentsArray.push(memberName);
+ if (descriptor) {
+ argumentsArray.push(descriptor);
+ }
+ }
+ return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
+ }
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
/*@internal*/
var ts;
(function (ts) {
- var entities = createEntitiesMap();
+ function transformESNext(context) {
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ return transformSourceFile;
+ function transformSourceFile(node) {
+ if (ts.isDeclarationFile(node)) {
+ return node;
+ }
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ return visited;
+ }
+ function visitor(node) {
+ return visitorWorker(node, /*noDestructuringValue*/ false);
+ }
+ function visitorNoDestructuringValue(node) {
+ return visitorWorker(node, /*noDestructuringValue*/ true);
+ }
+ function visitorWorker(node, noDestructuringValue) {
+ if ((node.transformFlags & 8 /* ContainsESNext */) === 0) {
+ return node;
+ }
+ switch (node.kind) {
+ case 176 /* ObjectLiteralExpression */:
+ return visitObjectLiteralExpression(node);
+ case 192 /* BinaryExpression */:
+ return visitBinaryExpression(node, noDestructuringValue);
+ case 223 /* VariableDeclaration */:
+ return visitVariableDeclaration(node);
+ case 213 /* ForOfStatement */:
+ return visitForOfStatement(node);
+ case 211 /* ForStatement */:
+ return visitForStatement(node);
+ case 188 /* VoidExpression */:
+ return visitVoidExpression(node);
+ case 150 /* Constructor */:
+ return visitConstructorDeclaration(node);
+ case 149 /* MethodDeclaration */:
+ return visitMethodDeclaration(node);
+ case 151 /* GetAccessor */:
+ return visitGetAccessorDeclaration(node);
+ case 152 /* SetAccessor */:
+ return visitSetAccessorDeclaration(node);
+ case 225 /* FunctionDeclaration */:
+ return visitFunctionDeclaration(node);
+ case 184 /* FunctionExpression */:
+ return visitFunctionExpression(node);
+ case 185 /* ArrowFunction */:
+ return visitArrowFunction(node);
+ case 144 /* Parameter */:
+ return visitParameter(node);
+ case 207 /* ExpressionStatement */:
+ return visitExpressionStatement(node);
+ case 183 /* ParenthesizedExpression */:
+ return visitParenthesizedExpression(node, noDestructuringValue);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function chunkObjectLiteralElements(elements) {
+ var chunkObject;
+ var objects = [];
+ for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
+ var e = elements_3[_i];
+ if (e.kind === 259 /* SpreadAssignment */) {
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ chunkObject = undefined;
+ }
+ var target = e.expression;
+ objects.push(ts.visitNode(target, visitor, ts.isExpression));
+ }
+ else {
+ if (!chunkObject) {
+ chunkObject = [];
+ }
+ if (e.kind === 257 /* PropertyAssignment */) {
+ var p = e;
+ chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
+ }
+ else {
+ chunkObject.push(e);
+ }
+ }
+ }
+ if (chunkObject) {
+ objects.push(ts.createObjectLiteral(chunkObject));
+ }
+ return objects;
+ }
+ function visitObjectLiteralExpression(node) {
+ if (node.transformFlags & 1048576 /* ContainsObjectSpread */) {
+ // spread elements emit like so:
+ // non-spread elements are chunked together into object literals, and then all are passed to __assign:
+ // { a, ...o, b } => __assign({a}, o, {b});
+ // If the first element is a spread element, then the first argument to __assign is {}:
+ // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
+ var objects = chunkObjectLiteralElements(node.properties);
+ if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) {
+ objects.unshift(ts.createObjectLiteral());
+ }
+ return createAssignHelper(context, objects);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitExpressionStatement(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ function visitParenthesizedExpression(node, noDestructuringValue) {
+ return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context);
+ }
+ /**
+ * Visits a BinaryExpression that contains a destructuring assignment.
+ *
+ * @param node A BinaryExpression node.
+ */
+ function visitBinaryExpression(node, noDestructuringValue) {
+ if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576 /* ContainsObjectRest */) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 1 /* ObjectRest */, !noDestructuringValue);
+ }
+ else if (node.operatorToken.kind === 25 /* CommaToken */) {
+ return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ /**
+ * Visits a VariableDeclaration node with a binding pattern.
+ *
+ * @param node A VariableDeclaration node.
+ */
+ function visitVariableDeclaration(node) {
+ // If we are here it is because the name contains a binding pattern with a rest somewhere in it.
+ if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576 /* ContainsObjectRest */) {
+ return ts.flattenDestructuringBinding(node, visitor, context, 1 /* ObjectRest */);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitForStatement(node) {
+ return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement));
+ }
+ function visitVoidExpression(node) {
+ return ts.visitEachChild(node, visitorNoDestructuringValue, context);
+ }
+ /**
+ * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.
+ *
+ * @param node A ForOfStatement.
+ */
+ function visitForOfStatement(node) {
+ var leadingStatements;
+ var temp;
+ var initializer = ts.skipParentheses(node.initializer);
+ if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) {
+ if (ts.isVariableDeclarationList(initializer)) {
+ temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var firstDeclaration = ts.firstOrUndefined(initializer.declarations);
+ var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp,
+ /*doNotRecordTempVariablesInLine*/ false,
+ /*skipInitializer*/ true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations),
+ /*location*/ initializer);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ else if (ts.isAssignmentPattern(initializer)) {
+ temp = ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */);
+ leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer));
+ }
+ }
+ if (temp) {
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ var block = ts.isBlock(statement)
+ ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements))
+ : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true);
+ return ts.updateForOf(node, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer)
+ ], node.initializer, 1 /* Let */), expression, block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitParameter(node) {
+ if (node.transformFlags & 1048576 /* ContainsObjectRest */) {
+ // Binding patterns are converted into a generated name and are
+ // evaluated inside the function body.
+ return ts.updateParameter(node,
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node),
+ /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
+ function visitConstructorDeclaration(node) {
+ return ts.updateConstructor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitGetAccessorDeclaration(node) {
+ return ts.updateGetAccessor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitSetAccessorDeclaration(node) {
+ return ts.updateSetAccessor(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
+ }
+ function visitMethodDeclaration(node) {
+ return ts.updateMethod(node,
+ /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitFunctionDeclaration(node) {
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitArrowFunction(node) {
+ return ts.updateArrowFunction(node, node.modifiers,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function visitFunctionExpression(node) {
+ return ts.updateFunctionExpression(node, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node));
+ }
+ function transformFunctionBody(node) {
+ resumeLexicalEnvironment();
+ var leadingStatements;
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1 /* ObjectRest */, temp,
+ /*doNotRecordTempVariablesInLine*/ false,
+ /*skipInitializer*/ true);
+ if (ts.some(declarations)) {
+ var statement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations));
+ ts.setEmitFlags(statement, 524288 /* CustomPrologue */);
+ leadingStatements = ts.append(leadingStatements, statement);
+ }
+ }
+ }
+ var body = ts.visitNode(node.body, visitor, ts.isConciseBody);
+ var trailingStatements = endLexicalEnvironment();
+ if (ts.some(leadingStatements) || ts.some(trailingStatements)) {
+ var block = ts.convertToFunctionBody(body, /*multiLine*/ true);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
+ }
+ return body;
+ }
+ }
+ ts.transformESNext = transformESNext;
+ var assignHelper = {
+ name: "typescript:assign",
+ scoped: false,
+ priority: 1,
+ text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
+ };
+ function createAssignHelper(context, attributesSegments) {
+ context.requestEmitHelper(assignHelper);
+ return ts.createCall(ts.getHelperName("__assign"),
+ /*typeArguments*/ undefined, attributesSegments);
+ }
+ ts.createAssignHelper = createAssignHelper;
+})(ts || (ts = {}));
+/// <reference path="../factory.ts" />
+/// <reference path="../visitor.ts" />
+/// <reference path="./esnext.ts" />
+/*@internal*/
+var ts;
+(function (ts) {
function transformJsx(context) {
var compilerOptions = context.getCompilerOptions();
var currentSourceFile;
@@ -47682,17 +48141,15 @@ var ts;
return node;
}
currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined;
- return node;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 4 /* Jsx */) {
+ if (node.transformFlags & 4 /* ContainsJsx */) {
return visitorWorker(node);
}
- else if (node.transformFlags & 8 /* ContainsJsx */) {
- return ts.visitEachChild(node, visitor, context);
- }
else {
return node;
}
@@ -47706,8 +48163,7 @@ var ts;
case 252 /* JsxExpression */:
return visitJsxExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return undefined;
+ return ts.visitEachChild(node, visitor, context);
}
}
function transformJsxChildToExpression(node) {
@@ -47752,8 +48208,10 @@ var ts;
}
// Either emit one big object literal (no spread attribs), or
// a call to the __assign helper.
- objectProperties = ts.singleOrUndefined(segments)
- || ts.createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
+ objectProperties = ts.singleOrUndefined(segments);
+ if (!objectProperties) {
+ objectProperties = ts.createAssignHelper(context, segments);
+ }
}
var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location);
if (isChild) {
@@ -47891,519 +48349,285 @@ var ts;
}
}
ts.transformJsx = transformJsx;
- function createEntitiesMap() {
- return ts.createMap({
- "quot": 0x0022,
- "amp": 0x0026,
- "apos": 0x0027,
- "lt": 0x003C,
- "gt": 0x003E,
- "nbsp": 0x00A0,
- "iexcl": 0x00A1,
- "cent": 0x00A2,
- "pound": 0x00A3,
- "curren": 0x00A4,
- "yen": 0x00A5,
- "brvbar": 0x00A6,
- "sect": 0x00A7,
- "uml": 0x00A8,
- "copy": 0x00A9,
- "ordf": 0x00AA,
- "laquo": 0x00AB,
- "not": 0x00AC,
- "shy": 0x00AD,
- "reg": 0x00AE,
- "macr": 0x00AF,
- "deg": 0x00B0,
- "plusmn": 0x00B1,
- "sup2": 0x00B2,
- "sup3": 0x00B3,
- "acute": 0x00B4,
- "micro": 0x00B5,
- "para": 0x00B6,
- "middot": 0x00B7,
- "cedil": 0x00B8,
- "sup1": 0x00B9,
- "ordm": 0x00BA,
- "raquo": 0x00BB,
- "frac14": 0x00BC,
- "frac12": 0x00BD,
- "frac34": 0x00BE,
- "iquest": 0x00BF,
- "Agrave": 0x00C0,
- "Aacute": 0x00C1,
- "Acirc": 0x00C2,
- "Atilde": 0x00C3,
- "Auml": 0x00C4,
- "Aring": 0x00C5,
- "AElig": 0x00C6,
- "Ccedil": 0x00C7,
- "Egrave": 0x00C8,
- "Eacute": 0x00C9,
- "Ecirc": 0x00CA,
- "Euml": 0x00CB,
- "Igrave": 0x00CC,
- "Iacute": 0x00CD,
- "Icirc": 0x00CE,
- "Iuml": 0x00CF,
- "ETH": 0x00D0,
- "Ntilde": 0x00D1,
- "Ograve": 0x00D2,
- "Oacute": 0x00D3,
- "Ocirc": 0x00D4,
- "Otilde": 0x00D5,
- "Ouml": 0x00D6,
- "times": 0x00D7,
- "Oslash": 0x00D8,
- "Ugrave": 0x00D9,
- "Uacute": 0x00DA,
- "Ucirc": 0x00DB,
- "Uuml": 0x00DC,
- "Yacute": 0x00DD,
- "THORN": 0x00DE,
- "szlig": 0x00DF,
- "agrave": 0x00E0,
- "aacute": 0x00E1,
- "acirc": 0x00E2,
- "atilde": 0x00E3,
- "auml": 0x00E4,
- "aring": 0x00E5,
- "aelig": 0x00E6,
- "ccedil": 0x00E7,
- "egrave": 0x00E8,
- "eacute": 0x00E9,
- "ecirc": 0x00EA,
- "euml": 0x00EB,
- "igrave": 0x00EC,
- "iacute": 0x00ED,
- "icirc": 0x00EE,
- "iuml": 0x00EF,
- "eth": 0x00F0,
- "ntilde": 0x00F1,
- "ograve": 0x00F2,
- "oacute": 0x00F3,
- "ocirc": 0x00F4,
- "otilde": 0x00F5,
- "ouml": 0x00F6,
- "divide": 0x00F7,
- "oslash": 0x00F8,
- "ugrave": 0x00F9,
- "uacute": 0x00FA,
- "ucirc": 0x00FB,
- "uuml": 0x00FC,
- "yacute": 0x00FD,
- "thorn": 0x00FE,
- "yuml": 0x00FF,
- "OElig": 0x0152,
- "oelig": 0x0153,
- "Scaron": 0x0160,
- "scaron": 0x0161,
- "Yuml": 0x0178,
- "fnof": 0x0192,
- "circ": 0x02C6,
- "tilde": 0x02DC,
- "Alpha": 0x0391,
- "Beta": 0x0392,
- "Gamma": 0x0393,
- "Delta": 0x0394,
- "Epsilon": 0x0395,
- "Zeta": 0x0396,
- "Eta": 0x0397,
- "Theta": 0x0398,
- "Iota": 0x0399,
- "Kappa": 0x039A,
- "Lambda": 0x039B,
- "Mu": 0x039C,
- "Nu": 0x039D,
- "Xi": 0x039E,
- "Omicron": 0x039F,
- "Pi": 0x03A0,
- "Rho": 0x03A1,
- "Sigma": 0x03A3,
- "Tau": 0x03A4,
- "Upsilon": 0x03A5,
- "Phi": 0x03A6,
- "Chi": 0x03A7,
- "Psi": 0x03A8,
- "Omega": 0x03A9,
- "alpha": 0x03B1,
- "beta": 0x03B2,
- "gamma": 0x03B3,
- "delta": 0x03B4,
- "epsilon": 0x03B5,
- "zeta": 0x03B6,
- "eta": 0x03B7,
- "theta": 0x03B8,
- "iota": 0x03B9,
- "kappa": 0x03BA,
- "lambda": 0x03BB,
- "mu": 0x03BC,
- "nu": 0x03BD,
- "xi": 0x03BE,
- "omicron": 0x03BF,
- "pi": 0x03C0,
- "rho": 0x03C1,
- "sigmaf": 0x03C2,
- "sigma": 0x03C3,
- "tau": 0x03C4,
- "upsilon": 0x03C5,
- "phi": 0x03C6,
- "chi": 0x03C7,
- "psi": 0x03C8,
- "omega": 0x03C9,
- "thetasym": 0x03D1,
- "upsih": 0x03D2,
- "piv": 0x03D6,
- "ensp": 0x2002,
- "emsp": 0x2003,
- "thinsp": 0x2009,
- "zwnj": 0x200C,
- "zwj": 0x200D,
- "lrm": 0x200E,
- "rlm": 0x200F,
- "ndash": 0x2013,
- "mdash": 0x2014,
- "lsquo": 0x2018,
- "rsquo": 0x2019,
- "sbquo": 0x201A,
- "ldquo": 0x201C,
- "rdquo": 0x201D,
- "bdquo": 0x201E,
- "dagger": 0x2020,
- "Dagger": 0x2021,
- "bull": 0x2022,
- "hellip": 0x2026,
- "permil": 0x2030,
- "prime": 0x2032,
- "Prime": 0x2033,
- "lsaquo": 0x2039,
- "rsaquo": 0x203A,
- "oline": 0x203E,
- "frasl": 0x2044,
- "euro": 0x20AC,
- "image": 0x2111,
- "weierp": 0x2118,
- "real": 0x211C,
- "trade": 0x2122,
- "alefsym": 0x2135,
- "larr": 0x2190,
- "uarr": 0x2191,
- "rarr": 0x2192,
- "darr": 0x2193,
- "harr": 0x2194,
- "crarr": 0x21B5,
- "lArr": 0x21D0,
- "uArr": 0x21D1,
- "rArr": 0x21D2,
- "dArr": 0x21D3,
- "hArr": 0x21D4,
- "forall": 0x2200,
- "part": 0x2202,
- "exist": 0x2203,
- "empty": 0x2205,
- "nabla": 0x2207,
- "isin": 0x2208,
- "notin": 0x2209,
- "ni": 0x220B,
- "prod": 0x220F,
- "sum": 0x2211,
- "minus": 0x2212,
- "lowast": 0x2217,
- "radic": 0x221A,
- "prop": 0x221D,
- "infin": 0x221E,
- "ang": 0x2220,
- "and": 0x2227,
- "or": 0x2228,
- "cap": 0x2229,
- "cup": 0x222A,
- "int": 0x222B,
- "there4": 0x2234,
- "sim": 0x223C,
- "cong": 0x2245,
- "asymp": 0x2248,
- "ne": 0x2260,
- "equiv": 0x2261,
- "le": 0x2264,
- "ge": 0x2265,
- "sub": 0x2282,
- "sup": 0x2283,
- "nsub": 0x2284,
- "sube": 0x2286,
- "supe": 0x2287,
- "oplus": 0x2295,
- "otimes": 0x2297,
- "perp": 0x22A5,
- "sdot": 0x22C5,
- "lceil": 0x2308,
- "rceil": 0x2309,
- "lfloor": 0x230A,
- "rfloor": 0x230B,
- "lang": 0x2329,
- "rang": 0x232A,
- "loz": 0x25CA,
- "spades": 0x2660,
- "clubs": 0x2663,
- "hearts": 0x2665,
- "diams": 0x2666
- });
- }
-})(ts || (ts = {}));
-/// <reference path="../factory.ts" />
-/// <reference path="../visitor.ts" />
-/*@internal*/
-var ts;
-(function (ts) {
- function transformESNext(context) {
- var hoistVariableDeclaration = context.hoistVariableDeclaration;
- var currentSourceFile;
- return transformSourceFile;
- function transformSourceFile(node) {
- currentSourceFile = node;
- return ts.visitEachChild(node, visitor, context);
- }
- function visitor(node) {
- if (node.transformFlags & 16 /* ESNext */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 32 /* ContainsESNext */) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
- return node;
- }
- }
- function visitorWorker(node) {
- switch (node.kind) {
- case 176 /* ObjectLiteralExpression */:
- return visitObjectLiteralExpression(node);
- case 192 /* BinaryExpression */:
- return visitBinaryExpression(node);
- case 223 /* VariableDeclaration */:
- return visitVariableDeclaration(node);
- case 213 /* ForOfStatement */:
- return visitForOfStatement(node);
- case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- return node;
- case 225 /* FunctionDeclaration */:
- return visitFunctionDeclaration(node);
- case 184 /* FunctionExpression */:
- return visitFunctionExpression(node);
- case 185 /* ArrowFunction */:
- return visitArrowFunction(node);
- case 144 /* Parameter */:
- return visitParameter(node);
- default:
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
- }
- }
- function chunkObjectLiteralElements(elements) {
- var chunkObject;
- var objects = [];
- for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
- var e = elements_3[_i];
- if (e.kind === 259 /* SpreadAssignment */) {
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- chunkObject = undefined;
- }
- var target = e.expression;
- objects.push(ts.visitNode(target, visitor, ts.isExpression));
- }
- else {
- if (!chunkObject) {
- chunkObject = [];
- }
- if (e.kind === 257 /* PropertyAssignment */) {
- var p = e;
- chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression)));
- }
- else {
- chunkObject.push(e);
- }
- }
- }
- if (chunkObject) {
- objects.push(ts.createObjectLiteral(chunkObject));
- }
- return objects;
- }
- function visitObjectLiteralExpression(node) {
- // spread elements emit like so:
- // non-spread elements are chunked together into object literals, and then all are passed to __assign:
- // { a, ...o, b } => __assign({a}, o, {b});
- // If the first element is a spread element, then the first argument to __assign is {}:
- // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
- if (ts.forEach(node.properties, function (p) { return p.kind === 259 /* SpreadAssignment */; })) {
- var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) {
- objects.unshift(ts.createObjectLiteral());
- }
- return ts.aggregateTransformFlags(ts.createCall(ts.createIdentifier("__assign"), undefined, objects));
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a BinaryExpression that contains a destructuring assignment.
- *
- * @param node A BinaryExpression node.
- */
- function visitBinaryExpression(node) {
- if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 48 /* AssertESNext */) {
- return ts.flattenDestructuringAssignment(context, node, /*needsDestructuringValue*/ true, hoistVariableDeclaration, visitor, /*transformRest*/ true);
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a VariableDeclaration node with a binding pattern.
- *
- * @param node A VariableDeclaration node.
- */
- function visitVariableDeclaration(node) {
- // If we are here it is because the name contains a binding pattern with a rest somewhere in it.
- if (ts.isBindingPattern(node.name) && node.name.transformFlags & 48 /* AssertESNext */) {
- var result = ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, /*recordTempVariable*/ undefined, /*transformRest*/ true);
- return result;
- }
- return ts.visitEachChild(node, visitor, context);
- }
- /**
- * Visits a ForOfStatement and converts it into a ES2015-compatible ForOfStatement.
- *
- * @param node A ForOfStatement.
- */
- function visitForOfStatement(node) {
- // The following ESNext code:
- //
- // for (let { x, y, ...rest } of expr) { }
- //
- // should be emitted as
- //
- // for (var _a of expr) {
- // let { x, y } = _a, rest = __rest(_a, ["x", "y"]);
- // }
- //
- // where _a is a temp emitted to capture the RHS.
- // When the left hand side is an expression instead of a let declaration,
- // the `let` before the `{ x, y }` is not emitted.
- // When the left hand side is a let/const, the v is renamed if there is
- // another v in scope.
- // Note that all assignments to the LHS are emitted in the body, including
- // all destructuring.
- // Note also that because an extra statement is needed to assign to the LHS,
- // for-of bodies are always emitted as blocks.
- // for (<init> of <expression>) <statement>
- // where <init> is [let] variabledeclarationlist | expression
- var initializer = node.initializer;
- if (!isRestBindingPattern(initializer) && !isRestAssignment(initializer)) {
- return ts.visitEachChild(node, visitor, context);
- }
- return ts.convertForOf(node, undefined, visitor, ts.noop, context, /*transformRest*/ true);
- }
- function isRestBindingPattern(initializer) {
- if (ts.isVariableDeclarationList(initializer)) {
- var declaration = ts.firstOrUndefined(initializer.declarations);
- return declaration && declaration.name &&
- declaration.name.kind === 172 /* ObjectBindingPattern */ &&
- !!(declaration.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
- }
- return false;
- }
- function isRestAssignment(initializer) {
- return initializer.kind === 176 /* ObjectLiteralExpression */ &&
- initializer.transformFlags & 8388608 /* ContainsSpreadExpression */;
- }
- function visitParameter(node) {
- if (isObjectRestParameter(node)) {
- // Binding patterns are converted into a generated name and are
- // evaluated inside the function body.
- return ts.setOriginalNode(ts.createParameter(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node),
- /*questionToken*/ undefined,
- /*type*/ undefined, node.initializer,
- /*location*/ node),
- /*original*/ node);
- }
- else {
- return node;
- }
- }
- function isObjectRestParameter(node) {
- return node.name &&
- node.name.kind === 172 /* ObjectBindingPattern */ &&
- !!(node.name.transformFlags & 8388608 /* ContainsSpreadExpression */);
- }
- function visitFunctionDeclaration(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, body,
- /*location*/ node),
- /*original*/ node);
- }
- function visitArrowFunction(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- var func = ts.setOriginalNode(ts.createArrowFunction(node.modifiers,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, body,
- /*location*/ node),
- /*original*/ node);
- ts.setEmitFlags(func, 256 /* CapturesThis */);
- return func;
- }
- function visitFunctionExpression(node) {
- var hasRest = ts.forEach(node.parameters, isObjectRestParameter);
- var body = hasRest ?
- ts.transformFunctionBody(node, visitor, currentSourceFile, context, ts.noop, /*convertObjectRest*/ true) :
- ts.visitEachChild(node.body, visitor, context);
- return ts.setOriginalNode(ts.createFunctionExpression(node.modifiers, node.asteriskToken, name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, body,
- /*location*/ node),
- /*original*/ node);
- }
- }
- ts.transformESNext = transformESNext;
+ var entities = ts.createMap({
+ "quot": 0x0022,
+ "amp": 0x0026,
+ "apos": 0x0027,
+ "lt": 0x003C,
+ "gt": 0x003E,
+ "nbsp": 0x00A0,
+ "iexcl": 0x00A1,
+ "cent": 0x00A2,
+ "pound": 0x00A3,
+ "curren": 0x00A4,
+ "yen": 0x00A5,
+ "brvbar": 0x00A6,
+ "sect": 0x00A7,
+ "uml": 0x00A8,
+ "copy": 0x00A9,
+ "ordf": 0x00AA,
+ "laquo": 0x00AB,
+ "not": 0x00AC,
+ "shy": 0x00AD,
+ "reg": 0x00AE,
+ "macr": 0x00AF,
+ "deg": 0x00B0,
+ "plusmn": 0x00B1,
+ "sup2": 0x00B2,
+ "sup3": 0x00B3,
+ "acute": 0x00B4,
+ "micro": 0x00B5,
+ "para": 0x00B6,
+ "middot": 0x00B7,
+ "cedil": 0x00B8,
+ "sup1": 0x00B9,
+ "ordm": 0x00BA,
+ "raquo": 0x00BB,
+ "frac14": 0x00BC,
+ "frac12": 0x00BD,
+ "frac34": 0x00BE,
+ "iquest": 0x00BF,
+ "Agrave": 0x00C0,
+ "Aacute": 0x00C1,
+ "Acirc": 0x00C2,
+ "Atilde": 0x00C3,
+ "Auml": 0x00C4,
+ "Aring": 0x00C5,
+ "AElig": 0x00C6,
+ "Ccedil": 0x00C7,
+ "Egrave": 0x00C8,
+ "Eacute": 0x00C9,
+ "Ecirc": 0x00CA,
+ "Euml": 0x00CB,
+ "Igrave": 0x00CC,
+ "Iacute": 0x00CD,
+ "Icirc": 0x00CE,
+ "Iuml": 0x00CF,
+ "ETH": 0x00D0,
+ "Ntilde": 0x00D1,
+ "Ograve": 0x00D2,
+ "Oacute": 0x00D3,
+ "Ocirc": 0x00D4,
+ "Otilde": 0x00D5,
+ "Ouml": 0x00D6,
+ "times": 0x00D7,
+ "Oslash": 0x00D8,
+ "Ugrave": 0x00D9,
+ "Uacute": 0x00DA,
+ "Ucirc": 0x00DB,
+ "Uuml": 0x00DC,
+ "Yacute": 0x00DD,
+ "THORN": 0x00DE,
+ "szlig": 0x00DF,
+ "agrave": 0x00E0,
+ "aacute": 0x00E1,
+ "acirc": 0x00E2,
+ "atilde": 0x00E3,
+ "auml": 0x00E4,
+ "aring": 0x00E5,
+ "aelig": 0x00E6,
+ "ccedil": 0x00E7,
+ "egrave": 0x00E8,
+ "eacute": 0x00E9,
+ "ecirc": 0x00EA,
+ "euml": 0x00EB,
+ "igrave": 0x00EC,
+ "iacute": 0x00ED,
+ "icirc": 0x00EE,
+ "iuml": 0x00EF,
+ "eth": 0x00F0,
+ "ntilde": 0x00F1,
+ "ograve": 0x00F2,
+ "oacute": 0x00F3,
+ "ocirc": 0x00F4,
+ "otilde": 0x00F5,
+ "ouml": 0x00F6,
+ "divide": 0x00F7,
+ "oslash": 0x00F8,
+ "ugrave": 0x00F9,
+ "uacute": 0x00FA,
+ "ucirc": 0x00FB,
+ "uuml": 0x00FC,
+ "yacute": 0x00FD,
+ "thorn": 0x00FE,
+ "yuml": 0x00FF,
+ "OElig": 0x0152,
+ "oelig": 0x0153,
+ "Scaron": 0x0160,
+ "scaron": 0x0161,
+ "Yuml": 0x0178,
+ "fnof": 0x0192,
+ "circ": 0x02C6,
+ "tilde": 0x02DC,
+ "Alpha": 0x0391,
+ "Beta": 0x0392,
+ "Gamma": 0x0393,
+ "Delta": 0x0394,
+ "Epsilon": 0x0395,
+ "Zeta": 0x0396,
+ "Eta": 0x0397,
+ "Theta": 0x0398,
+ "Iota": 0x0399,
+ "Kappa": 0x039A,
+ "Lambda": 0x039B,
+ "Mu": 0x039C,
+ "Nu": 0x039D,
+ "Xi": 0x039E,
+ "Omicron": 0x039F,
+ "Pi": 0x03A0,
+ "Rho": 0x03A1,
+ "Sigma": 0x03A3,
+ "Tau": 0x03A4,
+ "Upsilon": 0x03A5,
+ "Phi": 0x03A6,
+ "Chi": 0x03A7,
+ "Psi": 0x03A8,
+ "Omega": 0x03A9,
+ "alpha": 0x03B1,
+ "beta": 0x03B2,
+ "gamma": 0x03B3,
+ "delta": 0x03B4,
+ "epsilon": 0x03B5,
+ "zeta": 0x03B6,
+ "eta": 0x03B7,
+ "theta": 0x03B8,
+ "iota": 0x03B9,
+ "kappa": 0x03BA,
+ "lambda": 0x03BB,
+ "mu": 0x03BC,
+ "nu": 0x03BD,
+ "xi": 0x03BE,
+ "omicron": 0x03BF,
+ "pi": 0x03C0,
+ "rho": 0x03C1,
+ "sigmaf": 0x03C2,
+ "sigma": 0x03C3,
+ "tau": 0x03C4,
+ "upsilon": 0x03C5,
+ "phi": 0x03C6,
+ "chi": 0x03C7,
+ "psi": 0x03C8,
+ "omega": 0x03C9,
+ "thetasym": 0x03D1,
+ "upsih": 0x03D2,
+ "piv": 0x03D6,
+ "ensp": 0x2002,
+ "emsp": 0x2003,
+ "thinsp": 0x2009,
+ "zwnj": 0x200C,
+ "zwj": 0x200D,
+ "lrm": 0x200E,
+ "rlm": 0x200F,
+ "ndash": 0x2013,
+ "mdash": 0x2014,
+ "lsquo": 0x2018,
+ "rsquo": 0x2019,
+ "sbquo": 0x201A,
+ "ldquo": 0x201C,
+ "rdquo": 0x201D,
+ "bdquo": 0x201E,
+ "dagger": 0x2020,
+ "Dagger": 0x2021,
+ "bull": 0x2022,
+ "hellip": 0x2026,
+ "permil": 0x2030,
+ "prime": 0x2032,
+ "Prime": 0x2033,
+ "lsaquo": 0x2039,
+ "rsaquo": 0x203A,
+ "oline": 0x203E,
+ "frasl": 0x2044,
+ "euro": 0x20AC,
+ "image": 0x2111,
+ "weierp": 0x2118,
+ "real": 0x211C,
+ "trade": 0x2122,
+ "alefsym": 0x2135,
+ "larr": 0x2190,
+ "uarr": 0x2191,
+ "rarr": 0x2192,
+ "darr": 0x2193,
+ "harr": 0x2194,
+ "crarr": 0x21B5,
+ "lArr": 0x21D0,
+ "uArr": 0x21D1,
+ "rArr": 0x21D2,
+ "dArr": 0x21D3,
+ "hArr": 0x21D4,
+ "forall": 0x2200,
+ "part": 0x2202,
+ "exist": 0x2203,
+ "empty": 0x2205,
+ "nabla": 0x2207,
+ "isin": 0x2208,
+ "notin": 0x2209,
+ "ni": 0x220B,
+ "prod": 0x220F,
+ "sum": 0x2211,
+ "minus": 0x2212,
+ "lowast": 0x2217,
+ "radic": 0x221A,
+ "prop": 0x221D,
+ "infin": 0x221E,
+ "ang": 0x2220,
+ "and": 0x2227,
+ "or": 0x2228,
+ "cap": 0x2229,
+ "cup": 0x222A,
+ "int": 0x222B,
+ "there4": 0x2234,
+ "sim": 0x223C,
+ "cong": 0x2245,
+ "asymp": 0x2248,
+ "ne": 0x2260,
+ "equiv": 0x2261,
+ "le": 0x2264,
+ "ge": 0x2265,
+ "sub": 0x2282,
+ "sup": 0x2283,
+ "nsub": 0x2284,
+ "sube": 0x2286,
+ "supe": 0x2287,
+ "oplus": 0x2295,
+ "otimes": 0x2297,
+ "perp": 0x22A5,
+ "sdot": 0x22C5,
+ "lceil": 0x2308,
+ "rceil": 0x2309,
+ "lfloor": 0x230A,
+ "rfloor": 0x230B,
+ "lang": 0x2329,
+ "rang": 0x232A,
+ "loz": 0x25CA,
+ "spades": 0x2660,
+ "clubs": 0x2663,
+ "hearts": 0x2665,
+ "diams": 0x2666
+ });
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
/*@internal*/
var ts;
(function (ts) {
+ var ES2017SubstitutionFlags;
+ (function (ES2017SubstitutionFlags) {
+ /** Enables substitutions for async methods with `super` calls. */
+ ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
+ })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
function transformES2017(context) {
- var ES2017SubstitutionFlags;
- (function (ES2017SubstitutionFlags) {
- /** Enables substitutions for async methods with `super` calls. */
- ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper";
- })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {}));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var resolver = context.getEmitResolver();
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
// These variables contain state that changes as we descend into the tree.
- var currentSourceFileExternalHelpersModuleName;
+ var currentSourceFile;
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
* They are persisted between each SourceFile transformation and should not be reset.
*/
var enabledSubstitutions;
/**
- * Keeps track of whether we are within any containing namespaces when performing
- * just-in-time substitution while printing an expression identifier.
- */
- var applicableSubstitutions;
- /**
* This keeps track of containers where `super` is valid, for use with
* just-in-time substitution for `super` expressions inside of async methods.
*/
@@ -48414,25 +48638,21 @@ var ts;
// Set new transformation hooks.
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- var currentScope;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
- currentSourceFileExternalHelpersModuleName = node.externalHelpersModuleName;
- return ts.visitEachChild(node, visitor, context);
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
function visitor(node) {
- if (node.transformFlags & 64 /* ES2017 */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 128 /* ContainsES2017 */) {
- return ts.visitEachChild(node, visitor, context);
+ if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) {
+ return node;
}
- return node;
- }
- function visitorWorker(node) {
switch (node.kind) {
case 119 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
@@ -48453,16 +48673,15 @@ var ts;
// ES2017 arrow functions may be 'async'
return visitArrowFunction(node);
default:
- ts.Debug.failBadSyntaxKind(node);
- return node;
+ return ts.visitEachChild(node, visitor, context);
}
}
/**
- * Visits an await expression.
+ * Visits an AwaitExpression node.
*
* This function will be called any time a ES2017 await expression is encountered.
*
- * @param node The await expression node.
+ * @param node The node to visit.
*/
function visitAwaitExpression(node) {
return ts.setOriginalNode(ts.createYield(
@@ -48470,106 +48689,73 @@ var ts;
/*location*/ node), node);
}
/**
- * Visits a method declaration of a class.
+ * Visits a MethodDeclaration node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked as async
*
- * @param node The method node.
+ * @param node The node to visit.
*/
function visitMethodDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var method = ts.createMethod(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- // While we emit the source map for the node after skipping decorators and modifiers,
- // we need to emit the comments for the original range.
- ts.setCommentRange(method, node);
- ts.setSourceMapRange(method, ts.moveRangePastDecorators(node));
- ts.setOriginalNode(method, node);
- return method;
+ return ts.updateMethod(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * Visits a function declaration.
+ * Visits a FunctionDeclaration node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked async
*
- * @param node The function node.
+ * @param node The node to visit.
*/
function visitFunctionDeclaration(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createFunctionDeclaration(
- /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * Visits a function expression node.
+ * Visits a FunctionExpression node.
*
* This function will be called when one of the following conditions are met:
* - The node is marked async
*
- * @param node The function expression node.
+ * @param node The node to visit.
*/
function visitFunctionExpression(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
if (ts.nodeIsMissing(node.body)) {
return ts.createOmittedExpression();
}
- var func = ts.createFunctionExpression(
- /*modifiers*/ undefined, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, transformFunctionBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
+ return ts.updateFunctionExpression(node,
+ /*modifiers*/ undefined, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
- * @remarks
+ * Visits an ArrowFunction.
+ *
* This function will be called when one of the following conditions are met:
* - The node is marked async
+ *
+ * @param node The node to visit.
*/
function visitArrowFunction(node) {
- if (!ts.isAsyncFunctionLike(node)) {
- return node;
- }
- var func = ts.createArrowFunction(ts.visitNodes(node.modifiers, visitor, ts.isModifier),
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, node.equalsGreaterThanToken, transformConciseBody(node),
- /*location*/ node);
- ts.setOriginalNode(func, node);
- return func;
- }
- function transformFunctionBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformConciseBody(node) {
- return transformAsyncFunctionBody(node);
- }
- function transformFunctionBodyWorker(body, start) {
- if (start === void 0) { start = 0; }
- var savedCurrentScope = currentScope;
- currentScope = body;
- startLexicalEnvironment();
- var statements = ts.visitNodes(body.statements, visitor, ts.isStatement, start);
- var visited = ts.updateBlock(body, statements);
- var declarations = endLexicalEnvironment();
- currentScope = savedCurrentScope;
- return ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
+ return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, ts.isAsyncFunctionLike(node)
+ ? transformAsyncFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
function transformAsyncFunctionBody(node) {
+ resumeLexicalEnvironment();
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
@@ -48583,54 +48769,51 @@ var ts;
if (!isArrowFunction) {
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
- statements.push(ts.createReturn(ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset))));
+ ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true);
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
if (languageVersion >= 2 /* ES2015 */) {
if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 8 /* EmitAdvancedSuperHelper */);
+ ts.addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) {
enableSubstitutionForAsyncMethodsWithSuper();
- ts.setEmitFlags(block, 4 /* EmitSuperHelper */);
+ ts.addEmitHelper(block, asyncSuperHelper);
}
}
return block;
}
else {
- return ts.createAwaiterHelper(currentSourceFileExternalHelpersModuleName, hasLexicalArguments, promiseConstructor, transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ true));
+ var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body));
+ var declarations = endLexicalEnvironment();
+ if (ts.some(declarations)) {
+ var block = ts.convertToFunctionBody(expression);
+ return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements));
+ }
+ return expression;
}
}
- function transformConciseBodyWorker(body, forceBlockFunctionBody) {
+ function transformFunctionBodyWorker(body, start) {
if (ts.isBlock(body)) {
- return transformFunctionBodyWorker(body);
+ return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start));
}
else {
startLexicalEnvironment();
- var visited = ts.visitNode(body, visitor, ts.isConciseBody);
+ var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody));
var declarations = endLexicalEnvironment();
- var merged = ts.mergeFunctionBodyLexicalEnvironment(visited, declarations);
- if (forceBlockFunctionBody && !ts.isBlock(merged)) {
- return ts.createBlock([
- ts.createReturn(merged)
- ]);
- }
- else {
- return merged;
- }
+ return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements));
}
}
function getPromiseConstructor(type) {
- if (type) {
- var typeName = ts.getEntityNameFromTypeNode(type);
- if (typeName && ts.isEntityName(typeName)) {
- var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
- if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
- || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
- return typeName;
- }
+ var typeName = type && ts.getEntityNameFromTypeNode(type);
+ if (typeName && ts.isEntityName(typeName)) {
+ var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
+ if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
+ || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
+ return typeName;
}
}
return undefined;
@@ -48714,16 +48897,17 @@ var ts;
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(emitContext, node, emitCallback) {
- var savedApplicableSubstitutions = applicableSubstitutions;
- var savedCurrentSuperContainer = currentSuperContainer;
// If we need to support substitutions for `super` in an async method,
// we should track it here.
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
+ var savedCurrentSuperContainer = currentSuperContainer;
currentSuperContainer = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSuperContainer = savedCurrentSuperContainer;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
}
- previousOnEmitNode(emitContext, node, emitCallback);
- applicableSubstitutions = savedApplicableSubstitutions;
- currentSuperContainer = savedCurrentSuperContainer;
}
/**
* Hooks node substitutions.
@@ -48755,6 +48939,40 @@ var ts;
}
}
ts.transformES2017 = transformES2017;
+ function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) {
+ context.requestEmitHelper(awaiterHelper);
+ var generatorFunc = ts.createFunctionExpression(
+ /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */),
+ /*name*/ undefined,
+ /*typeParameters*/ undefined,
+ /*parameters*/ [],
+ /*type*/ undefined, body);
+ // Mark this node as originally an async function
+ (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */;
+ return ts.createCall(ts.getHelperName("__awaiter"),
+ /*typeArguments*/ undefined, [
+ ts.createThis(),
+ hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(),
+ promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(),
+ generatorFunc
+ ]);
+ }
+ var awaiterHelper = {
+ name: "typescript:awaiter",
+ scoped: false,
+ priority: 5,
+ text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };"
+ };
+ var asyncSuperHelper = {
+ name: "typescript:async-super",
+ scoped: true,
+ text: "\n const _super = name => super[name];"
+ };
+ var advancedAsyncSuperHelper = {
+ name: "typescript:advanced-async-super",
+ scoped: true,
+ text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);"
+ };
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
@@ -48771,64 +48989,60 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
function visitor(node) {
- if (node.transformFlags & 256 /* ES2016 */) {
- return visitorWorker(node);
- }
- else if (node.transformFlags & 512 /* ContainsES2016 */) {
- return ts.visitEachChild(node, visitor, context);
- }
- else {
+ if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) {
return node;
}
- }
- function visitorWorker(node) {
switch (node.kind) {
case 192 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
- ts.Debug.failBadSyntaxKind(node);
return ts.visitEachChild(node, visitor, context);
}
}
function visitBinaryExpression(node) {
- // We are here because ES2016 adds support for the exponentiation operator.
+ switch (node.operatorToken.kind) {
+ case 61 /* AsteriskAsteriskEqualsToken */:
+ return visitExponentiationAssignmentExpression(node);
+ case 39 /* AsteriskAsteriskToken */:
+ return visitExponentiationExpression(node);
+ default:
+ return ts.visitEachChild(node, visitor, context);
+ }
+ }
+ function visitExponentiationAssignmentExpression(node) {
+ var target;
+ var value;
var left = ts.visitNode(node.left, visitor, ts.isExpression);
var right = ts.visitNode(node.right, visitor, ts.isExpression);
- if (node.operatorToken.kind === 61 /* AsteriskAsteriskEqualsToken */) {
- var target = void 0;
- var value = void 0;
- if (ts.isElementAccessExpression(left)) {
- // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)`
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression),
- /*location*/ left);
- value = ts.createElementAccess(expressionTemp, argumentExpressionTemp,
- /*location*/ left);
- }
- else if (ts.isPropertyAccessExpression(left)) {
- // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)`
- var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
- target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name,
- /*location*/ left);
- value = ts.createPropertyAccess(expressionTemp, left.name,
- /*location*/ left);
- }
- else {
- // Transforms `a **= b` into `a = Math.pow(a, b)`
- target = left;
- value = left;
- }
- return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node);
- }
- else if (node.operatorToken.kind === 39 /* AsteriskAsteriskToken */) {
- // Transforms `a ** b` into `Math.pow(a, b)`
- return ts.createMathPow(left, right, /*location*/ node);
+ if (ts.isElementAccessExpression(left)) {
+ // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)`
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression),
+ /*location*/ left);
+ value = ts.createElementAccess(expressionTemp, argumentExpressionTemp,
+ /*location*/ left);
+ }
+ else if (ts.isPropertyAccessExpression(left)) {
+ // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)`
+ var expressionTemp = ts.createTempVariable(hoistVariableDeclaration);
+ target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name,
+ /*location*/ left);
+ value = ts.createPropertyAccess(expressionTemp, left.name,
+ /*location*/ left);
}
else {
- ts.Debug.failBadSyntaxKind(node);
- return ts.visitEachChild(node, visitor, context);
+ // Transforms `a **= b` into `a = Math.pow(a, b)`
+ target = left;
+ value = left;
}
+ return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node);
+ }
+ function visitExponentiationExpression(node) {
+ // Transforms `a ** b` into `Math.pow(a, b)`
+ var left = ts.visitNode(node.left, visitor, ts.isExpression);
+ var right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return ts.createMathPow(left, right, /*location*/ node);
}
}
ts.transformES2016 = transformES2016;
@@ -48881,7 +49095,7 @@ var ts;
SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn";
})(SuperCaptureResult || (SuperCaptureResult = {}));
function transformES2015(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
var resolver = context.getEmitResolver();
var previousOnSubstituteNode = context.onSubstituteNode;
var previousOnEmitNode = context.onEmitNode;
@@ -48915,7 +49129,11 @@ var ts;
}
currentSourceFile = node;
currentText = node.text;
- return ts.visitNode(node, visitor, ts.isSourceFile);
+ var visited = saveStateAndInvoke(node, visitSourceFile);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ currentText = undefined;
+ return visited;
}
function visitor(node) {
return saveStateAndInvoke(node, dispatcher);
@@ -48955,6 +49173,41 @@ var ts;
currentNode = savedCurrentNode;
return visited;
}
+ function onBeforeVisitNode(node) {
+ if (currentNode) {
+ if (ts.isBlockScope(currentNode, currentParent)) {
+ enclosingBlockScopeContainer = currentNode;
+ enclosingBlockScopeContainerParent = currentParent;
+ }
+ if (ts.isFunctionLike(currentNode)) {
+ enclosingFunction = currentNode;
+ if (currentNode.kind !== 185 /* ArrowFunction */) {
+ enclosingNonArrowFunction = currentNode;
+ if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) {
+ enclosingNonAsyncFunctionBody = currentNode;
+ }
+ }
+ }
+ // keep track of the enclosing variable statement when in the context of
+ // variable statements, variable declarations, binding elements, and binding
+ // patterns.
+ switch (currentNode.kind) {
+ case 205 /* VariableStatement */:
+ enclosingVariableStatement = currentNode;
+ break;
+ case 224 /* VariableDeclarationList */:
+ case 223 /* VariableDeclaration */:
+ case 174 /* BindingElement */:
+ case 172 /* ObjectBindingPattern */:
+ case 173 /* ArrayBindingPattern */:
+ break;
+ default:
+ enclosingVariableStatement = undefined;
+ }
+ }
+ currentParent = currentNode;
+ currentNode = node;
+ }
function returnCapturedThis(node) {
return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node);
}
@@ -48962,7 +49215,7 @@ var ts;
return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression;
}
function shouldCheckNode(node) {
- return (node.transformFlags & 1024 /* ES2015 */) !== 0 ||
+ return (node.transformFlags & 64 /* ES2015 */) !== 0 ||
node.kind === 219 /* LabeledStatement */ ||
(ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node));
}
@@ -48973,7 +49226,7 @@ var ts;
else if (shouldCheckNode(node)) {
return visitJavaScript(node);
}
- else if (node.transformFlags & 2048 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
+ else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) {
// we want to dive in this branch either if node has children with ES2015 specific syntax
// or we are inside constructor that captures result of the super call so all returns without expression should be
// rewritten. Note: we skip expressions since returns should never appear there
@@ -49076,6 +49329,8 @@ var ts;
return visitTemplateExpression(node);
case 195 /* YieldExpression */:
return visitYieldExpression(node);
+ case 196 /* SpreadElement */:
+ return visitSpreadElement(node);
case 96 /* SuperKeyword */:
return visitSuperKeyword();
case 195 /* YieldExpression */:
@@ -49083,8 +49338,6 @@ var ts;
return ts.visitEachChild(node, visitor, context);
case 149 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 261 /* SourceFile */:
- return visitSourceFileNode(node);
case 205 /* VariableStatement */:
return visitVariableStatement(node);
default:
@@ -49092,40 +49345,14 @@ var ts;
return ts.visitEachChild(node, visitor, context);
}
}
- function onBeforeVisitNode(node) {
- if (currentNode) {
- if (ts.isBlockScope(currentNode, currentParent)) {
- enclosingBlockScopeContainer = currentNode;
- enclosingBlockScopeContainerParent = currentParent;
- }
- if (ts.isFunctionLike(currentNode)) {
- enclosingFunction = currentNode;
- if (currentNode.kind !== 185 /* ArrowFunction */) {
- enclosingNonArrowFunction = currentNode;
- if (!(ts.getEmitFlags(currentNode) & 2097152 /* AsyncFunctionBody */)) {
- enclosingNonAsyncFunctionBody = currentNode;
- }
- }
- }
- // keep track of the enclosing variable statement when in the context of
- // variable statements, variable declarations, binding elements, and binding
- // patterns.
- switch (currentNode.kind) {
- case 205 /* VariableStatement */:
- enclosingVariableStatement = currentNode;
- break;
- case 224 /* VariableDeclarationList */:
- case 223 /* VariableDeclaration */:
- case 174 /* BindingElement */:
- case 172 /* ObjectBindingPattern */:
- case 173 /* ArrayBindingPattern */:
- break;
- default:
- enclosingVariableStatement = undefined;
- }
- }
- currentParent = currentNode;
- currentNode = node;
+ function visitSourceFile(node) {
+ var statements = [];
+ startLexicalEnvironment();
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor);
+ addCaptureThisForNodeIfNeeded(statements, node);
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ ts.addRange(statements, endLexicalEnvironment());
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
}
function visitSwitchStatement(node) {
ts.Debug.assert(convertedLoopState !== undefined);
@@ -49250,10 +49477,10 @@ var ts;
statements.push(exportStatement);
}
var emitFlags = ts.getEmitFlags(node);
- if ((emitFlags & 33554432 /* HasEndOfDeclarationMarker */) === 0) {
+ if ((emitFlags & 2097152 /* HasEndOfDeclarationMarker */) === 0) {
// Add a DeclarationMarker as a marker for the end of the declaration
statements.push(ts.createEndOfDeclarationMarker(node));
- ts.setEmitFlags(statement, emitFlags | 33554432 /* HasEndOfDeclarationMarker */);
+ ts.setEmitFlags(statement, emitFlags | 2097152 /* HasEndOfDeclarationMarker */);
}
return ts.singleOrMany(statements);
}
@@ -49315,17 +49542,17 @@ var ts;
// To preserve the behavior of the old emitter, we explicitly indent
// the body of the function here if it was requested in an earlier
// transformation.
- if (ts.getEmitFlags(node) & 524288 /* Indented */) {
- ts.setEmitFlags(classFunction, 524288 /* Indented */);
+ if (ts.getEmitFlags(node) & 32768 /* Indented */) {
+ ts.setEmitFlags(classFunction, 32768 /* Indented */);
}
// "inner" and "outer" below are added purely to preserve source map locations from
// the old emitter
var inner = ts.createPartiallyEmittedExpression(classFunction);
inner.end = node.end;
- ts.setEmitFlags(inner, 49152 /* NoComments */);
+ ts.setEmitFlags(inner, 1536 /* NoComments */);
var outer = ts.createPartiallyEmittedExpression(inner);
outer.end = ts.skipTrivia(currentText, node.pos);
- ts.setEmitFlags(outer, 49152 /* NoComments */);
+ ts.setEmitFlags(outer, 1536 /* NoComments */);
return ts.createParen(ts.createCall(outer,
/*typeArguments*/ undefined, extendsClauseElement
? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
@@ -49350,14 +49577,14 @@ var ts;
// emit with the original emitter.
var outer = ts.createPartiallyEmittedExpression(localName);
outer.end = closingBraceLocation.end;
- ts.setEmitFlags(outer, 49152 /* NoComments */);
+ ts.setEmitFlags(outer, 1536 /* NoComments */);
var statement = ts.createReturn(outer);
statement.pos = closingBraceLocation.pos;
- ts.setEmitFlags(statement, 49152 /* NoComments */ | 12288 /* NoTokenSourceMaps */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */);
statements.push(statement);
ts.addRange(statements, endLexicalEnvironment());
var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true);
- ts.setEmitFlags(block, 49152 /* NoComments */);
+ ts.setEmitFlags(block, 1536 /* NoComments */);
return block;
}
/**
@@ -49369,7 +49596,7 @@ var ts;
*/
function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
if (extendsClauseElement) {
- statements.push(ts.createStatement(ts.createExtendsHelper(currentSourceFile.externalHelpersModuleName, ts.getLocalName(node)),
+ statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)),
/*location*/ extendsClauseElement));
}
}
@@ -49391,7 +49618,7 @@ var ts;
/*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper),
/*location*/ constructor || node);
if (extendsClauseElement) {
- ts.setEmitFlags(constructorFunction, 256 /* CapturesThis */);
+ ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
}
@@ -49408,10 +49635,8 @@ var ts;
// `super` call.
// If this is the case, we do not include the synthetic `...args` parameter and
// will instead use the `arguments` object in ES5/3.
- if (constructor && !hasSynthesizedSuper) {
- return ts.visitNodes(constructor.parameters, visitor, ts.isParameter);
- }
- return [];
+ return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context)
+ || [];
}
/**
* Transforms the body of a constructor declaration of a class.
@@ -49424,21 +49649,21 @@ var ts;
*/
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
var statements = [];
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = -1;
if (hasSynthesizedSuper) {
// If a super call has already been synthesized,
// we're going to assume that we should just transform everything after that.
// The assumption is that no prior step in the pipeline has added any prologue directives.
- statementOffset = 1;
+ statementOffset = 0;
}
else if (constructor) {
// Otherwise, try to emit all potential prologue directives first.
statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor);
}
if (constructor) {
- ts.addDefaultValueAssignmentsIfNeeded(statements, constructor, visitor, /*convertObjectRest*/ false);
- ts.addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
+ addDefaultValueAssignmentsIfNeeded(statements, constructor);
+ addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!");
}
var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset);
@@ -49466,7 +49691,7 @@ var ts;
/*location*/ constructor ? constructor.body : node,
/*multiLine*/ true);
if (!constructor) {
- ts.setEmitFlags(block, 49152 /* NoComments */);
+ ts.setEmitFlags(block, 1536 /* NoComments */);
}
return block;
}
@@ -49504,7 +49729,7 @@ var ts;
// If this isn't a derived class, just capture 'this' for arrow functions if necessary.
if (!hasExtendsClause) {
if (ctor) {
- ts.addCaptureThisForNodeIfNeeded(statements, ctor, enableSubstitutionsForCapturedThis);
+ addCaptureThisForNodeIfNeeded(statements, ctor);
}
return 0 /* NoReplacement */;
}
@@ -49519,7 +49744,7 @@ var ts;
// for something like property initializers.
// Create a captured '_this' variable and assume it will subsequently be used.
if (hasSynthesizedSuper) {
- ts.captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
+ captureThisForNode(statements, ctor, createDefaultSuperCallOrThis());
enableSubstitutionsForCapturedThis();
return 1 /* ReplaceSuperCapture */;
}
@@ -49558,12 +49783,12 @@ var ts;
ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'.");
}
// Shift comments from the original super call to the return statement.
- ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 49152 /* NoComments */)));
+ ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536 /* NoComments */)));
statements.push(returnStatement);
return 2 /* ReplaceWithReturn */;
}
// Perform the capture.
- ts.captureThisForNode(statements, ctor, superCallExpression, enableSubstitutionsForCapturedThis, firstStatement);
+ captureThisForNode(statements, ctor, superCallExpression, firstStatement);
// If we're actually replacing the original statement, we need to signal this to the caller.
if (superCallExpression) {
return 1 /* ReplaceSuperCapture */;
@@ -49572,7 +49797,7 @@ var ts;
}
function createDefaultSuperCallOrThis() {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128 /* NoSubstitution */);
+ ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments"));
return ts.createLogicalOr(superCall, actualThis);
}
@@ -49616,6 +49841,160 @@ var ts;
}
}
/**
+ * Gets a value indicating whether we need to add default value assignments for a
+ * function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function shouldAddDefaultValueAssignments(node) {
+ return (node.transformFlags & 131072 /* ContainsDefaultValueAssignments */) !== 0;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains parameters with
+ * binding patterns or initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ */
+ function addDefaultValueAssignmentsIfNeeded(statements, node) {
+ if (!shouldAddDefaultValueAssignments(node)) {
+ return;
+ }
+ for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
+ var parameter = _a[_i];
+ var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
+ // A rest parameter cannot have a binding pattern or an initializer,
+ // so let's just ignore it.
+ if (dotDotDotToken) {
+ continue;
+ }
+ if (ts.isBindingPattern(name_35)) {
+ addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer);
+ }
+ else if (initializer) {
+ addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer);
+ }
+ }
+ }
+ /**
+ * Adds statements to the body of a function-like node for parameters with binding patterns
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
+ var temp = ts.getGeneratedNameForNode(parameter);
+ // In cases where a binding pattern is simply '[]' or '{}',
+ // we usually don't want to emit a var declaration; however, in the presence
+ // of an initializer, we must emit that expression to preserve side effects.
+ if (name.elements.length > 0) {
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, temp))), 524288 /* CustomPrologue */));
+ }
+ else if (initializer) {
+ statements.push(ts.setEmitFlags(ts.createStatement(ts.createAssignment(temp, ts.visitNode(initializer, visitor, ts.isExpression))), 524288 /* CustomPrologue */));
+ }
+ }
+ /**
+ * Adds statements to the body of a function-like node for parameters with initializers.
+ *
+ * @param statements The statements for the new function body.
+ * @param parameter The parameter for the function.
+ * @param name The name of the parameter.
+ * @param initializer The initializer for the parameter.
+ */
+ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
+ initializer = ts.visitNode(initializer, visitor, ts.isExpression);
+ var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([
+ ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)),
+ /*location*/ parameter))
+ ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */),
+ /*elseStatement*/ undefined,
+ /*location*/ parameter);
+ statement.startsOnNewLine = true;
+ ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */);
+ statements.push(statement);
+ }
+ /**
+ * Gets a value indicating whether we need to add statements to handle a rest parameter.
+ *
+ * @param node A ParameterDeclaration node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
+ return node && node.dotDotDotToken && node.name.kind === 70 /* Identifier */ && !inConstructorWithSynthesizedSuper;
+ }
+ /**
+ * Adds statements to the body of a function-like node if it contains a rest parameter.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A function-like node.
+ * @param inConstructorWithSynthesizedSuper A value indicating whether the parameter is
+ * part of a constructor declaration with a
+ * synthesized call to `super`
+ */
+ function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
+ var parameter = ts.lastOrUndefined(node.parameters);
+ if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
+ return;
+ }
+ // `declarationName` is the name of the local declaration for the parameter.
+ var declarationName = ts.getMutableClone(parameter.name);
+ ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
+ // `expressionName` is the name of the parameter used in expressions.
+ var expressionName = ts.getSynthesizedClone(parameter.name);
+ var restIndex = node.parameters.length - 1;
+ var temp = ts.createLoopVariable();
+ // var param = [];
+ statements.push(ts.setEmitFlags(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(declarationName,
+ /*type*/ undefined, ts.createArrayLiteral([]))
+ ]),
+ /*location*/ parameter), 524288 /* CustomPrologue */));
+ // for (var _i = restIndex; _i < arguments.length; _i++) {
+ // param[_i - restIndex] = arguments[_i];
+ // }
+ var forStatement = ts.createFor(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex))
+ ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"),
+ /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([
+ ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0
+ ? temp
+ : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)),
+ /*location*/ parameter))
+ ]));
+ ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */);
+ ts.startOnNewLine(forStatement);
+ statements.push(forStatement);
+ }
+ /**
+ * Adds a statement to capture the `this` of a function declaration if it is needed.
+ *
+ * @param statements The statements for the new function body.
+ * @param node A node.
+ */
+ function addCaptureThisForNodeIfNeeded(statements, node) {
+ if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) {
+ captureThisForNode(statements, node, ts.createThis());
+ }
+ }
+ function captureThisForNode(statements, node, initializer, originalStatement) {
+ enableSubstitutionsForCapturedThis();
+ var captureThisStatement = ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.createVariableDeclarationList([
+ ts.createVariableDeclaration("_this",
+ /*type*/ undefined, initializer)
+ ]), originalStatement);
+ ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */);
+ ts.setSourceMapRange(captureThisStatement, node);
+ statements.push(captureThisStatement);
+ }
+ /**
* Adds statements to the class body function for a class to define the members of the
* class.
*
@@ -49665,18 +50044,18 @@ var ts;
function transformClassMethodDeclarationToStatement(receiver, member) {
var commentRange = ts.getCommentRange(member);
var sourceMapRange = ts.getSourceMapRange(member);
- var func = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined);
- ts.setEmitFlags(func, 49152 /* NoComments */);
- ts.setSourceMapRange(func, sourceMapRange);
- var statement = ts.createStatement(ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName),
- /*location*/ member.name), func),
+ var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name);
+ var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined);
+ ts.setEmitFlags(memberFunction, 1536 /* NoComments */);
+ ts.setSourceMapRange(memberFunction, sourceMapRange);
+ var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction),
/*location*/ member);
ts.setOriginalNode(statement, member);
ts.setCommentRange(statement, commentRange);
// The location for the statement is used to emit comments only.
// No source map should be emitted for this statement to align with the
// old emitter.
- ts.setEmitFlags(statement, 1536 /* NoSourceMap */);
+ ts.setEmitFlags(statement, 48 /* NoSourceMap */);
return statement;
}
/**
@@ -49691,7 +50070,7 @@ var ts;
// The location for the statement is used to emit source maps only.
// No comments should be emitted for this statement to align with the
// old emitter.
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
return statement;
}
/**
@@ -49705,16 +50084,16 @@ var ts;
// To align with source maps in the old emitter, the receiver and property name
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
- ts.setEmitFlags(target, 49152 /* NoComments */ | 1024 /* NoTrailingSourceMap */);
+ ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
- ts.setEmitFlags(propertyName, 49152 /* NoComments */ | 512 /* NoLeadingSourceMap */);
+ ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
var properties = [];
if (getAccessor) {
var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined);
ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
- ts.setEmitFlags(getterFunction, 16384 /* NoLeadingComments */);
+ ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */);
var getter = ts.createPropertyAssignment("get", getterFunction);
ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
properties.push(getter);
@@ -49722,7 +50101,7 @@ var ts;
if (setAccessor) {
var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined);
ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
- ts.setEmitFlags(setterFunction, 16384 /* NoLeadingComments */);
+ ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */);
var setter = ts.createPropertyAssignment("set", setterFunction);
ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
properties.push(setter);
@@ -49745,11 +50124,17 @@ var ts;
* @param node An ArrowFunction node.
*/
function visitArrowFunction(node) {
- if (node.transformFlags & 262144 /* ContainsLexicalThis */) {
+ if (node.transformFlags & 16384 /* ContainsLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
- var func = transformFunctionLikeToExpression(node, /*location*/ node, /*name*/ undefined);
- ts.setEmitFlags(func, 256 /* CapturesThis */);
+ var func = ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, transformFunctionBody(node), node);
+ ts.setOriginalNode(func, node);
+ ts.setEmitFlags(func, 8 /* CapturesThis */);
return func;
}
/**
@@ -49758,7 +50143,12 @@ var ts;
* @param node a FunctionExpression node.
*/
function visitFunctionExpression(node) {
- return transformFunctionLikeToExpression(node, /*location*/ node, node.name);
+ return ts.updateFunctionExpression(node,
+ /*modifiers*/ undefined, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, node.transformFlags & 64 /* ES2015 */
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
* Visits a FunctionDeclaration node.
@@ -49766,12 +50156,12 @@ var ts;
* @param node a FunctionDeclaration node.
*/
function visitFunctionDeclaration(node) {
- return ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined, node.modifiers, node.asteriskToken, node.name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis),
- /*location*/ node),
- /*original*/ node);
+ return ts.updateFunctionDeclaration(node,
+ /*decorators*/ undefined, node.modifiers, node.name,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, node.transformFlags & 64 /* ES2015 */
+ ? transformFunctionBody(node)
+ : ts.visitFunctionBody(node.body, visitor, context));
}
/**
* Transforms a function-like node into a FunctionExpression.
@@ -49787,13 +50177,87 @@ var ts;
}
var expression = ts.setOriginalNode(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
- /*typeParameters*/ undefined, ts.visitNodes(node.parameters, visitor, ts.isParameter),
- /*type*/ undefined, saveStateAndInvoke(node, function (node) { return ts.transformFunctionBody(node, visitor, currentSourceFile, context, enableSubstitutionsForCapturedThis); }), location),
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
+ /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location),
/*original*/ node);
enclosingNonArrowFunction = savedContainingNonArrowFunction;
return expression;
}
/**
+ * Transforms the body of a function-like node.
+ *
+ * @param node A function-like node.
+ */
+ function transformFunctionBody(node) {
+ var multiLine = false; // indicates whether the block *must* be emitted as multiple lines
+ var singleLine = false; // indicates whether the block *may* be emitted as a single line
+ var statementsLocation;
+ var closeBraceLocation;
+ var statements = [];
+ var body = node.body;
+ var statementOffset;
+ resumeLexicalEnvironment();
+ if (ts.isBlock(body)) {
+ // ensureUseStrict is false because no new prologue-directive should be added.
+ // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array
+ statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
+ }
+ addCaptureThisForNodeIfNeeded(statements, node);
+ addDefaultValueAssignmentsIfNeeded(statements, node);
+ addRestParameterIfNeeded(statements, node, /*inConstructorWithSynthesizedSuper*/ false);
+ // If we added any generated statements, this must be a multi-line block.
+ if (!multiLine && statements.length > 0) {
+ multiLine = true;
+ }
+ if (ts.isBlock(body)) {
+ statementsLocation = body.statements;
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
+ // If the original body was a multi-line block, this must be a multi-line block.
+ if (!multiLine && body.multiLine) {
+ multiLine = true;
+ }
+ }
+ else {
+ ts.Debug.assert(node.kind === 185 /* ArrowFunction */);
+ // To align with the old emitter, we use a synthetic end position on the location
+ // for the statement list we synthesize when we down-level an arrow function with
+ // an expression function body. This prevents both comments and source maps from
+ // being emitted for the end position only.
+ statementsLocation = ts.moveRangeEnd(body, -1);
+ var equalsGreaterThanToken = node.equalsGreaterThanToken;
+ if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
+ if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
+ singleLine = true;
+ }
+ else {
+ multiLine = true;
+ }
+ }
+ var expression = ts.visitNode(body, visitor, ts.isExpression);
+ var returnStatement = ts.createReturn(expression, /*location*/ body);
+ ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */);
+ statements.push(returnStatement);
+ // To align with the source map emit for the old emitter, we set a custom
+ // source map location for the close brace.
+ closeBraceLocation = body;
+ }
+ var lexicalEnvironment = context.endLexicalEnvironment();
+ ts.addRange(statements, lexicalEnvironment);
+ // If we added any final generated statements, this must be a multi-line block
+ if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) {
+ multiLine = true;
+ }
+ var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine);
+ if (!multiLine && singleLine) {
+ ts.setEmitFlags(block, 1 /* SingleLine */);
+ }
+ if (closeBraceLocation) {
+ ts.setTokenSourceMapRange(block, 17 /* CloseBraceToken */, closeBraceLocation);
+ }
+ ts.setOriginalNode(block, node.body);
+ return block;
+ }
+ /**
* Visits an ExpressionStatement that contains a destructuring assignment.
*
* @param node An ExpressionStatement node.
@@ -49817,14 +50281,12 @@ var ts;
*/
function visitParenthesizedExpression(node, needsDestructuringValue) {
// If we are here it is most likely because our expression is a destructuring assignment.
- if (needsDestructuringValue) {
+ if (!needsDestructuringValue) {
switch (node.expression.kind) {
case 183 /* ParenthesizedExpression */:
- return ts.createParen(visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ true),
- /*location*/ node);
+ return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
case 192 /* BinaryExpression */:
- return ts.createParen(visitBinaryExpression(node.expression, /*needsDestructuringValue*/ true),
- /*location*/ node);
+ return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
return ts.visitEachChild(node, visitor, context);
@@ -49838,8 +50300,9 @@ var ts;
*/
function visitBinaryExpression(node, needsDestructuringValue) {
// If we are here it is because this is a destructuring assignment.
- ts.Debug.assert(ts.isDestructuringAssignment(node));
- return ts.flattenDestructuringAssignment(context, node, needsDestructuringValue, hoistVariableDeclaration, visitor);
+ if (ts.isDestructuringAssignment(node)) {
+ return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue);
+ }
}
function visitVariableStatement(node) {
if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) {
@@ -49851,7 +50314,7 @@ var ts;
if (decl.initializer) {
var assignment = void 0;
if (ts.isBindingPattern(decl.name)) {
- assignment = ts.flattenVariableDestructuringToExpression(decl, hoistVariableDeclaration, /*createAssignmentCallback*/ undefined, visitor);
+ assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
@@ -49884,7 +50347,7 @@ var ts;
var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node);
ts.setOriginalNode(declarationList, node);
ts.setCommentRange(declarationList, node);
- if (node.transformFlags & 67108864 /* ContainsBindingPattern */
+ if (node.transformFlags & 8388608 /* ContainsBindingPattern */
&& (ts.isBindingPattern(node.declarations[0].name)
|| ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) {
// If the first or last declaration is a binding pattern, we need to modify
@@ -49972,9 +50435,9 @@ var ts;
return visitVariableDeclaration(node);
}
if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
- var clone_5 = ts.getMutableClone(node);
- clone_5.initializer = ts.createVoidZero();
- return clone_5;
+ var clone_3 = ts.getMutableClone(node);
+ clone_3.initializer = ts.createVoidZero();
+ return clone_3;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -49986,9 +50449,10 @@ var ts;
function visitVariableDeclaration(node) {
// If we are here it is because the name contains a binding pattern.
if (ts.isBindingPattern(node.name)) {
- var recordTempVariablesInLine = !enclosingVariableStatement
- || !ts.hasModifier(enclosingVariableStatement, 1 /* Export */);
- return ts.flattenVariableDestructuring(node, /*value*/ undefined, visitor, recordTempVariablesInLine ? undefined : hoistVariableDeclaration);
+ var hoistTempVariables = enclosingVariableStatement
+ && ts.hasModifier(enclosingVariableStatement, 1 /* Export */);
+ return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */,
+ /*value*/ undefined, hoistTempVariables);
}
return ts.visitEachChild(node, visitor, context);
}
@@ -50032,7 +50496,118 @@ var ts;
return convertIterationStatementBodyIfNecessary(node, convertForOfToFor);
}
function convertForOfToFor(node, convertedLoopBodyStatements) {
- return ts.convertForOf(node, convertedLoopBodyStatements, visitor, enableSubstitutionsForBlockScopedBindings, context, /*transformRest*/ false);
+ // The following ES6 code:
+ //
+ // for (let v of expr) { }
+ //
+ // should be emitted as
+ //
+ // for (var _i = 0, _a = expr; _i < _a.length; _i++) {
+ // var v = _a[_i];
+ // }
+ //
+ // where _a and _i are temps emitted to capture the RHS and the counter,
+ // respectively.
+ // When the left hand side is an expression instead of a let declaration,
+ // the "let v" is not emitted.
+ // When the left hand side is a let/const, the v is renamed if there is
+ // another v in scope.
+ // Note that all assignments to the LHS are emitted in the body, including
+ // all destructuring.
+ // Note also that because an extra statement is needed to assign to the LHS,
+ // for-of bodies are always emitted as blocks.
+ var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
+ var initializer = node.initializer;
+ var statements = [];
+ // In the case where the user wrote an identifier as the RHS, like this:
+ //
+ // for (let v of arr) { }
+ //
+ // we don't want to emit a temporary variable for the RHS, just use it directly.
+ var counter = ts.createLoopVariable();
+ var rhsReference = expression.kind === 70 /* Identifier */
+ ? ts.createUniqueName(expression.text)
+ : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var elementAccess = ts.createElementAccess(rhsReference, counter);
+ // Initialize LHS
+ // var v = _a[_i];
+ if (ts.isVariableDeclarationList(initializer)) {
+ if (initializer.flags & 3 /* BlockScoped */) {
+ enableSubstitutionsForBlockScopedBindings();
+ }
+ var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
+ if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
+ // This works whether the declaration is a var, let, or const.
+ // It will use rhsIterationValue _a[_i] as the initializer.
+ var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess);
+ var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer);
+ ts.setOriginalNode(declarationList, initializer);
+ // Adjust the source map range for the first declaration to align with the old
+ // emitter.
+ var firstDeclaration = declarations[0];
+ var lastDeclaration = ts.lastOrUndefined(declarations);
+ ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end));
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, declarationList));
+ }
+ else {
+ // The following call does not include the initializer, so we have
+ // to emit it separately.
+ statements.push(ts.createVariableStatement(
+ /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined),
+ /*type*/ undefined, ts.createElementAccess(rhsReference, counter))
+ ], /*location*/ ts.moveRangePos(initializer, -1)), initializer),
+ /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ else {
+ // Initializer is an expression. Emit the expression in the body, so that it's
+ // evaluated on every iteration.
+ var assignment = ts.createAssignment(initializer, elementAccess);
+ if (ts.isDestructuringAssignment(assignment)) {
+ // This is a destructuring pattern, so we flatten the destructuring instead.
+ statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */)));
+ }
+ else {
+ // Currently there is not way to check that assignment is binary expression of destructing assignment
+ // so we have to cast never type to binaryExpression
+ assignment.end = initializer.end;
+ statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1)));
+ }
+ }
+ var bodyLocation;
+ var statementsLocation;
+ if (convertedLoopBodyStatements) {
+ ts.addRange(statements, convertedLoopBodyStatements);
+ }
+ else {
+ var statement = ts.visitNode(node.statement, visitor, ts.isStatement);
+ if (ts.isBlock(statement)) {
+ ts.addRange(statements, statement.statements);
+ bodyLocation = statement;
+ statementsLocation = statement.statements;
+ }
+ else {
+ statements.push(statement);
+ }
+ }
+ // The old emitter does not emit source maps for the expression
+ ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression));
+ // The old emitter does not emit source maps for the block.
+ // We add the location to preserve comments.
+ var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation),
+ /*location*/ bodyLocation);
+ ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */);
+ var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([
+ ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)),
+ ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression)
+ ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"),
+ /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body,
+ /*location*/ node);
+ // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter.
+ ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */);
+ return forStatement;
}
/**
* Visits an ObjectLiteralExpression with computed propety names.
@@ -50048,7 +50623,7 @@ var ts;
var numInitialProperties = numProperties;
for (var i = 0; i < numProperties; i++) {
var property = properties[i];
- if (property.transformFlags & 134217728 /* ContainsYield */
+ if (property.transformFlags & 16777216 /* ContainsYield */
|| property.name.kind === 142 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
@@ -50061,7 +50636,7 @@ var ts;
// Write out the first non-computed properties, then emit the rest through indexing on the temp variable.
var expressions = [];
var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties),
- /*location*/ undefined, node.multiLine), 524288 /* Indented */));
+ /*location*/ undefined, node.multiLine), 32768 /* Indented */));
if (node.multiLine) {
assignment.startsOnNewLine = true;
}
@@ -50159,22 +50734,22 @@ var ts;
var currentState = convertedLoopState;
convertedLoopState = outerConvertedLoopState;
if (loopOutParameters.length) {
- var statements_3 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
- copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_3);
- loopBody = ts.createBlock(statements_3, /*location*/ undefined, /*multiline*/ true);
+ var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
+ copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4);
+ loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true);
}
if (!ts.isBlock(loopBody)) {
loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true);
}
var isAsyncBlockContainingAwait = enclosingNonArrowFunction
- && (ts.getEmitFlags(enclosingNonArrowFunction) & 2097152 /* AsyncFunctionBody */) !== 0
- && (node.statement.transformFlags & 134217728 /* ContainsYield */) !== 0;
+ && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0
+ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0;
var loopBodyFlags = 0;
if (currentState.containsLexicalThis) {
- loopBodyFlags |= 256 /* CapturesThis */;
+ loopBodyFlags |= 8 /* CapturesThis */;
}
if (isAsyncBlockContainingAwait) {
- loopBodyFlags |= 2097152 /* AsyncFunctionBody */;
+ loopBodyFlags |= 131072 /* AsyncFunctionBody */;
}
var convertedLoopVariable = ts.createVariableStatement(
/*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([
@@ -50184,7 +50759,7 @@ var ts;
/*name*/ undefined,
/*typeParameters*/ undefined, loopParameters,
/*type*/ undefined, loopBody), loopBodyFlags))
- ]), 16777216 /* NoHoisting */));
+ ]), 1048576 /* NoHoisting */));
var statements = [convertedLoopVariable];
var extraVariableDeclarations;
// propagate state from the inner loop to the outer loop if necessary
@@ -50465,7 +51040,7 @@ var ts;
ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name));
var temp = ts.createTempVariable(undefined);
var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration);
- var vars = ts.flattenVariableDestructuring(node.variableDeclaration, temp, visitor);
+ var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp);
var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags);
var destructure = ts.createVariableStatement(undefined, list);
return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
@@ -50486,7 +51061,7 @@ var ts;
// Methods with computed property names are handled in visitObjectLiteralExpression.
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined);
- ts.setEmitFlags(functionExpression, 16384 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression));
+ ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression));
return ts.createPropertyAssignment(node.name, functionExpression,
/*location*/ node);
}
@@ -50533,10 +51108,10 @@ var ts;
// because we contain a SpreadElementExpression.
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
if (node.expression.kind === 96 /* SuperKeyword */) {
- ts.setEmitFlags(thisArg, 128 /* NoSubstitution */);
+ ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall;
- if (node.transformFlags & 8388608 /* ContainsSpreadExpression */) {
+ if (node.transformFlags & 524288 /* ContainsSpread */) {
// [source]
// f(...a, b)
// x.m(...a, b)
@@ -50567,7 +51142,7 @@ var ts;
}
if (node.expression.kind === 96 /* SuperKeyword */) {
var actualThis = ts.createThis();
- ts.setEmitFlags(actualThis, 128 /* NoSubstitution */);
+ ts.setEmitFlags(actualThis, 4 /* NoSubstitution */);
var initializer = ts.createLogicalOr(resultingCall, actualThis);
return assignToCapturedThis
? ts.createAssignment(ts.createIdentifier("_this"), initializer)
@@ -50582,7 +51157,7 @@ var ts;
*/
function visitNewExpression(node) {
// We are here because we contain a SpreadElementExpression.
- ts.Debug.assert((node.transformFlags & 8388608 /* ContainsSpreadExpression */) !== 0);
+ ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0);
// [source]
// new C(...a)
//
@@ -50632,6 +51207,9 @@ var ts;
return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression),
/*location*/ undefined, multiLine);
}
+ function visitSpreadElement(node) {
+ return ts.visitNode(node.expression, visitor, ts.isExpression);
+ }
/**
* Transforms the expression of a SpreadExpression node.
*
@@ -50798,18 +51376,6 @@ var ts;
? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype")
: ts.createIdentifier("_super");
}
- function visitSourceFileNode(node) {
- var _a = ts.span(node.statements, ts.isPrologueDirective), prologue = _a[0], remaining = _a[1];
- var statements = [];
- startLexicalEnvironment();
- ts.addRange(statements, prologue);
- ts.addCaptureThisForNodeIfNeeded(statements, node, enableSubstitutionsForCapturedThis);
- ts.addRange(statements, ts.visitNodes(ts.createNodeArray(remaining), visitor, ts.isStatement));
- ts.addRange(statements, endLexicalEnvironment());
- var clone = ts.getMutableClone(node);
- clone.statements = ts.createNodeArray(statements, /*location*/ node.statements);
- return clone;
- }
/**
* Called by the printer just before a node is printed.
*
@@ -50935,7 +51501,7 @@ var ts;
function substituteThisKeyword(node) {
if (enabledSubstitutions & 1 /* CapturedThis */
&& enclosingFunction
- && ts.getEmitFlags(enclosingFunction) & 256 /* CapturesThis */) {
+ && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) {
return ts.createIdentifier("_this", /*location*/ node);
}
return node;
@@ -50948,8 +51514,7 @@ var ts;
if (!constructor || !hasExtendsClause) {
return false;
}
- var parameter = ts.singleOrUndefined(constructor.parameters);
- if (!parameter || !ts.nodeIsSynthesized(parameter) || !parameter.dotDotDotToken) {
+ if (ts.some(constructor.parameters)) {
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
@@ -50969,10 +51534,24 @@ var ts;
return false;
}
var expression = callArgument.expression;
- return ts.isIdentifier(expression) && expression === parameter.name;
+ return ts.isIdentifier(expression) && expression.text === "arguments";
}
}
ts.transformES2015 = transformES2015;
+ function createExtendsHelper(context, name) {
+ context.requestEmitHelper(extendsHelper);
+ return ts.createCall(ts.getHelperName("__extends"),
+ /*typeArguments*/ undefined, [
+ name,
+ ts.createIdentifier("_super")
+ ]);
+ }
+ var extendsHelper = {
+ name: "typescript:extends",
+ scoped: false,
+ priority: 0,
+ text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };"
+ };
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
/// <reference path="../visitor.ts" />
@@ -51154,7 +51733,7 @@ var ts;
_a[7 /* Endfinally */] = "endfinally",
_a));
function transformGenerators(context) {
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
var compilerOptions = context.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var resolver = context.getEmitResolver();
@@ -51204,15 +51783,15 @@ var ts;
var withBlockStack; // A stack containing `with` blocks.
return transformSourceFile;
function transformSourceFile(node) {
- if (ts.isDeclarationFile(node)) {
+ if (ts.isDeclarationFile(node)
+ || (node.transformFlags & 512 /* ContainsGenerator */) === 0) {
return node;
}
- if (node.transformFlags & 8192 /* ContainsGenerator */) {
- currentSourceFile = node;
- node = ts.visitEachChild(node, visitor, context);
- currentSourceFile = undefined;
- }
- return node;
+ currentSourceFile = node;
+ var visited = ts.visitEachChild(node, visitor, context);
+ ts.addEmitHelpers(visited, context.readEmitHelpers());
+ currentSourceFile = undefined;
+ return visited;
}
/**
* Visits a node.
@@ -51227,10 +51806,10 @@ var ts;
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
- else if (transformFlags & 4096 /* Generator */) {
+ else if (transformFlags & 256 /* Generator */) {
return visitGenerator(node);
}
- else if (transformFlags & 8192 /* ContainsGenerator */) {
+ else if (transformFlags & 512 /* ContainsGenerator */) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51283,10 +51862,10 @@ var ts;
case 216 /* ReturnStatement */:
return visitReturnStatement(node);
default:
- if (node.transformFlags & 134217728 /* ContainsYield */) {
+ if (node.transformFlags & 16777216 /* ContainsYield */) {
return visitJavaScriptContainingYield(node);
}
- else if (node.transformFlags & (8192 /* ContainsGenerator */ | 268435456 /* ContainsHoistedDeclarationOrCompletion */)) {
+ else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) {
return ts.visitEachChild(node, visitor, context);
}
else {
@@ -51348,12 +51927,11 @@ var ts;
*/
function visitFunctionDeclaration(node) {
// Currently, we only support generators that were originally async functions.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
node = ts.setOriginalNode(ts.createFunctionDeclaration(
- /*decorators*/ undefined,
- /*modifiers*/ undefined,
+ /*decorators*/ undefined, node.modifiers,
/*asteriskToken*/ undefined, node.name,
- /*typeParameters*/ undefined, node.parameters,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
/*type*/ undefined, transformGeneratorFunctionBody(node.body),
/*location*/ node), node);
}
@@ -51387,11 +51965,11 @@ var ts;
*/
function visitFunctionExpression(node) {
// Currently, we only support generators that were originally async functions.
- if (node.asteriskToken && ts.getEmitFlags(node) & 2097152 /* AsyncFunctionBody */) {
+ if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) {
node = ts.setOriginalNode(ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined, node.name,
- /*typeParameters*/ undefined, node.parameters,
+ /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
/*type*/ undefined, transformGeneratorFunctionBody(node.body),
/*location*/ node), node);
}
@@ -51460,7 +52038,7 @@ var ts;
operationLocations = undefined;
state = ts.createTempVariable(/*recordTempVariable*/ undefined);
// Build the generator
- startLexicalEnvironment();
+ resumeLexicalEnvironment();
var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
transformAndEmitStatements(body.statements, statementOffset);
var buildResult = build();
@@ -51491,13 +52069,13 @@ var ts;
* @param node The node to visit.
*/
function visitVariableStatement(node) {
- if (node.transformFlags & 134217728 /* ContainsYield */) {
+ if (node.transformFlags & 16777216 /* ContainsYield */) {
transformAndEmitVariableDeclarationList(node.declarationList);
return undefined;
}
else {
// Do not hoist custom prologues.
- if (ts.getEmitFlags(node) & 8388608 /* CustomPrologue */) {
+ if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) {
return node;
}
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
@@ -51614,10 +52192,10 @@ var ts;
// _a = a();
// .yield resumeLabel
// _a + %sent% + c()
- var clone_6 = ts.getMutableClone(node);
- clone_6.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
- clone_6.right = ts.visitNode(node.right, visitor, ts.isExpression);
- return clone_6;
+ var clone_4 = ts.getMutableClone(node);
+ clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression));
+ clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression);
+ return clone_4;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -51770,7 +52348,7 @@ var ts;
* @param node The node to visit.
*/
function visitArrayLiteralExpression(node) {
- return visitElements(node.elements, node.multiLine);
+ return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine);
}
/**
* Visits an array of expressions containing one or more YieldExpression nodes
@@ -51779,7 +52357,7 @@ var ts;
* @param elements The elements to visit.
* @param multiLine Whether array literals created should be emitted on multiple lines.
*/
- function visitElements(elements, _multiLine) {
+ function visitElements(elements, leadingElement, location, multiLine) {
// [source]
// ar = [1, yield, 2];
//
@@ -51793,19 +52371,24 @@ var ts;
var temp = declareLocal();
var hasAssignedTemp = false;
if (numInitialElements > 0) {
- emitAssignment(temp, ts.createArrayLiteral(ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements)));
+ var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
+ emitAssignment(temp, ts.createArrayLiteral(leadingElement
+ ? [leadingElement].concat(initialElements) : initialElements));
+ leadingElement = undefined;
hasAssignedTemp = true;
}
var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
return hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions);
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine);
function reduceElement(expressions, element) {
if (containsYield(element) && expressions.length > 0) {
emitAssignment(temp, hasAssignedTemp
- ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions)])
- : ts.createArrayLiteral(expressions));
+ ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)])
+ : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions,
+ /*location*/ undefined, multiLine));
hasAssignedTemp = true;
+ leadingElement = undefined;
expressions = [];
}
expressions.push(ts.visitNode(element, visitor, ts.isExpression));
@@ -51871,10 +52454,10 @@ var ts;
// .yield resumeLabel
// .mark resumeLabel
// a = _a[%sent%]
- var clone_7 = ts.getMutableClone(node);
- clone_7.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
- clone_7.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
- return clone_7;
+ var clone_5 = ts.getMutableClone(node);
+ clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression));
+ clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression);
+ return clone_5;
}
return ts.visitEachChild(node, visitor, context);
}
@@ -51909,7 +52492,8 @@ var ts;
// .mark resumeLabel
// new (_b.apply(_a, _c.concat([%sent%, 2])));
var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments)),
+ return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments,
+ /*leadingElement*/ ts.createVoidZero())),
/*typeArguments*/ undefined, [],
/*location*/ node), node);
}
@@ -52532,7 +53116,7 @@ var ts;
}
}
function containsYield(node) {
- return node && (node.transformFlags & 134217728 /* ContainsYield */) !== 0;
+ return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0;
}
function countInitialNodesWithoutYield(nodes) {
var numNodes = nodes.length;
@@ -52562,12 +53146,12 @@ var ts;
if (ts.isIdentifier(original) && original.parent) {
var declaration = resolver.getReferencedValueDeclaration(original);
if (declaration) {
- var name_35 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
- if (name_35) {
- var clone_8 = ts.getMutableClone(name_35);
- ts.setSourceMapRange(clone_8, node);
- ts.setCommentRange(clone_8, node);
- return clone_8;
+ var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration)));
+ if (name_36) {
+ var clone_6 = ts.getMutableClone(name_36);
+ ts.setSourceMapRange(clone_6, node);
+ ts.setCommentRange(clone_6, node);
+ return clone_6;
}
}
}
@@ -53153,18 +53737,14 @@ var ts;
currentExceptionBlock = undefined;
withBlockStack = undefined;
var buildResult = buildStatements();
- return ts.createCall(ts.createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"),
- /*typeArguments*/ undefined, [
- ts.createThis(),
- ts.setEmitFlags(ts.createFunctionExpression(
- /*modifiers*/ undefined,
- /*asteriskToken*/ undefined,
- /*name*/ undefined,
- /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)],
- /*type*/ undefined, ts.createBlock(buildResult,
- /*location*/ undefined,
- /*multiLine*/ buildResult.length > 0)), 4194304 /* ReuseTempVariableScope */)
- ]);
+ return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(
+ /*modifiers*/ undefined,
+ /*asteriskToken*/ undefined,
+ /*name*/ undefined,
+ /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)],
+ /*type*/ undefined, ts.createBlock(buildResult,
+ /*location*/ undefined,
+ /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */));
}
/**
* Builds the statements for the generator function body.
@@ -53535,6 +54115,76 @@ var ts;
}
}
ts.transformGenerators = transformGenerators;
+ function createGeneratorHelper(context, body) {
+ context.requestEmitHelper(generatorHelper);
+ return ts.createCall(ts.getHelperName("__generator"),
+ /*typeArguments*/ undefined, [ts.createThis(), body]);
+ }
+ // The __generator helper is used by down-level transformations to emulate the runtime
+ // semantics of an ES2015 generator function. When called, this helper returns an
+ // object that implements the Iterator protocol, in that it has `next`, `return`, and
+ // `throw` methods that step through the generator when invoked.
+ //
+ // parameters:
+ // thisArg The value to use as the `this` binding for the transformed generator body.
+ // body A function that acts as the transformed generator body.
+ //
+ // variables:
+ // _ Persistent state for the generator that is shared between the helper and the
+ // generator body. The state object has the following members:
+ // sent() - A method that returns or throws the current completion value.
+ // label - The next point at which to resume evaluation of the generator body.
+ // trys - A stack of protected regions (try/catch/finally blocks).
+ // ops - A stack of pending instructions when inside of a finally block.
+ // f A value indicating whether the generator is executing.
+ // y An iterator to delegate for a yield*.
+ // t A temporary variable that holds one of the following values (note that these
+ // cases do not overlap):
+ // - The completion value when resuming from a `yield` or `yield*`.
+ // - The error value for a catch block.
+ // - The current protected region (array of try/catch/finally/end labels).
+ // - The verb (`next`, `throw`, or `return` method) to delegate to the expression
+ // of a `yield*`.
+ // - The result of evaluating the verb delegated to the expression of a `yield*`.
+ //
+ // functions:
+ // verb(n) Creates a bound callback to the `step` function for opcode `n`.
+ // step(op) Evaluates opcodes in a generator body until execution is suspended or
+ // completed.
+ //
+ // The __generator helper understands a limited set of instructions:
+ // 0: next(value?) - Start or resume the generator with the specified value.
+ // 1: throw(error) - Resume the generator with an exception. If the generator is
+ // suspended inside of one or more protected regions, evaluates
+ // any intervening finally blocks between the current label and
+ // the nearest catch block or function boundary. If uncaught, the
+ // exception is thrown to the caller.
+ // 2: return(value?) - Resume the generator as if with a return. If the generator is
+ // suspended inside of one or more protected regions, evaluates any
+ // intervening finally blocks.
+ // 3: break(label) - Jump to the specified label. If the label is outside of the
+ // current protected region, evaluates any intervening finally
+ // blocks.
+ // 4: yield(value?) - Yield execution to the caller with an optional value. When
+ // resumed, the generator will continue at the next label.
+ // 5: yield*(value) - Delegates evaluation to the supplied iterator. When
+ // delegation completes, the generator will continue at the next
+ // label.
+ // 6: catch(error) - Handles an exception thrown from within the generator body. If
+ // the current label is inside of one or more protected regions,
+ // evaluates any intervening finally blocks between the current
+ // label and the nearest catch block or function boundary. If
+ // uncaught, the exception is thrown to the caller.
+ // 7: endfinally - Ends a finally block, resuming the last instruction prior to
+ // entering a finally block.
+ //
+ // For examples of how these are used, see the comments in ./transformers/generators.ts
+ var generatorHelper = {
+ name: "typescript:generator",
+ scoped: false,
+ priority: 6,
+ text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };"
+ };
var _a;
})(ts || (ts = {}));
/// <reference path="../factory.ts" />
@@ -53623,13 +54273,32 @@ var ts;
(function (ts) {
function transformES2015Module(context) {
var compilerOptions = context.getCompilerOptions();
+ var previousOnEmitNode = context.onEmitNode;
+ var previousOnSubstituteNode = context.onSubstituteNode;
+ context.onEmitNode = onEmitNode;
+ context.onSubstituteNode = onSubstituteNode;
+ context.enableEmitNotification(261 /* SourceFile */);
+ context.enableSubstitution(70 /* Identifier */);
+ var currentSourceFile;
return transformSourceFile;
function transformSourceFile(node) {
if (ts.isDeclarationFile(node)) {
return node;
}
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
- return ts.visitEachChild(node, visitor, context);
+ var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions);
+ if (externalHelpersModuleName) {
+ var statements = [];
+ var statementOffset = ts.addPrologueDirectives(statements, node.statements);
+ ts.append(statements, ts.createImportDeclaration(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)));
+ ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
+ return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
+ }
+ else {
+ return ts.visitEachChild(node, visitor, context);
+ }
}
return node;
}
@@ -53647,6 +54316,51 @@ var ts;
// Elide `export=` as it is not legal with --module ES6
return node.isExportEquals ? undefined : node;
}
+ //
+ // Emit Notification
+ //
+ /**
+ * Hook for node emit.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to emit.
+ * @param emit A callback used to emit the node in the printer.
+ */
+ function onEmitNode(emitContext, node, emitCallback) {
+ if (ts.isSourceFile(node)) {
+ currentSourceFile = node;
+ previousOnEmitNode(emitContext, node, emitCallback);
+ currentSourceFile = undefined;
+ }
+ else {
+ previousOnEmitNode(emitContext, node, emitCallback);
+ }
+ }
+ //
+ // Substitutions
+ //
+ /**
+ * Hooks node substitutions.
+ *
+ * @param emitContext A context hint for the emitter.
+ * @param node The node to substitute.
+ */
+ function onSubstituteNode(emitContext, node) {
+ node = previousOnSubstituteNode(emitContext, node);
+ if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) {
+ return substituteExpressionIdentifier(node);
+ }
+ return node;
+ }
+ function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ }
+ return node;
+ }
}
ts.transformES2015Module = transformES2015Module;
})(ts || (ts = {}));
@@ -53708,13 +54422,14 @@ var ts;
// The only exception in this rule is postfix unary operators,
// see comment to 'substitutePostfixUnaryExpression' for more details
// Collect information about the external module and dependency groups.
- moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver);
+ moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
// Make sure that the name of the 'exports' function does not conflict with
// existing identifiers.
exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports");
contextObject = ts.createUniqueName("context");
// Add the body of the module.
var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
+ var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
var moduleBodyFunction = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -53723,7 +54438,7 @@ var ts;
ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction),
ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject)
],
- /*type*/ undefined, createSystemModuleBody(node, dependencyGroups));
+ /*type*/ undefined, moduleBodyBlock);
// Write the call to `System.register`
// Clear the emit-helpers flag for later passes since we'll have already used it in the module body
// So the helper will be emit at the correct position instead of at the top of the source-file
@@ -53735,7 +54450,9 @@ var ts;
? [moduleName, dependencies, moduleBodyFunction]
: [dependencies, moduleBodyFunction]))
], node.statements));
- ts.setEmitFlags(updated, ts.getEmitFlags(node) & ~1 /* EmitEmitHelpers */);
+ if (!(compilerOptions.outFile || compilerOptions.out)) {
+ ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
+ }
if (noSubstitution) {
noSubstitutionMap[id] = noSubstitution;
noSubstitution = undefined;
@@ -53835,6 +54552,8 @@ var ts;
ts.createVariableDeclaration("__moduleName",
/*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id")))
])));
+ // Visit the synthetic external helpers import declaration if present
+ ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true);
// Visit the statements of the source file, emitting any transformations into
// the `executeStatements` array. We do this *before* we fill the `setters` array
// as we both emit transformations as well as aggregate some data used when creating
@@ -53861,9 +54580,7 @@ var ts;
/*multiLine*/ true)))
]),
/*multiLine*/ true)));
- var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
- ts.setEmitFlags(body, 1 /* EmitEmitHelpers */);
- return body;
+ return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true);
}
/**
* Adds an exportStar function to a statement list if it is needed for the file.
@@ -53948,7 +54665,8 @@ var ts;
var exports = ts.createIdentifier("exports");
var condition = ts.createStrictInequality(n, ts.createLiteral("default"));
if (localNames) {
- condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createHasOwnProperty(localNames, n)));
+ condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"),
+ /*typeArguments*/ undefined, [n])));
}
return ts.createFunctionDeclaration(
/*decorators*/ undefined,
@@ -53964,7 +54682,7 @@ var ts;
ts.createForIn(ts.createVariableDeclarationList([
ts.createVariableDeclaration(n, /*type*/ undefined)
]), m, ts.createBlock([
- ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 32 /* SingleLine */)
+ ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */)
])),
ts.createStatement(ts.createCall(exportFunction,
/*typeArguments*/ undefined, [exports]))
@@ -54237,7 +54955,7 @@ var ts;
*/
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
- return (ts.getEmitFlags(node) & 16777216 /* NoHoisting */) === 0
+ return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0
&& (enclosingBlockScopedContainer.kind === 261 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
@@ -54250,7 +54968,8 @@ var ts;
function transformInitializedVariable(node, isExportedDeclaration) {
var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
return ts.isBindingPattern(node.name)
- ? ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createAssignment, destructuringVisitor)
+ ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */,
+ /*needsValue*/ false, createAssignment)
: createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression));
}
/**
@@ -54314,7 +55033,7 @@ var ts;
* @param node The node to test.
*/
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;
}
/**
* Visits a DeclarationMarker used as a placeholder for the end of a transformed
@@ -54515,7 +55234,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value));
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
}
return statement;
}
@@ -54573,9 +55292,9 @@ var ts;
return visitCatchClause(node);
case 204 /* Block */:
return visitBlock(node);
- case 294 /* MergeDeclarationMarker */:
+ case 295 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 295 /* EndOfDeclarationMarker */:
+ case 296 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringVisitor(node);
@@ -54754,11 +55473,11 @@ var ts;
* @param node The node to visit.
*/
function destructuringVisitor(node) {
- if (node.transformFlags & 16384 /* DestructuringAssignment */
+ if (node.transformFlags & 1024 /* DestructuringAssignment */
&& node.kind === 192 /* BinaryExpression */) {
return visitDestructuringAssignment(node);
}
- else if (node.transformFlags & 32768 /* ContainsDestructuringAssignment */) {
+ else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) {
return ts.visitEachChild(node, destructuringVisitor, context);
}
else {
@@ -54772,7 +55491,8 @@ var ts;
*/
function visitDestructuringAssignment(node) {
if (hasExportedReferenceInDestructuringTarget(node.left)) {
- return ts.flattenDestructuringAssignment(context, node, /*needsValue*/ true, hoistVariableDeclaration, destructuringVisitor);
+ return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */,
+ /*needsValue*/ true);
}
return ts.visitEachChild(node, destructuringVisitor, context);
}
@@ -54896,6 +55616,13 @@ var ts;
* @param node The node to substitute.
*/
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
// When we see an identifier in an expression position that
// points to an imported symbol, we should substitute a qualified
// reference to the imported symbol if one is needed.
@@ -55043,7 +55770,7 @@ var ts;
_a[ts.ModuleKind.AMD] = transformAMDModule,
_a[ts.ModuleKind.UMD] = transformUMDModule,
_a));
- var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
+ var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment;
var compilerOptions = context.getCompilerOptions();
var resolver = context.getEmitResolver();
var host = context.getEmitHost();
@@ -55077,7 +55804,7 @@ var ts;
return node;
}
currentSourceFile = node;
- currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver);
+ currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions);
// Perform the transformation.
var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None];
var updated = transformModule(node);
@@ -55094,12 +55821,13 @@ var ts;
startLexicalEnvironment();
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
ts.addRange(statements, endLexicalEnvironment());
addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements));
if (currentModuleInfo.hasExportStarsToExportValues) {
- ts.setEmitFlags(updated, 2 /* EmitExportStar */ | ts.getEmitFlags(node));
+ ts.addEmitHelper(updated, exportStarHelper);
}
return updated;
}
@@ -55119,8 +55847,7 @@ var ts;
* @param node The SourceFile node.
*/
function transformUMDModule(node) {
- var define = ts.createIdentifier("define");
- ts.setEmitFlags(define, 16 /* UMDDefine */);
+ var define = ts.createRawExpression(umdHelper);
return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false);
}
/**
@@ -55217,7 +55944,7 @@ var ts;
if (includeNonAmdDependencies && importAliasName) {
// Set emitFlags on the name of the classDeclaration
// This is so that when printer will not substitute the identifier
- ts.setEmitFlags(importAliasName, 128 /* NoSubstitution */);
+ ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName));
}
@@ -55237,6 +55964,7 @@ var ts;
var statements = [];
var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor);
// Visit each statement of the module body.
+ ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true));
ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset));
// End the lexical environment for the module body
// and merge any new lexical declarations.
@@ -55247,7 +55975,7 @@ var ts;
if (currentModuleInfo.hasExportStarsToExportValues) {
// If we have any `export * from ...` declarations
// we need to inform the emitter to add the __export helper.
- ts.setEmitFlags(body, 2 /* EmitExportStar */);
+ ts.addEmitHelper(body, exportStarHelper);
}
return body;
}
@@ -55264,13 +55992,13 @@ var ts;
if (emitAsReturn) {
var statement = ts.createReturn(currentModuleInfo.exportEquals.expression,
/*location*/ currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 12288 /* NoTokenSourceMaps */ | 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */);
statements.push(statement);
}
else {
var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression),
/*location*/ currentModuleInfo.exportEquals);
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
statements.push(statement);
}
}
@@ -55299,9 +56027,9 @@ var ts;
return visitFunctionDeclaration(node);
case 226 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 294 /* MergeDeclarationMarker */:
+ case 295 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 295 /* EndOfDeclarationMarker */:
+ case 296 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
// This visitor does not descend into the tree, as export/import statements
@@ -55590,7 +56318,9 @@ var ts;
*/
function transformInitializedVariable(node) {
if (ts.isBindingPattern(node.name)) {
- return ts.flattenVariableDestructuringToExpression(node, hoistVariableDeclaration, createExportExpression);
+ return ts.flattenDestructuringAssignment(node,
+ /*visitor*/ undefined, context, 0 /* All */,
+ /*needsValue*/ false, createExportExpression);
}
else {
return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name,
@@ -55623,7 +56353,7 @@ var ts;
* @param node The node to test.
*/
function hasAssociatedEndOfDeclarationMarker(node) {
- return (ts.getEmitFlags(node) & 33554432 /* HasEndOfDeclarationMarker */) !== 0;
+ return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0;
}
/**
* Visits a DeclarationMarker used as a placeholder for the end of a transformed
@@ -55826,7 +56556,7 @@ var ts;
var statement = ts.createStatement(createExportExpression(name, value), location);
ts.startOnNewLine(statement);
if (!allowComments) {
- ts.setEmitFlags(statement, 49152 /* NoComments */);
+ ts.setEmitFlags(statement, 1536 /* NoComments */);
}
return statement;
}
@@ -55947,6 +56677,13 @@ var ts;
* @param node The node to substitute.
*/
function substituteExpressionIdentifier(node) {
+ if (ts.getEmitFlags(node) & 4096 /* HelperName */) {
+ var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
+ if (externalHelpersModuleName) {
+ return ts.createPropertyAccess(externalHelpersModuleName, node);
+ }
+ return node;
+ }
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
if (exportContainer && exportContainer.kind === 261 /* SourceFile */) {
@@ -55960,8 +56697,8 @@ var ts;
/*location*/ node);
}
else if (ts.isImportSpecifier(importDeclaration)) {
- var name_36 = importDeclaration.propertyName || importDeclaration.name;
- return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_36),
+ var name_37 = importDeclaration.propertyName || importDeclaration.name;
+ return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37),
/*location*/ node);
}
}
@@ -56057,6 +56794,14 @@ var ts;
var _a;
}
ts.transformModule = transformModule;
+ // emit output for the __export helper function
+ var exportStarHelper = {
+ name: "typescript:export-star",
+ scoped: true,
+ text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }"
+ };
+ // emit output for the UMD helper function.
+ var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })";
})(ts || (ts = {}));
/// <reference path="visitor.ts" />
/// <reference path="transformers/ts.ts" />
@@ -56126,23 +56871,29 @@ var ts;
* @param transforms An array of Transformers.
*/
function transformFiles(resolver, host, sourceFiles, transformers) {
+ var enabledSyntaxKindFeatures = new Array(298 /* Count */);
+ var lexicalEnvironmentDisabled = false;
+ var lexicalEnvironmentVariableDeclarations;
+ var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
var lexicalEnvironmentFunctionDeclarationsStack = [];
- var enabledSyntaxKindFeatures = new Array(296 /* Count */);
var lexicalEnvironmentStackOffset = 0;
- var hoistedVariableDeclarations;
- var hoistedFunctionDeclarations;
- var lexicalEnvironmentDisabled;
+ var lexicalEnvironmentSuspended = false;
+ var emitHelpers;
// The transformation context is provided to each transformer as part of transformer
// initialization.
var context = {
getCompilerOptions: function () { return host.getCompilerOptions(); },
getEmitResolver: function () { return resolver; },
getEmitHost: function () { return host; },
- hoistVariableDeclaration: hoistVariableDeclaration,
- hoistFunctionDeclaration: hoistFunctionDeclaration,
startLexicalEnvironment: startLexicalEnvironment,
+ suspendLexicalEnvironment: suspendLexicalEnvironment,
+ resumeLexicalEnvironment: resumeLexicalEnvironment,
endLexicalEnvironment: endLexicalEnvironment,
+ hoistVariableDeclaration: hoistVariableDeclaration,
+ hoistFunctionDeclaration: hoistFunctionDeclaration,
+ requestEmitHelper: requestEmitHelper,
+ readEmitHelpers: readEmitHelpers,
onSubstituteNode: function (_emitContext, node) { return node; },
enableSubstitution: enableSubstitution,
isSubstitutionEnabled: isSubstitutionEnabled,
@@ -56183,7 +56934,7 @@ var ts;
*/
function isSubstitutionEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0
- && (ts.getEmitFlags(node) & 128 /* NoSubstitution */) === 0;
+ && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0;
}
/**
* Emits a node with possible substitution.
@@ -56216,7 +56967,7 @@ var ts;
*/
function isEmitNotificationEnabled(node) {
return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0
- || (ts.getEmitFlags(node) & 64 /* AdviseOnEmitNode */) !== 0;
+ || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0;
}
/**
* Emits a node with possible emit notification.
@@ -56241,11 +56992,11 @@ var ts;
function hoistVariableDeclaration(name) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
var decl = ts.createVariableDeclaration(name);
- if (!hoistedVariableDeclarations) {
- hoistedVariableDeclarations = [decl];
+ if (!lexicalEnvironmentVariableDeclarations) {
+ lexicalEnvironmentVariableDeclarations = [decl];
}
else {
- hoistedVariableDeclarations.push(decl);
+ lexicalEnvironmentVariableDeclarations.push(decl);
}
}
/**
@@ -56253,11 +57004,11 @@ var ts;
*/
function hoistFunctionDeclaration(func) {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
- if (!hoistedFunctionDeclarations) {
- hoistedFunctionDeclarations = [func];
+ if (!lexicalEnvironmentFunctionDeclarations) {
+ lexicalEnvironmentFunctionDeclarations = [func];
}
else {
- hoistedFunctionDeclarations.push(func);
+ lexicalEnvironmentFunctionDeclarations.push(func);
}
}
/**
@@ -56266,15 +57017,28 @@ var ts;
*/
function startLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
// Save the current lexical environment. Rather than resizing the array we adjust the
// stack size variable. This allows us to reuse existing array slots we've
// already allocated between transformations to avoid allocation and GC overhead during
// transformation.
- lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedVariableDeclarations;
- lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = hoistedFunctionDeclarations;
+ lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
+ lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
lexicalEnvironmentStackOffset++;
- hoistedVariableDeclarations = undefined;
- hoistedFunctionDeclarations = undefined;
+ lexicalEnvironmentVariableDeclarations = undefined;
+ lexicalEnvironmentFunctionDeclarations = undefined;
+ }
+ /** Suspends the current lexical environment, usually after visiting a parameter list. */
+ function suspendLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
+ lexicalEnvironmentSuspended = true;
+ }
+ /** Resumes a suspended lexical environment, usually before visiting a function body. */
+ function resumeLexicalEnvironment() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase.");
+ ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
+ lexicalEnvironmentSuspended = false;
}
/**
* Ends a lexical environment. The previous set of hoisted declarations are restored and
@@ -56282,14 +57046,15 @@ var ts;
*/
function endLexicalEnvironment() {
ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase.");
+ ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
var statements;
- if (hoistedVariableDeclarations || hoistedFunctionDeclarations) {
- if (hoistedFunctionDeclarations) {
- statements = hoistedFunctionDeclarations.slice();
+ if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) {
+ if (lexicalEnvironmentFunctionDeclarations) {
+ statements = lexicalEnvironmentFunctionDeclarations.slice();
}
- if (hoistedVariableDeclarations) {
+ if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
- /*modifiers*/ undefined, ts.createVariableDeclarationList(hoistedVariableDeclarations));
+ /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
if (!statements) {
statements = [statement];
}
@@ -56300,10 +57065,25 @@ var ts;
}
// Restore the previous lexical environment.
lexicalEnvironmentStackOffset--;
- hoistedVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
- hoistedFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
+ lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
+ if (lexicalEnvironmentStackOffset === 0) {
+ lexicalEnvironmentVariableDeclarationsStack = [];
+ lexicalEnvironmentFunctionDeclarationsStack = [];
+ }
return statements;
}
+ function requestEmitHelper(helper) {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
+ emitHelpers = ts.append(emitHelpers, helper);
+ }
+ function readEmitHelpers() {
+ ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase.");
+ var helpers = emitHelpers;
+ emitHelpers = undefined;
+ return helpers;
+ }
}
ts.transformFiles = transformFiles;
var _a;
@@ -56528,12 +57308,12 @@ var ts;
var emitNode = node.emitNode;
var emitFlags = emitNode && emitNode.flags;
var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end;
- if (node.kind !== 292 /* NotEmittedStatement */
- && (emitFlags & 512 /* NoLeadingSourceMap */) === 0
+ if (node.kind !== 293 /* NotEmittedStatement */
+ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitPos(ts.skipTrivia(currentSourceText, pos));
}
- if (emitFlags & 2048 /* NoNestedSourceMaps */) {
+ if (emitFlags & 64 /* NoNestedSourceMaps */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56541,8 +57321,8 @@ var ts;
else {
emitCallback(emitContext, node);
}
- if (node.kind !== 292 /* NotEmittedStatement */
- && (emitFlags & 1024 /* NoTrailingSourceMap */) === 0
+ if (node.kind !== 293 /* NotEmittedStatement */
+ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitPos(end);
}
@@ -56564,13 +57344,13 @@ var ts;
var emitFlags = emitNode && emitNode.flags;
var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos);
- if ((emitFlags & 4096 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
tokenPos = emitCallback(token, tokenPos);
if (range)
tokenPos = range.end;
- if ((emitFlags & 8192 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
+ if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
emitPos(tokenPos);
}
return tokenPos;
@@ -56707,7 +57487,7 @@ var ts;
var emitFlags = ts.getEmitFlags(node);
if ((pos < 0 && end < 0) || (pos === end)) {
// Both pos and end are synthesized, so just emit the node without comments.
- if (emitFlags & 65536 /* NoNestedComments */) {
+ if (emitFlags & 2048 /* NoNestedComments */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56720,9 +57500,9 @@ var ts;
if (extendedDiagnostics) {
ts.performance.mark("preEmitNodeWithComment");
}
- var isEmittedNode = node.kind !== 292 /* NotEmittedStatement */;
- var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0;
- var skipTrailingComments = end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0;
+ var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;
+ var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;
// Emit leading comments if the position is not synthesized and the node
// has not opted out from emitting leading comments.
if (!skipLeadingComments) {
@@ -56746,7 +57526,7 @@ var ts;
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitNodeWithComment");
}
- if (emitFlags & 65536 /* NoNestedComments */) {
+ if (emitFlags & 2048 /* NoNestedComments */) {
disabled = true;
emitCallback(emitContext, node);
disabled = false;
@@ -56778,15 +57558,15 @@ var ts;
}
var pos = detachedRange.pos, end = detachedRange.end;
var emitFlags = ts.getEmitFlags(node);
- var skipLeadingComments = pos < 0 || (emitFlags & 16384 /* NoLeadingComments */) !== 0;
- var skipTrailingComments = disabled || end < 0 || (emitFlags & 32768 /* NoTrailingComments */) !== 0;
+ var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0;
+ var skipTrailingComments = disabled || end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0;
if (!skipLeadingComments) {
emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
}
if (extendedDiagnostics) {
ts.performance.measure("commentTime", "preEmitBodyWithDetachedComments");
}
- if (emitFlags & 65536 /* NoNestedComments */ && !disabled) {
+ if (emitFlags & 2048 /* NoNestedComments */ && !disabled) {
disabled = true;
emitCallback(node);
disabled = false;
@@ -57241,15 +58021,15 @@ var ts;
}
}
function emitLines(nodes) {
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
+ for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
+ var node = nodes_4[_i];
emit(node);
}
}
function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) {
var currentWriterPos = writer.getTextPos();
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
+ for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
+ var node = nodes_5[_i];
if (!canEmitFn || canEmitFn(node)) {
if (currentWriterPos !== writer.getTextPos()) {
write(separator);
@@ -57264,7 +58044,7 @@ var ts;
}
function writeJsDocComments(declaration) {
if (declaration) {
- var jsDocComments = ts.getJsDocCommentsFromText(declaration, currentText);
+ var jsDocComments = ts.getJSDocCommentRanges(declaration, currentText);
ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments);
// jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space
ts.emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, ts.writeCommentRange);
@@ -57459,9 +58239,9 @@ var ts;
var count = 0;
while (true) {
count++;
- var name_37 = baseName + "_" + count;
- if (!(name_37 in currentIdentifiers)) {
- return name_37;
+ var name_38 = baseName + "_" + count;
+ if (!(name_38 in currentIdentifiers)) {
+ return name_38;
}
}
}
@@ -57872,6 +58652,9 @@ var ts;
case 225 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
+ case 228 /* TypeAliasDeclaration */:
+ diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
+ break;
default:
ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
}
@@ -57968,7 +58751,10 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
- emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false);
+ var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); });
+ if (interfaceExtendsTypes && interfaceExtendsTypes.length) {
+ emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false);
+ }
write(" {");
writeLine();
increaseIndent();
@@ -58619,87 +59405,6 @@ var ts;
function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) {
var delimiters = createDelimiterMap();
var brackets = createBracketsMap();
- // emit output for the __extends helper function
- var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};";
- // Emit output for the __assign helper function.
- // This is typically used for JSX spread attributes,
- // and can be used for object literal spread properties.
- var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};";
- var restHelper = "\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && !e.indexOf(p))\n t[p] = s[p];\n return t;\n};";
- // emit output for the __decorate helper function
- var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};";
- // emit output for the __metadata helper function
- var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};";
- // emit output for the __param helper function
- var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};";
- // emit output for the __awaiter helper function
- var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};";
- // The __generator helper is used by down-level transformations to emulate the runtime
- // semantics of an ES2015 generator function. When called, this helper returns an
- // object that implements the Iterator protocol, in that it has `next`, `return`, and
- // `throw` methods that step through the generator when invoked.
- //
- // parameters:
- // thisArg The value to use as the `this` binding for the transformed generator body.
- // body A function that acts as the transformed generator body.
- //
- // variables:
- // _ Persistent state for the generator that is shared between the helper and the
- // generator body. The state object has the following members:
- // sent() - A method that returns or throws the current completion value.
- // label - The next point at which to resume evaluation of the generator body.
- // trys - A stack of protected regions (try/catch/finally blocks).
- // ops - A stack of pending instructions when inside of a finally block.
- // f A value indicating whether the generator is executing.
- // y An iterator to delegate for a yield*.
- // t A temporary variable that holds one of the following values (note that these
- // cases do not overlap):
- // - The completion value when resuming from a `yield` or `yield*`.
- // - The error value for a catch block.
- // - The current protected region (array of try/catch/finally/end labels).
- // - The verb (`next`, `throw`, or `return` method) to delegate to the expression
- // of a `yield*`.
- // - The result of evaluating the verb delegated to the expression of a `yield*`.
- //
- // functions:
- // verb(n) Creates a bound callback to the `step` function for opcode `n`.
- // step(op) Evaluates opcodes in a generator body until execution is suspended or
- // completed.
- //
- // The __generator helper understands a limited set of instructions:
- // 0: next(value?) - Start or resume the generator with the specified value.
- // 1: throw(error) - Resume the generator with an exception. If the generator is
- // suspended inside of one or more protected regions, evaluates
- // any intervening finally blocks between the current label and
- // the nearest catch block or function boundary. If uncaught, the
- // exception is thrown to the caller.
- // 2: return(value?) - Resume the generator as if with a return. If the generator is
- // suspended inside of one or more protected regions, evaluates any
- // intervening finally blocks.
- // 3: break(label) - Jump to the specified label. If the label is outside of the
- // current protected region, evaluates any intervening finally
- // blocks.
- // 4: yield(value?) - Yield execution to the caller with an optional value. When
- // resumed, the generator will continue at the next label.
- // 5: yield*(value) - Delegates evaluation to the supplied iterator. When
- // delegation completes, the generator will continue at the next
- // label.
- // 6: catch(error) - Handles an exception thrown from within the generator body. If
- // the current label is inside of one or more protected regions,
- // evaluates any intervening finally blocks between the current
- // label and the nearest catch block or function boundary. If
- // uncaught, the exception is thrown to the caller.
- // 7: endfinally - Ends a finally block, resuming the last instruction prior to
- // entering a finally block.
- //
- // For examples of how these are used, see the comments in ./transformers/generators.ts
- var generatorHelper = "\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};";
- // emit output for the __export helper function
- var exportStarHelper = "\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}";
- // emit output for the UMD helper function.
- var umdHelper = "\n(function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n})";
- var superHelper = "\nconst _super = name => super[name];";
- var advancedSuperHelper = "\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);";
var compilerOptions = host.getCompilerOptions();
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
@@ -58721,12 +59426,7 @@ var ts;
var currentSourceFile;
var currentText;
var currentFileIdentifiers;
- var extendsEmitted;
- var assignEmitted;
- var restEmitted;
- var decorateEmitted;
- var paramEmitted;
- var awaiterEmitted;
+ var bundledHelpers;
var isOwnFileEmit;
var emitSkipped = false;
var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile);
@@ -58779,12 +59479,13 @@ var ts;
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNameSet = ts.createMap();
+ bundledHelpers = isBundledEmit ? ts.createMap() : undefined;
isOwnFileEmit = !isBundledEmit;
// Emit helpers from all the files
if (isBundledEmit && moduleKind) {
for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) {
var sourceFile = sourceFiles_5[_a];
- emitEmitHelpers(sourceFile);
+ emitHelpers(sourceFile, /*isBundle*/ true);
}
}
// Print each transformed source file.
@@ -58796,14 +59497,14 @@ var ts;
}
// Write the source map
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles);
}
// Record source map data for the test harness.
if (sourceMapDataList) {
sourceMapDataList.push(sourceMap.getSourceMapData());
}
// Write the output file
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM);
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles);
// Reset state
sourceMap.reset();
comments.reset();
@@ -58811,11 +59512,6 @@ var ts;
tempFlags = 0 /* Auto */;
currentSourceFile = undefined;
currentText = undefined;
- extendsEmitted = false;
- assignEmitted = false;
- decorateEmitted = false;
- paramEmitted = false;
- awaiterEmitted = false;
isOwnFileEmit = false;
}
function printSourceFile(node) {
@@ -59279,8 +59975,10 @@ var ts;
case 247 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
// Transformation nodes
- case 293 /* PartiallyEmittedExpression */:
+ case 294 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
+ case 297 /* RawExpression */:
+ return writeLines(node.text);
}
}
//
@@ -59313,12 +60011,7 @@ var ts;
// Identifiers
//
function emitIdentifier(node) {
- if (ts.getEmitFlags(node) & 16 /* UMDDefine */) {
- writeLines(umdHelper);
- }
- else {
- write(getTextOfNode(node, /*includeTrivia*/ false));
- }
+ write(getTextOfNode(node, /*includeTrivia*/ false));
}
//
// Names
@@ -59579,7 +60272,7 @@ var ts;
write("{}");
}
else {
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
@@ -59594,7 +60287,7 @@ var ts;
function emitPropertyAccessExpression(node) {
var indentBeforeDot = false;
var indentAfterDot = false;
- if (!(ts.getEmitFlags(node) & 1048576 /* NoIndentation */)) {
+ if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) {
var dotRangeStart = node.expression.end;
var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1;
var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd };
@@ -59801,7 +60494,7 @@ var ts;
}
}
function emitBlockStatements(node) {
- if (ts.getEmitFlags(node) & 32 /* SingleLine */) {
+ if (ts.getEmitFlags(node) & 1 /* SingleLine */) {
emitList(node, node.statements, 384 /* SingleLineBlockStatements */);
}
else {
@@ -59980,11 +60673,11 @@ var ts;
var body = node.body;
if (body) {
if (ts.isBlock(body)) {
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
- if (ts.getEmitFlags(node) & 4194304 /* ReuseTempVariableScope */) {
+ if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) {
emitSignatureHead(node);
emitBlockFunctionBody(body);
}
@@ -60022,7 +60715,7 @@ var ts;
// * The body is explicitly marked as multi-line.
// * A non-synthesized body's start and end position are on different lines.
// * Any statement in the body starts on a new line.
- if (ts.getEmitFlags(body) & 32 /* SingleLine */) {
+ if (ts.getEmitFlags(body) & 1 /* SingleLine */) {
return true;
}
if (body.multiLine) {
@@ -60078,7 +60771,7 @@ var ts;
emitModifiers(node, node.modifiers);
write("class");
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
- var indentedFlag = ts.getEmitFlags(node) & 524288 /* Indented */;
+ var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */;
if (indentedFlag) {
increaseIndent();
}
@@ -60358,7 +61051,7 @@ var ts;
// "comment1" is not considered to be leading comment for node.initializer
// but rather a trailing comment on the previous node.
var initializer = node.initializer;
- if ((ts.getEmitFlags(initializer) & 16384 /* NoLeadingComments */) === 0) {
+ if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) {
var commentRange = ts.getCommentRange(initializer);
emitTrailingCommentsOfPosition(commentRange.pos);
}
@@ -60424,78 +61117,37 @@ var ts;
}
return statements.length;
}
- function emitHelpers(node) {
- var emitFlags = ts.getEmitFlags(node);
+ function emitHelpers(node, isBundle) {
+ var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile;
+ var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined);
+ var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit;
var helpersEmitted = false;
- if (emitFlags & 1 /* EmitEmitHelpers */) {
- helpersEmitted = emitEmitHelpers(currentSourceFile);
- }
- if (emitFlags & 2 /* EmitExportStar */) {
- writeLines(exportStarHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 4 /* EmitSuperHelper */) {
- writeLines(superHelper);
- helpersEmitted = true;
- }
- if (emitFlags & 8 /* EmitAdvancedSuperHelper */) {
- writeLines(advancedSuperHelper);
- helpersEmitted = true;
- }
- return helpersEmitted;
- }
- function emitEmitHelpers(node) {
- // Only emit helpers if the user did not say otherwise.
- if (compilerOptions.noEmitHelpers) {
- return false;
- }
- // Don't emit helpers if we can import them.
- if (compilerOptions.importHelpers
- && (ts.isExternalModule(node) || compilerOptions.isolatedModules)) {
- return false;
- }
- var helpersEmitted = false;
- // Only Emit __extends function when target ES5.
- // For target ES6 and above, we can emit classDeclaration as is.
- if ((languageVersion < 2 /* ES2015 */) && (!extendsEmitted && node.flags & 1024 /* HasClassExtends */)) {
- writeLines(extendsHelper);
- extendsEmitted = true;
- helpersEmitted = true;
- }
- if ((languageVersion < 5 /* ESNext */ || currentSourceFile.scriptKind === 2 /* JSX */ || currentSourceFile.scriptKind === 4 /* TSX */) &&
- compilerOptions.jsx !== 1 /* Preserve */ &&
- !assignEmitted &&
- node.flags & 16384 /* HasSpreadAttribute */) {
- writeLines(assignHelper);
- assignEmitted = true;
- }
- if (languageVersion < 5 /* ESNext */ && !restEmitted && node.flags & 32768 /* HasRestAttribute */) {
- writeLines(restHelper);
- restEmitted = true;
- }
- if (!decorateEmitted && node.flags & 2048 /* HasDecorators */) {
- writeLines(decorateHelper);
- if (compilerOptions.emitDecoratorMetadata) {
- writeLines(metadataHelper);
- }
- decorateEmitted = true;
- helpersEmitted = true;
- }
- if (!paramEmitted && node.flags & 4096 /* HasParamDecorators */) {
- writeLines(paramHelper);
- paramEmitted = true;
- helpersEmitted = true;
- }
- // Only emit __awaiter function when target ES5/ES6.
- // Only emit __generator function when target ES5.
- // For target ES2017 and above, we can emit async/await as is.
- if ((languageVersion < 4 /* ES2017 */) && (!awaiterEmitted && node.flags & 8192 /* HasAsyncFunctions */)) {
- writeLines(awaiterHelper);
- if (languageVersion < 2 /* ES2015 */) {
- writeLines(generatorHelper);
+ var helpers = ts.getEmitHelpers(node);
+ if (helpers) {
+ for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) {
+ var helper = _b[_a];
+ if (!helper.scoped) {
+ // Skip the helper if it can be skipped and the noEmitHelpers compiler
+ // option is set, or if it can be imported and the importHelpers compiler
+ // option is set.
+ if (shouldSkip)
+ continue;
+ // Skip the helper if it can be bundled but hasn't already been emitted and we
+ // are emitting a bundled module.
+ if (shouldBundle) {
+ if (bundledHelpers[helper.name]) {
+ continue;
+ }
+ bundledHelpers[helper.name] = true;
+ }
+ }
+ else if (isBundle) {
+ // Skip the helper if it is scoped and we are emitting bundled helpers
+ continue;
+ }
+ writeLines(helper.text);
+ helpersEmitted = true;
}
- awaiterEmitted = true;
- helpersEmitted = true;
}
if (helpersEmitted) {
writeLine();
@@ -60503,9 +61155,10 @@ var ts;
return helpersEmitted;
}
function writeLines(text) {
- var lines = text.split(/\r\n|\r|\n/g);
+ var lines = text.split(/\r\n?|\n/g);
+ var indentation = guessIndentation(lines);
for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
+ var line = indentation ? lines[i].slice(indentation) : lines[i];
if (line.length) {
if (i > 0) {
writeLine();
@@ -60514,6 +61167,21 @@ var ts;
}
}
}
+ function guessIndentation(lines) {
+ var indentation;
+ for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
+ var line = lines_1[_a];
+ for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) {
+ if (!ts.isWhiteSpace(line.charCodeAt(i))) {
+ if (indentation === undefined || i < indentation) {
+ indentation = i;
+ break;
+ }
+ }
+ }
+ }
+ return indentation;
+ }
//
// Helpers
//
@@ -60881,10 +61549,10 @@ var ts;
*/
function makeTempVariableName(flags) {
if (flags && !(tempFlags & flags)) {
- var name_38 = flags === 268435456 /* _i */ ? "_i" : "_n";
- if (isUniqueName(name_38)) {
+ var name_39 = flags === 268435456 /* _i */ ? "_i" : "_n";
+ if (isUniqueName(name_39)) {
tempFlags |= flags;
- return name_38;
+ return name_39;
}
}
while (true) {
@@ -60892,11 +61560,11 @@ var ts;
tempFlags++;
// Skip over 'i' and 'n'
if (count !== 8 && count !== 13) {
- var name_39 = count < 26
+ var name_40 = count < 26
? "_" + String.fromCharCode(97 /* a */ + count)
: "_" + (count - 26);
- if (isUniqueName(name_39)) {
- return name_39;
+ if (isUniqueName(name_40)) {
+ return name_40;
}
}
}
@@ -61121,8 +61789,6 @@ var ts;
/// <reference path="core.ts" />
var ts;
(function (ts) {
- /** The version of the TypeScript compiler release */
- ts.version = "2.2.0-dev.20161115";
var emptyArray = [];
function findConfigFile(searchPath, fileExists, configName) {
if (configName === void 0) { configName = "tsconfig.json"; }
@@ -61349,10 +62015,10 @@ var ts;
var resolutions = [];
var cache = ts.createMap();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
- var name_40 = names_1[_i];
- var result = name_40 in cache
- ? cache[name_40]
- : cache[name_40] = loader(name_40, containingFile);
+ var name_41 = names_1[_i];
+ var result = name_41 in cache
+ ? cache[name_41]
+ : cache[name_41] = loader(name_41, containingFile);
resolutions.push(result);
}
return resolutions;
@@ -61422,7 +62088,8 @@ var ts;
var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host);
if (typeReferences.length) {
// This containingFilename needs to match with the one used in managed-side
- var containingFilename = ts.combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
+ var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
+ var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts");
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (var i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
@@ -62003,8 +62670,8 @@ var ts;
}
break;
}
- for (var _b = 0, nodes_4 = nodes; _b < nodes_4.length; _b++) {
- var node = nodes_4[_b];
+ for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) {
+ var node = nodes_6[_b];
walk(node);
}
}
@@ -63108,12 +63775,19 @@ var ts;
}
];
/* @internal */
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
+ /* @deprecated typingOptions.enableAutoDiscovery
+ * Use typeAcquisition.enable instead.
+ */
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -63139,6 +63813,20 @@ var ts;
};
var optionNameMapCache;
/* @internal */
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
+ /* @internal */
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -63379,11 +64067,11 @@ var ts;
function serializeCompilerOptions(options) {
var result = ts.createMap();
var optionsNameMap = getOptionNameMap().optionNameMap;
- for (var name_41 in options) {
- if (ts.hasProperty(options, name_41)) {
+ for (var name_42 in options) {
+ if (ts.hasProperty(options, name_42)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
- switch (name_41) {
+ switch (name_42) {
case "init":
case "watch":
case "version":
@@ -63391,14 +64079,14 @@ var ts;
case "project":
break;
default:
- var value = options[name_41];
- var optionDefinition = optionsNameMap[name_41.toLowerCase()];
+ var value = options[name_42];
+ var optionDefinition = optionsNameMap[name_42.toLowerCase()];
if (optionDefinition) {
var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
if (!customTypeMap) {
// There is no map associated with this compiler option then use the value as-is
// This is the case if the value is expect to be string, number, boolean or list of string
- result[name_41] = value;
+ result[name_42] = value;
}
else {
if (optionDefinition.type === "list") {
@@ -63407,11 +64095,11 @@ var ts;
var element = _a[_i];
convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap));
}
- result[name_41] = convertedValue;
+ result[name_42] = convertedValue;
}
else {
// There is a typeMap associated with this command-line option so use it to map value back to its name
- result[name_41] = getNameOfCompilerOptionValue(value, customTypeMap);
+ result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap);
}
}
}
@@ -63464,14 +64152,17 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ // typingOptions has been deprecated and is only supported for backward compatibility purposes.
+ // It should be removed in future releases - use typeAcquisition instead.
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -63498,7 +64189,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -63507,7 +64198,7 @@ var ts;
function tryExtendsName(extendedConfig) {
// If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future)
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -63571,8 +64262,8 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- // By default, exclude common package folders and the outDir
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ // If no includes were specified, exclude common package folders and the outDir
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -63607,12 +64298,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -63620,9 +64311,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -64527,7 +65219,7 @@ var ts;
case 243 /* ExportSpecifier */:
case 237 /* NamespaceImport */:
return ts.ScriptElementKind.alias;
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return ts.ScriptElementKind.typeElement;
default:
return ts.ScriptElementKind.unknown;
@@ -64763,7 +65455,7 @@ var ts;
// for the position of the relevant node (or comma).
var syntaxList = ts.forEach(node.parent.getChildren(), function (c) {
// find syntax list that covers the span of the node
- if (c.kind === 291 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
+ if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) {
return c;
}
});
@@ -65073,11 +65765,11 @@ var ts;
}
}
if (node) {
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- if (jsDocComment.tags) {
- for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) {
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ if (jsDoc.tags) {
+ for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) {
var tag = _c[_b];
if (tag.pos <= position && position <= tag.end) {
return tag;
@@ -65416,7 +66108,7 @@ var ts;
if (isImportOrExportSpecifierName(location)) {
return location.getText();
}
- else if (ts.isStringOrNumericLiteral(location.kind) &&
+ else if (ts.isStringOrNumericLiteral(location) &&
location.parent.kind === 142 /* ComputedPropertyName */) {
return location.text;
}
@@ -66153,16 +66845,16 @@ var ts;
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */);
pos = tag.tagName.end;
switch (tag.kind) {
- case 280 /* JSDocParameterTag */:
+ case 281 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 283 /* JSDocTemplateTag */:
+ case 284 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
break;
- case 282 /* JSDocTypeTag */:
+ case 283 /* JSDocTypeTag */:
processElement(tag.typeExpression);
break;
- case 281 /* JSDocReturnTag */:
+ case 282 /* JSDocReturnTag */:
processElement(tag.typeExpression);
break;
}
@@ -66440,14 +67132,14 @@ var ts;
function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) {
var entries = [];
var nameTable = ts.getNameTable(sourceFile);
- for (var name_42 in nameTable) {
+ for (var name_43 in nameTable) {
// Skip identifiers produced only from the current location
- if (nameTable[name_42] === position) {
+ if (nameTable[name_43] === position) {
continue;
}
- if (!uniqueNames[name_42]) {
- uniqueNames[name_42] = name_42;
- var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), compilerOptions.target, /*performCharacterChecks*/ true);
+ if (!uniqueNames[name_43]) {
+ uniqueNames[name_43] = name_43;
+ var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, /*performCharacterChecks*/ true);
if (displayName) {
var entry = {
name: displayName,
@@ -66960,11 +67652,11 @@ var ts;
if (currentConfigPath) {
paths.push(currentConfigPath);
currentDir = ts.getDirectoryPath(currentConfigPath);
- var parent_14 = ts.getDirectoryPath(currentDir);
- if (currentDir === parent_14) {
+ var parent_13 = ts.getDirectoryPath(currentDir);
+ if (currentDir === parent_13) {
break;
}
- currentDir = parent_14;
+ currentDir = parent_13;
}
else {
break;
@@ -67045,14 +67737,14 @@ var ts;
// Compute all the completion symbols again.
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_2 = completionData.location;
+ var symbols = completionData.symbols, location_3 = completionData.location;
// Find the symbol with the matching entry name.
// We don't need to perform character checks here because we're only comparing the
// name against 'entryName' (which is known to be good), not building a new
// completion entry.
- var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; });
+ var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; });
if (symbol) {
- var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
+ var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind;
return {
name: entryName,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
@@ -67080,12 +67772,12 @@ var ts;
// Compute all the completion symbols again.
var completionData = getCompletionData(typeChecker, log, sourceFile, position);
if (completionData) {
- var symbols = completionData.symbols, location_3 = completionData.location;
+ var symbols = completionData.symbols, location_4 = completionData.location;
// Find the symbol with the matching entry name.
// We don't need to perform character checks here because we're only comparing the
// name against 'entryName' (which is known to be good), not building a new
// completion entry.
- return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; });
+ return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; });
}
return undefined;
}
@@ -67116,9 +67808,9 @@ var ts;
isJsDocTagName = true;
}
switch (tag.kind) {
- case 282 /* JSDocTypeTag */:
- case 280 /* JSDocParameterTag */:
- case 281 /* JSDocReturnTag */:
+ case 283 /* JSDocTypeTag */:
+ case 281 /* JSDocParameterTag */:
+ case 282 /* JSDocReturnTag */:
var tagWithExpression = tag;
if (tagWithExpression.typeExpression) {
insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end;
@@ -67163,13 +67855,13 @@ var ts;
log("Returning an empty list because completion was requested in an invalid position.");
return undefined;
}
- var parent_15 = contextToken.parent, kind = contextToken.kind;
+ var parent_14 = contextToken.parent, kind = contextToken.kind;
if (kind === 22 /* DotToken */) {
- if (parent_15.kind === 177 /* PropertyAccessExpression */) {
+ if (parent_14.kind === 177 /* PropertyAccessExpression */) {
node = contextToken.parent.expression;
isRightOfDot = true;
}
- else if (parent_15.kind === 141 /* QualifiedName */) {
+ else if (parent_14.kind === 141 /* QualifiedName */) {
node = contextToken.parent.left;
isRightOfDot = true;
}
@@ -67556,9 +68248,9 @@ var ts;
switch (contextToken.kind) {
case 16 /* OpenBraceToken */: // const x = { |
case 25 /* CommaToken */:
- var parent_16 = contextToken.parent;
- if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) {
- return parent_16;
+ var parent_15 = contextToken.parent;
+ if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) {
+ return parent_15;
}
break;
}
@@ -67585,37 +68277,37 @@ var ts;
}
function tryGetContainingJsxElement(contextToken) {
if (contextToken) {
- var parent_17 = contextToken.parent;
+ var parent_16 = contextToken.parent;
switch (contextToken.kind) {
case 27 /* LessThanSlashToken */:
case 40 /* SlashToken */:
case 70 /* Identifier */:
case 250 /* JsxAttribute */:
case 251 /* JsxSpreadAttribute */:
- if (parent_17 && (parent_17.kind === 247 /* JsxSelfClosingElement */ || parent_17.kind === 248 /* JsxOpeningElement */)) {
- return parent_17;
+ if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) {
+ return parent_16;
}
- else if (parent_17.kind === 250 /* JsxAttribute */) {
- return parent_17.parent;
+ else if (parent_16.kind === 250 /* JsxAttribute */) {
+ return parent_16.parent;
}
break;
// The context token is the closing } or " of an attribute, which means
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 9 /* StringLiteral */:
- if (parent_17 && ((parent_17.kind === 250 /* JsxAttribute */) || (parent_17.kind === 251 /* JsxSpreadAttribute */))) {
- return parent_17.parent;
+ if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) {
+ return parent_16.parent;
}
break;
case 17 /* CloseBraceToken */:
- if (parent_17 &&
- parent_17.kind === 252 /* JsxExpression */ &&
- parent_17.parent &&
- (parent_17.parent.kind === 250 /* JsxAttribute */)) {
- return parent_17.parent.parent;
+ if (parent_16 &&
+ parent_16.kind === 252 /* JsxExpression */ &&
+ parent_16.parent &&
+ (parent_16.parent.kind === 250 /* JsxAttribute */)) {
+ return parent_16.parent.parent;
}
- if (parent_17 && parent_17.kind === 251 /* JsxSpreadAttribute */) {
- return parent_17.parent;
+ if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) {
+ return parent_16.parent;
}
break;
}
@@ -67752,8 +68444,8 @@ var ts;
if (element.getStart() <= position && position <= element.getEnd()) {
continue;
}
- var name_43 = element.propertyName || element.name;
- existingImportsOrExports[name_43.text] = true;
+ var name_44 = element.propertyName || element.name;
+ existingImportsOrExports[name_44.text] = true;
}
if (!ts.someProperties(existingImportsOrExports)) {
return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; });
@@ -68112,19 +68804,19 @@ var ts;
function getThrowStatementOwner(throwStatement) {
var child = throwStatement;
while (child.parent) {
- var parent_18 = child.parent;
- if (ts.isFunctionBlock(parent_18) || parent_18.kind === 261 /* SourceFile */) {
- return parent_18;
+ var parent_17 = child.parent;
+ if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) {
+ return parent_17;
}
// A throw-statement is only owned by a try-statement if the try-statement has
// a catch clause, and if the throw-statement occurs within the try block.
- if (parent_18.kind === 221 /* TryStatement */) {
- var tryStatement = parent_18;
+ if (parent_17.kind === 221 /* TryStatement */) {
+ var tryStatement = parent_17;
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
return child;
}
}
- child = parent_18;
+ child = parent_17;
}
return undefined;
}
@@ -69081,24 +69773,24 @@ var ts;
// If we got a type reference, try and see if the reference applies to any expressions that can implement an interface
var containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference) {
- var parent_19 = containingTypeReference.parent;
- if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.initializer));
+ var parent_18 = containingTypeReference.parent;
+ if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.initializer));
}
- else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) {
- if (parent_19.body.kind === 204 /* Block */) {
- ts.forEachReturnStatement(parent_19.body, function (returnStatement) {
+ else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) {
+ if (parent_18.body.kind === 204 /* Block */) {
+ ts.forEachReturnStatement(parent_18.body, function (returnStatement) {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
maybeAdd(getReferenceEntryFromNode(returnStatement.expression));
}
});
}
- else if (isImplementationExpression(parent_19.body)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.body));
+ else if (isImplementationExpression(parent_18.body)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.body));
}
}
- else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) {
- maybeAdd(getReferenceEntryFromNode(parent_19.expression));
+ else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) {
+ maybeAdd(getReferenceEntryFromNode(parent_18.expression));
}
}
}
@@ -69593,9 +70285,9 @@ var ts;
return undefined;
}
}
- var result_3 = [];
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_3, /*previousIterationSymbolsCache*/ ts.createMap());
- return ts.forEach(result_3, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
+ var result_4 = [];
+ getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap());
+ return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; });
}
return undefined;
});
@@ -69604,7 +70296,7 @@ var ts;
if (node.name.kind === 142 /* ComputedPropertyName */) {
var nameExpression = node.name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
- if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
+ if (ts.isStringOrNumericLiteral(nameExpression)) {
return nameExpression.text;
}
return undefined;
@@ -69616,20 +70308,20 @@ var ts;
var contextualType = typeChecker.getContextualType(objectLiteral);
var name = getNameFromObjectLiteralElement(node);
if (name && contextualType) {
- var result_4 = [];
+ var result_5 = [];
var symbol_2 = contextualType.getProperty(name);
if (symbol_2) {
- result_4.push(symbol_2);
+ result_5.push(symbol_2);
}
if (contextualType.flags & 65536 /* Union */) {
ts.forEach(contextualType.types, function (t) {
var symbol = t.getProperty(name);
if (symbol) {
- result_4.push(symbol);
+ result_5.push(symbol);
}
});
}
- return result_4;
+ return result_5;
}
return undefined;
}
@@ -69896,13 +70588,13 @@ var ts;
return undefined;
}
if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) {
- var result_5 = [];
+ var result_6 = [];
ts.forEach(type.types, function (t) {
if (t.symbol) {
- ts.addRange(/*to*/ result_5, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node));
+ ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node));
}
});
- return result_5;
+ return result_6;
}
if (!type.symbol) {
return undefined;
@@ -70113,7 +70805,7 @@ var ts;
// from Array<T> - Array<string> and Array<number>
var documentationComment = [];
forEachUnique(declarations, function (declaration) {
- var comments = ts.getJSDocComments(declaration, /*checkParentVariableStatement*/ true);
+ var comments = ts.getCommentsFromJSDoc(declaration);
if (!comments) {
return;
}
@@ -70320,13 +71012,13 @@ var ts;
* @param projectRootPath is the path to the project root directory
* @param safeListPath is the path used to retrieve the safe list
* @param packageNameToTypingLocation is the map of package names to their cached typing locations
- * @param typingOptions are used to customize the typing inference process
+ * @param typeAcquisition is used to customize the typing acquisition process
* @param compilerOptions are used as a source for typing inference
*/
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
// A typing name to typing file path mapping
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
// Only infer typings for .js and .jsx files
@@ -70342,8 +71034,8 @@ var ts;
// Directories to search for package.json, bower.json and other typing information
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -70370,9 +71062,9 @@ var ts;
}
}
// Add the cached typing locations for inferred typings that are already installed
- for (var name_44 in packageNameToTypingLocation) {
- if (name_44 in inferredTypings && !inferredTypings[name_44]) {
- inferredTypings[name_44] = packageNameToTypingLocation[name_44];
+ for (var name_45 in packageNameToTypingLocation) {
+ if (name_45 in inferredTypings && !inferredTypings[name_45]) {
+ inferredTypings[name_45] = packageNameToTypingLocation[name_45];
}
}
// Remove typings that the user has added to the exclude list
@@ -70510,12 +71202,12 @@ var ts;
return;
}
var nameToDeclarations = sourceFile.getNamedDeclarations();
- for (var name_45 in nameToDeclarations) {
- var declarations = nameToDeclarations[name_45];
+ for (var name_46 in nameToDeclarations) {
+ var declarations = nameToDeclarations[name_46];
if (declarations) {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
- var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_45);
+ var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46);
if (!matches) {
continue;
}
@@ -70528,14 +71220,14 @@ var ts;
if (!containers) {
return undefined;
}
- matches = patternMatcher.getMatches(containers, name_45);
+ matches = patternMatcher.getMatches(containers, name_46);
if (!matches) {
continue;
}
}
var fileName = sourceFile.fileName;
var matchKind = bestMatchKind(matches);
- rawItems.push({ name: name_45, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
+ rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration });
}
}
}
@@ -70824,9 +71516,9 @@ var ts;
case 174 /* BindingElement */:
case 223 /* VariableDeclaration */:
var decl = node;
- var name_46 = decl.name;
- if (ts.isBindingPattern(name_46)) {
- addChildrenRecursively(name_46);
+ var name_47 = decl.name;
+ if (ts.isBindingPattern(name_47)) {
+ addChildrenRecursively(name_47);
}
else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) {
// For `const x = function() {}`, just use the function node, not the const.
@@ -70873,9 +71565,9 @@ var ts;
addLeafNode(node);
break;
default:
- ts.forEach(node.jsDocComments, function (jsDocComment) {
- ts.forEach(jsDocComment.tags, function (tag) {
- if (tag.kind === 284 /* JSDocTypedefTag */) {
+ ts.forEach(node.jsDoc, function (jsDoc) {
+ ts.forEach(jsDoc.tags, function (tag) {
+ if (tag.kind === 285 /* JSDocTypedefTag */) {
addLeafNode(tag);
}
});
@@ -71005,7 +71697,7 @@ var ts;
case 185 /* ArrowFunction */:
case 197 /* ClassExpression */:
return getFunctionOrClassName(node);
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return undefined;
@@ -71048,7 +71740,7 @@ var ts;
return "()";
case 155 /* IndexSignature */:
return "[]";
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return getJSDocTypedefTagName(node);
default:
return "<unknown>";
@@ -71096,7 +71788,7 @@ var ts;
case 230 /* ModuleDeclaration */:
case 261 /* SourceFile */:
case 228 /* TypeAliasDeclaration */:
- case 284 /* JSDocTypedefTag */:
+ case 285 /* JSDocTypedefTag */:
return true;
case 150 /* Constructor */:
case 149 /* MethodDeclaration */:
@@ -71333,28 +72025,28 @@ var ts;
switch (n.kind) {
case 204 /* Block */:
if (!ts.isFunctionBlock(n)) {
- var parent_20 = n.parent;
+ var parent_19 = n.parent;
var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile);
var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile);
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
- if (parent_20.kind === 209 /* DoStatement */ ||
- parent_20.kind === 212 /* ForInStatement */ ||
- parent_20.kind === 213 /* ForOfStatement */ ||
- parent_20.kind === 211 /* ForStatement */ ||
- parent_20.kind === 208 /* IfStatement */ ||
- parent_20.kind === 210 /* WhileStatement */ ||
- parent_20.kind === 217 /* WithStatement */ ||
- parent_20.kind === 256 /* CatchClause */) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ if (parent_19.kind === 209 /* DoStatement */ ||
+ parent_19.kind === 212 /* ForInStatement */ ||
+ parent_19.kind === 213 /* ForOfStatement */ ||
+ parent_19.kind === 211 /* ForStatement */ ||
+ parent_19.kind === 208 /* IfStatement */ ||
+ parent_19.kind === 210 /* WhileStatement */ ||
+ parent_19.kind === 217 /* WithStatement */ ||
+ parent_19.kind === 256 /* CatchClause */) {
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
- if (parent_20.kind === 221 /* TryStatement */) {
+ if (parent_19.kind === 221 /* TryStatement */) {
// Could be the try-block, or the finally-block.
- var tryStatement = parent_20;
+ var tryStatement = parent_19;
if (tryStatement.tryBlock === n) {
- addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n));
+ addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n));
break;
}
else if (tryStatement.finallyBlock === n) {
@@ -73447,9 +74139,9 @@ var ts;
return false;
}
// If the parent is not sourceFile or module block it is local variable
- for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) {
+ for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) {
// Reached source file or module block
- if (parent_21.kind === 261 /* SourceFile */ || parent_21.kind === 231 /* ModuleBlock */) {
+ if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) {
return false;
}
}
@@ -74054,7 +74746,7 @@ var ts;
function RuleOperationContext() {
var funcs = [];
for (var _i = 0; _i < arguments.length; _i++) {
- funcs[_i - 0] = arguments[_i];
+ funcs[_i] = arguments[_i];
}
this.customContextChecks = funcs;
}
@@ -74325,9 +75017,9 @@ var ts;
}
Rules.prototype.getRuleName = function (rule) {
var o = this;
- for (var name_47 in o) {
- if (o[name_47] === rule) {
- return name_47;
+ for (var name_48 in o) {
+ if (o[name_48] === rule) {
+ return name_48;
}
}
throw new Error("Unknown rule");
@@ -75715,11 +76407,23 @@ var ts;
else {
var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile);
- if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
+ if (indentation !== characterToColumn(startLinePosition, tokenStart.character) || indentationIsDifferent(indentationString, startLinePosition)) {
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
+ function characterToColumn(startLinePosition, characterInLine) {
+ var column = 0;
+ for (var i = 0; i < characterInLine; i++) {
+ if (sourceFile.text.charCodeAt(startLinePosition + i) === 9 /* tab */) {
+ column += options.tabSize - column % options.tabSize;
+ }
+ else {
+ column++;
+ }
+ }
+ return column;
+ }
function indentationIsDifferent(indentationString, startLinePosition) {
return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length);
}
@@ -76508,7 +77212,666 @@ var ts;
});
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ var ModuleSpecifierComparison;
+ (function (ModuleSpecifierComparison) {
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Better"] = 0] = "Better";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Equal"] = 1] = "Equal";
+ ModuleSpecifierComparison[ModuleSpecifierComparison["Worse"] = 2] = "Worse";
+ })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {}));
+ var ImportCodeActionMap = (function () {
+ function ImportCodeActionMap() {
+ this.symbolIdToActionMap = ts.createMap();
+ }
+ ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) {
+ if (!newAction) {
+ return;
+ }
+ if (!this.symbolIdToActionMap[symbolId]) {
+ this.symbolIdToActionMap[symbolId] = [newAction];
+ return;
+ }
+ if (newAction.kind === "CodeChange") {
+ this.symbolIdToActionMap[symbolId].push(newAction);
+ return;
+ }
+ var updatedNewImports = [];
+ for (var _i = 0, _a = this.symbolIdToActionMap[symbolId]; _i < _a.length; _i++) {
+ var existingAction = _a[_i];
+ if (existingAction.kind === "CodeChange") {
+ // only import actions should compare
+ updatedNewImports.push(existingAction);
+ continue;
+ }
+ switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) {
+ case ModuleSpecifierComparison.Better:
+ // the new one is not worth considering if it is a new improt.
+ // However if it is instead a insertion into existing import, the user might want to use
+ // the module specifier even it is worse by our standards. So keep it.
+ if (newAction.kind === "NewImport") {
+ return;
+ }
+ case ModuleSpecifierComparison.Equal:
+ // the current one is safe. But it is still possible that the new one is worse
+ // than another existing one. For example, you may have new imports from "./foo/bar"
+ // and "bar", when the new one is "bar/bar2" and the current one is "./foo/bar". The new
+ // one and the current one are not comparable (one relative path and one absolute path),
+ // but the new one is worse than the other one, so should not add to the list.
+ updatedNewImports.push(existingAction);
+ break;
+ case ModuleSpecifierComparison.Worse:
+ // the existing one is worse, remove from the list.
+ continue;
+ }
+ }
+ // if we reach here, it means the new one is better or equal to all of the existing ones.
+ updatedNewImports.push(newAction);
+ this.symbolIdToActionMap[symbolId] = updatedNewImports;
+ };
+ ImportCodeActionMap.prototype.addActions = function (symbolId, newActions) {
+ for (var _i = 0, newActions_1 = newActions; _i < newActions_1.length; _i++) {
+ var newAction = newActions_1[_i];
+ this.addAction(symbolId, newAction);
+ }
+ };
+ ImportCodeActionMap.prototype.getAllActions = function () {
+ var result = [];
+ for (var symbolId in this.symbolIdToActionMap) {
+ result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]);
+ }
+ return result;
+ };
+ ImportCodeActionMap.prototype.compareModuleSpecifiers = function (moduleSpecifier1, moduleSpecifier2) {
+ if (moduleSpecifier1 === moduleSpecifier2) {
+ return ModuleSpecifierComparison.Equal;
+ }
+ // if moduleSpecifier1 (ms1) is a substring of ms2, then it is better
+ if (moduleSpecifier2.indexOf(moduleSpecifier1) === 0) {
+ return ModuleSpecifierComparison.Better;
+ }
+ if (moduleSpecifier1.indexOf(moduleSpecifier2) === 0) {
+ return ModuleSpecifierComparison.Worse;
+ }
+ // if both are relative paths, and ms1 has fewer levels, then it is better
+ if (ts.isExternalModuleNameRelative(moduleSpecifier1) && ts.isExternalModuleNameRelative(moduleSpecifier2)) {
+ var regex = new RegExp(ts.directorySeparator, "g");
+ var moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length;
+ var moduleSpecifier2LevelCount = (moduleSpecifier2.match(regex) || []).length;
+ return moduleSpecifier1LevelCount < moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Better
+ : moduleSpecifier1LevelCount === moduleSpecifier2LevelCount
+ ? ModuleSpecifierComparison.Equal
+ : ModuleSpecifierComparison.Worse;
+ }
+ // the equal cases include when the two specifiers are not comparable.
+ return ModuleSpecifierComparison.Equal;
+ };
+ return ImportCodeActionMap;
+ }());
+ codefix.registerCodeFix({
+ errorCodes: [ts.Diagnostics.Cannot_find_name_0.code],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var checker = context.program.getTypeChecker();
+ var allSourceFiles = context.program.getSourceFiles();
+ var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
+ var token = ts.getTokenAtPosition(sourceFile, context.span.start);
+ var name = token.getText();
+ var symbolIdActionMap = new ImportCodeActionMap();
+ // this is a module id -> module import declaration map
+ var cachedImportDeclarations = ts.createMap();
+ var cachedNewImportInsertPosition;
+ var allPotentialModules = checker.getAmbientModules();
+ for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) {
+ var otherSourceFile = allSourceFiles_1[_i];
+ if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) {
+ allPotentialModules.push(otherSourceFile.symbol);
+ }
+ }
+ var currentTokenMeaning = ts.getMeaningFromLocation(token);
+ for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) {
+ var moduleSymbol = allPotentialModules_1[_a];
+ context.cancellationToken.throwIfCancellationRequested();
+ // check the default export
+ var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol);
+ if (defaultExport) {
+ var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport);
+ if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) {
+ // check if this symbol is already used
+ var symbolId = getUniqueSymbolId(localSymbol);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true));
+ }
+ }
+ // check exports with the same name
+ var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol);
+ if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {
+ var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName);
+ symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol));
+ }
+ }
+ return symbolIdActionMap.getAllActions();
+ function getImportDeclarations(moduleSymbol) {
+ var moduleSymbolId = getUniqueSymbolId(moduleSymbol);
+ if (cachedImportDeclarations[moduleSymbolId]) {
+ return cachedImportDeclarations[moduleSymbolId];
+ }
+ var existingDeclarations = [];
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var importModuleSpecifier = _a[_i];
+ var importSymbol = checker.getSymbolAtLocation(importModuleSpecifier);
+ if (importSymbol === moduleSymbol) {
+ existingDeclarations.push(getImportDeclaration(importModuleSpecifier));
+ }
+ }
+ cachedImportDeclarations[moduleSymbolId] = existingDeclarations;
+ return existingDeclarations;
+ function getImportDeclaration(moduleSpecifier) {
+ var node = moduleSpecifier;
+ while (node) {
+ if (node.kind === 235 /* ImportDeclaration */) {
+ return node;
+ }
+ if (node.kind === 234 /* ImportEqualsDeclaration */) {
+ return node;
+ }
+ node = node.parent;
+ }
+ return undefined;
+ }
+ }
+ function getUniqueSymbolId(symbol) {
+ if (symbol.flags & 8388608 /* Alias */) {
+ return ts.getSymbolId(checker.getAliasedSymbol(symbol));
+ }
+ return ts.getSymbolId(symbol);
+ }
+ function checkSymbolHasMeaning(symbol, meaning) {
+ var declarations = symbol.getDeclarations();
+ return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false;
+ }
+ function getCodeActionForImport(moduleSymbol, isDefault) {
+ var existingDeclarations = getImportDeclarations(moduleSymbol);
+ if (existingDeclarations.length > 0) {
+ // With an existing import statement, there are more than one actions the user can do.
+ return getCodeActionsForExistingImport(existingDeclarations);
+ }
+ else {
+ return [getCodeActionForNewImport()];
+ }
+ function getCodeActionsForExistingImport(declarations) {
+ var actions = [];
+ // It is possible that multiple import statements with the same specifier exist in the file.
+ // e.g.
+ //
+ // import * as ns from "foo";
+ // import { member1, member2 } from "foo";
+ //
+ // member3/**/ <-- cusor here
+ //
+ // in this case we should provie 2 actions:
+ // 1. change "member3" to "ns.member3"
+ // 2. add "member3" to the second import statement's import list
+ // and it is up to the user to decide which one fits best.
+ var namespaceImportDeclaration;
+ var namedImportDeclaration;
+ var existingModuleSpecifier;
+ for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
+ var declaration = declarations_11[_i];
+ if (declaration.kind === 235 /* ImportDeclaration */) {
+ var namedBindings = declaration.importClause && declaration.importClause.namedBindings;
+ if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) {
+ // case:
+ // import * as ns from "foo"
+ namespaceImportDeclaration = declaration;
+ }
+ else {
+ // cases:
+ // import default from "foo"
+ // import { bar } from "foo" or combination with the first one
+ // import "foo"
+ namedImportDeclaration = declaration;
+ }
+ existingModuleSpecifier = declaration.moduleSpecifier.getText();
+ }
+ else {
+ // case:
+ // import foo = require("foo")
+ namespaceImportDeclaration = declaration;
+ existingModuleSpecifier = getModuleSpecifierFromImportEqualsDeclaration(declaration);
+ }
+ }
+ if (namespaceImportDeclaration) {
+ actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration));
+ }
+ if (namedImportDeclaration && namedImportDeclaration.importClause &&
+ (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) {
+ /**
+ * If the existing import declaration already has a named import list, just
+ * insert the identifier into that list.
+ */
+ var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText());
+ actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes));
+ }
+ else {
+ // we need to create a new import statement, but the existing module specifier can be reused.
+ actions.push(getCodeActionForNewImport(existingModuleSpecifier));
+ }
+ return actions;
+ function getModuleSpecifierFromImportEqualsDeclaration(declaration) {
+ if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) {
+ return declaration.moduleReference.expression.getText();
+ }
+ return declaration.moduleReference.getText();
+ }
+ function getTextChangeForImportClause(importClause) {
+ var newImportText = isDefault ? "default as " + name : name;
+ var importList = importClause.namedBindings;
+ // case 1:
+ // original text: import default from "module"
+ // change to: import default, { name } from "module"
+ if (!importList && importClause.name) {
+ var start = importClause.name.getEnd();
+ return {
+ newText: ", { " + newImportText + " }",
+ span: { start: start, length: 0 }
+ };
+ }
+ // case 2:
+ // original text: import {} from "module"
+ // change to: import { name } from "module"
+ if (importList.elements.length === 0) {
+ var start = importList.getStart();
+ return {
+ newText: "{ " + newImportText + " }",
+ span: { start: start, length: importList.getEnd() - start }
+ };
+ }
+ // case 3:
+ // original text: import { foo, bar } from "module"
+ // change to: import { foo, bar, name } from "module"
+ var insertPoint = importList.elements[importList.elements.length - 1].getEnd();
+ /**
+ * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element
+ * import {
+ * foo
+ * } from "./module";
+ */
+ var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart());
+ var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd());
+ var oneImportPerLine = endLine - startLine > importList.elements.length;
+ return {
+ newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText,
+ span: { start: insertPoint, length: 0 }
+ };
+ }
+ function getCodeActionForNamespaceImport(declaration) {
+ var namespacePrefix;
+ if (declaration.kind === 235 /* ImportDeclaration */) {
+ namespacePrefix = declaration.importClause.namedBindings.name.getText();
+ }
+ else {
+ namespacePrefix = declaration.name.getText();
+ }
+ namespacePrefix = ts.stripQuotes(namespacePrefix);
+ /**
+ * Cases:
+ * import * as ns from "mod"
+ * import default, * as ns from "mod"
+ * import ns = require("mod")
+ *
+ * Because there is no import list, we alter the reference to include the
+ * namespace instead of altering the import declaration. For example, "foo" would
+ * become "ns.foo"
+ */
+ return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange");
+ }
+ }
+ function getCodeActionForNewImport(moduleSpecifier) {
+ if (!cachedNewImportInsertPosition) {
+ // insert after any existing imports
+ var lastModuleSpecifierEnd = -1;
+ for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
+ var moduleSpecifier_1 = _a[_i];
+ var end = moduleSpecifier_1.getEnd();
+ if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) {
+ lastModuleSpecifierEnd = end;
+ }
+ }
+ cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart();
+ }
+ var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
+ var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport());
+ var importStatementText = isDefault
+ ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\""
+ : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\"";
+ // if this file doesn't have any import statements, insert an import statement and then insert a new line
+ // between the only import statement and user code. Otherwise just insert the statement because chances
+ // are there are already a new line seperating code and import statements.
+ var newText = cachedNewImportInsertPosition === sourceFile.getStart()
+ ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter
+ : "" + context.newLineCharacter + importStatementText + ";";
+ return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes);
+ function getModuleSpecifierForNewImport() {
+ var fileName = sourceFile.path;
+ var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path;
+ var sourceDirectory = ts.getDirectoryPath(fileName);
+ var options = context.program.getCompilerOptions();
+ return tryGetModuleNameFromAmbientModule() ||
+ tryGetModuleNameFromBaseUrl() ||
+ tryGetModuleNameFromRootDirs() ||
+ tryGetModuleNameFromTypeRoots() ||
+ tryGetModuleNameAsNodeModule() ||
+ ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));
+ function tryGetModuleNameFromAmbientModule() {
+ if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) {
+ return moduleSymbol.name;
+ }
+ }
+ function tryGetModuleNameFromBaseUrl() {
+ if (!options.baseUrl) {
+ return undefined;
+ }
+ var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName);
+ var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl);
+ if (!relativeName) {
+ return undefined;
+ }
+ relativeName = removeExtensionAndIndexPostFix(relativeName);
+ if (options.paths) {
+ for (var key in options.paths) {
+ for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) {
+ var pattern = _a[_i];
+ var indexOfStar = pattern.indexOf("*");
+ if (indexOfStar === 0 && pattern.length === 1) {
+ continue;
+ }
+ else if (indexOfStar !== -1) {
+ var prefix = pattern.substr(0, indexOfStar);
+ var suffix = pattern.substr(indexOfStar + 1);
+ if (relativeName.length >= prefix.length + suffix.length &&
+ ts.startsWith(relativeName, prefix) &&
+ ts.endsWith(relativeName, suffix)) {
+ var matchedStar = relativeName.substr(prefix.length, relativeName.length - suffix.length);
+ return key.replace("\*", matchedStar);
+ }
+ }
+ else if (pattern === relativeName) {
+ return key;
+ }
+ }
+ }
+ }
+ return relativeName;
+ }
+ function tryGetModuleNameFromRootDirs() {
+ if (options.rootDirs) {
+ var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); });
+ var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs);
+ var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs);
+ if (normalizedTargetPath !== undefined) {
+ var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath;
+ return ts.removeFileExtension(relativePath);
+ }
+ }
+ return undefined;
+ }
+ function tryGetModuleNameFromTypeRoots() {
+ var typeRoots = ts.getEffectiveTypeRoots(options, context.host);
+ if (typeRoots) {
+ var normalizedTypeRoots = ts.map(typeRoots, function (typeRoot) { return ts.toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName); });
+ for (var _i = 0, normalizedTypeRoots_1 = normalizedTypeRoots; _i < normalizedTypeRoots_1.length; _i++) {
+ var typeRoot = normalizedTypeRoots_1[_i];
+ if (ts.startsWith(moduleFileName, typeRoot)) {
+ var relativeFileName = moduleFileName.substring(typeRoot.length + 1);
+ return removeExtensionAndIndexPostFix(relativeFileName);
+ }
+ }
+ }
+ }
+ function tryGetModuleNameAsNodeModule() {
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
+ // nothing to do here
+ return undefined;
+ }
+ var indexOfNodeModules = moduleFileName.indexOf("node_modules");
+ if (indexOfNodeModules < 0) {
+ return undefined;
+ }
+ var relativeFileName;
+ if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) {
+ // if node_modules folder is in this folder or any of its parent folder, no need to keep it.
+ relativeFileName = moduleFileName.substring(indexOfNodeModules + 13 /* "node_modules\".length */);
+ }
+ else {
+ relativeFileName = getRelativePath(moduleFileName, sourceDirectory);
+ }
+ relativeFileName = ts.removeFileExtension(relativeFileName);
+ if (ts.endsWith(relativeFileName, "/index")) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ else {
+ try {
+ var moduleDirectory = ts.getDirectoryPath(moduleFileName);
+ var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json")));
+ if (packageJsonContent) {
+ var mainFile = packageJsonContent.main || packageJsonContent.typings;
+ if (mainFile) {
+ var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName);
+ if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) {
+ relativeFileName = ts.getDirectoryPath(relativeFileName);
+ }
+ }
+ }
+ }
+ catch (e) { }
+ }
+ return relativeFileName;
+ }
+ }
+ function getPathRelativeToRootDirs(path, rootDirs) {
+ for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) {
+ var rootDir = rootDirs_2[_i];
+ var relativeName = tryRemoveParentDirectoryName(path, rootDir);
+ if (relativeName !== undefined) {
+ return relativeName;
+ }
+ }
+ return undefined;
+ }
+ function removeExtensionAndIndexPostFix(fileName) {
+ fileName = ts.removeFileExtension(fileName);
+ if (ts.endsWith(fileName, "/index")) {
+ fileName = fileName.substr(0, fileName.length - 6 /* "/index".length */);
+ }
+ return fileName;
+ }
+ function getRelativePath(path, directoryPath) {
+ var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
+ return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath;
+ }
+ function tryRemoveParentDirectoryName(path, parentDirectory) {
+ var index = path.indexOf(parentDirectory);
+ if (index === 0) {
+ return ts.endsWith(parentDirectory, ts.directorySeparator)
+ ? path.substring(parentDirectory.length)
+ : path.substring(parentDirectory.length + 1);
+ }
+ return undefined;
+ }
+ }
+ }
+ function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) {
+ return {
+ description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)),
+ changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }],
+ kind: kind,
+ moduleSpecifier: moduleSpecifier
+ };
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var codefix;
+ (function (codefix) {
+ codefix.registerCodeFix({
+ errorCodes: [
+ ts.Diagnostics._0_is_declared_but_never_used.code,
+ ts.Diagnostics.Property_0_is_declared_but_never_used.code
+ ],
+ getCodeActions: function (context) {
+ var sourceFile = context.sourceFile;
+ var start = context.span.start;
+ var token = ts.getTokenAtPosition(sourceFile, start);
+ // this handles var ["computed"] = 12;
+ if (token.kind === 20 /* OpenBracketToken */) {
+ token = ts.getTokenAtPosition(sourceFile, start + 1);
+ }
+ switch (token.kind) {
+ case 70 /* Identifier */:
+ switch (token.parent.kind) {
+ case 223 /* VariableDeclaration */:
+ switch (token.parent.parent.parent.kind) {
+ case 211 /* ForStatement */:
+ var forStatement = token.parent.parent.parent;
+ var forInitializer = forStatement.initializer;
+ if (forInitializer.declarations.length === 1) {
+ return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos);
+ }
+ else {
+ return removeSingleItem(forInitializer.declarations, token);
+ }
+ case 213 /* ForOfStatement */:
+ var forOfStatement = token.parent.parent.parent;
+ if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) {
+ var forOfInitializer = forOfStatement.initializer;
+ return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos);
+ }
+ break;
+ case 212 /* ForInStatement */:
+ // There is no valid fix in the case of:
+ // for .. in
+ return undefined;
+ case 256 /* CatchClause */:
+ var catchClause = token.parent.parent;
+ var parameter = catchClause.variableDeclaration.getChildren()[0];
+ return createCodeFix("", parameter.pos, parameter.end - parameter.pos);
+ default:
+ var variableStatement = token.parent.parent.parent;
+ if (variableStatement.declarationList.declarations.length === 1) {
+ return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos);
+ }
+ else {
+ var declarations = variableStatement.declarationList.declarations;
+ return removeSingleItem(declarations, token);
+ }
+ }
+ case 143 /* TypeParameter */:
+ var typeParameters = token.parent.parent.typeParameters;
+ if (typeParameters.length === 1) {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2);
+ }
+ else {
+ return removeSingleItem(typeParameters, token);
+ }
+ case 144 /* Parameter */:
+ var functionDeclaration = token.parent.parent;
+ if (functionDeclaration.parameters.length === 1) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else {
+ return removeSingleItem(functionDeclaration.parameters, token);
+ }
+ // handle case where 'import a = A;'
+ case 234 /* ImportEqualsDeclaration */:
+ var importEquals = findImportDeclaration(token);
+ return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
+ case 239 /* ImportSpecifier */:
+ var namedImports = token.parent.parent;
+ if (namedImports.elements.length === 1) {
+ // Only 1 import and it is unused. So the entire declaration should be removed.
+ var importSpec = findImportDeclaration(token);
+ return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
+ }
+ else {
+ return removeSingleItem(namedImports.elements, token);
+ }
+ // handle case where "import d, * as ns from './file'"
+ // or "'import {a, b as ns} from './file'"
+ case 236 /* ImportClause */:
+ var importClause = token.parent;
+ if (!importClause.namedBindings) {
+ var importDecl = findImportDeclaration(importClause);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos);
+ }
+ case 237 /* NamespaceImport */:
+ var namespaceImport = token.parent;
+ if (namespaceImport.name == token && !namespaceImport.parent.name) {
+ var importDecl = findImportDeclaration(namespaceImport);
+ return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
+ }
+ else {
+ var start_4 = namespaceImport.parent.name.end;
+ return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4);
+ }
+ }
+ break;
+ case 147 /* PropertyDeclaration */:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ case 237 /* NamespaceImport */:
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ if (ts.isDeclarationName(token)) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);
+ }
+ else if (ts.isLiteralComputedPropertyDeclarationName(token)) {
+ return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos);
+ }
+ else {
+ return undefined;
+ }
+ function findImportDeclaration(token) {
+ var importDecl = token;
+ while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) {
+ importDecl = importDecl.parent;
+ }
+ return importDecl;
+ }
+ function createCodeFix(newText, start, length) {
+ return [{
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers),
+ changes: [{
+ fileName: sourceFile.fileName,
+ textChanges: [{ newText: newText, span: { start: start, length: length } }]
+ }]
+ }];
+ }
+ function removeSingleItem(elements, token) {
+ if (elements[0] === token.parent) {
+ return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1);
+ }
+ else {
+ return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1);
+ }
+ }
+ }
+ });
+ })(codefix = ts.codefix || (ts.codefix = {}));
+})(ts || (ts = {}));
///<reference path='superFixes.ts' />
+///<reference path='importFixes.ts' />
+///<reference path='unusedIdentifierFixes.ts' />
/// <reference path="..\compiler\program.ts"/>
/// <reference path="..\compiler\commandLineParser.ts"/>
/// <reference path='types.ts' />
@@ -76599,11 +77962,11 @@ var ts;
return pos;
};
NodeObject.prototype.createSyntaxList = function (nodes) {
- var list = createNode(291 /* SyntaxList */, nodes.pos, nodes.end, this);
+ var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this);
list._children = [];
var pos = nodes.pos;
- for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) {
- var node = nodes_5[_i];
+ for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
+ var node = nodes_7[_i];
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
}
@@ -76622,7 +77985,7 @@ var ts;
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
children = [];
var pos_3 = this.pos;
- var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 290 /* LastJSDocTagNode */;
+ var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */;
var processNode = function (node) {
var isJSDocTagNode = ts.isJSDocTag(node);
if (!isJSDocTagNode && pos_3 < node.pos) {
@@ -76641,8 +78004,8 @@ var ts;
pos_3 = nodes.end;
};
// jsDocComments need to be the first children
- if (this.jsDocComments) {
- for (var _i = 0, _a = this.jsDocComments; _i < _a.length; _i++) {
+ if (this.jsDoc) {
+ for (var _i = 0, _a = this.jsDoc; _i < _a.length; _i++) {
var jsDocComment = _a[_i];
processNode(jsDocComment);
}
@@ -76866,6 +78229,20 @@ var ts;
SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) {
return ts.getPositionOfLineAndCharacter(this, line, character);
};
+ SourceFileObject.prototype.getLineEndOfPosition = function (pos) {
+ var line = this.getLineAndCharacterOfPosition(pos).line;
+ var lineStarts = this.getLineStarts();
+ var lastCharPos;
+ if (line + 1 >= lineStarts.length) {
+ lastCharPos = this.getEnd();
+ }
+ if (!lastCharPos) {
+ lastCharPos = lineStarts[line + 1] - 1;
+ }
+ var fullText = this.getFullText();
+ // if the new line is "\r\n", we should return the last non-new-line-character position
+ return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos;
+ };
SourceFileObject.prototype.getNamedDeclarations = function () {
if (!this.namedDeclarations) {
this.namedDeclarations = this.computeNamedDeclarations();
@@ -76887,9 +78264,9 @@ var ts;
}
function getDeclarationName(declaration) {
if (declaration.name) {
- var result_6 = getTextOfIdentifierOrLiteral(declaration.name);
- if (result_6 !== undefined) {
- return result_6;
+ var result_7 = getTextOfIdentifierOrLiteral(declaration.name);
+ if (result_7 !== undefined) {
+ return result_7;
}
if (declaration.name.kind === 142 /* ComputedPropertyName */) {
var expr = declaration.name.expression;
@@ -77845,7 +79222,9 @@ var ts;
sourceFile: sourceFile,
span: span,
program: program,
- newLineCharacter: newLineChar
+ newLineCharacter: newLineChar,
+ host: host,
+ cancellationToken: cancellationToken
};
var fixes = ts.codefix.getFixes(context);
if (fixes) {
@@ -78087,10 +79466,10 @@ var ts;
break;
default:
ts.forEachChild(node, walk);
- if (node.jsDocComments) {
- for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) {
- var jsDocComment = _a[_i];
- ts.forEachChild(jsDocComment, walk);
+ if (node.jsDoc) {
+ for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
+ var jsDoc = _a[_i];
+ ts.forEachChild(jsDoc, walk);
}
}
}
@@ -79416,7 +80795,7 @@ var ts;
if (result.error) {
return {
options: {},
- typingOptions: {},
+ typeAcquisition: {},
files: [],
raw: {},
errors: [realizeDiagnostic(result.error, "\r\n")]
@@ -79426,7 +80805,7 @@ var ts;
var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName);
return {
options: configFile.options,
- typingOptions: configFile.typingOptions,
+ typeAcquisition: configFile.typeAcquisition,
files: configFile.fileNames,
raw: configFile.raw,
errors: realizeDiagnostics(configFile.errors, "\r\n")
@@ -79441,7 +80820,7 @@ var ts;
var getCanonicalFileName = ts.createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false);
return this.forwardJSONCall("discoverTypings()", function () {
var info = JSON.parse(discoverTypingsJson);
- return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.unresolvedImports);
+ return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports);
});
};
return CoreServicesShimObject;
diff --git a/node_modules/typescript/lib/typingsInstaller.js b/node_modules/typescript/lib/typingsInstaller.js
index 13912d296..904f1444d 100644
--- a/node_modules/typescript/lib/typingsInstaller.js
+++ b/node_modules/typescript/lib/typingsInstaller.js
@@ -137,6 +137,9 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
+ ts.version = "2.2.0-dev.20161127";
+})(ts || (ts = {}));
+(function (ts) {
var createObject = Object.create;
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
function createMap(template) {
@@ -606,7 +609,7 @@ var ts;
if (value === undefined)
return to;
if (to === undefined)
- to = [];
+ return [value];
to.push(value);
return to;
}
@@ -621,6 +624,14 @@ var ts;
return to;
}
ts.addRange = addRange;
+ function stableSort(array, comparer) {
+ if (comparer === void 0) { comparer = compareValues; }
+ return array
+ .map(function (_, i) { return i; })
+ .sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); })
+ .map(function (i) { return array[i]; });
+ }
+ ts.stableSort = stableSort;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -775,6 +786,15 @@ var ts;
}
}
ts.copyProperties = copyProperties;
+ function appendProperty(map, key, value) {
+ if (key === undefined || value === undefined)
+ return map;
+ if (map === undefined)
+ map = createMap();
+ map[key] = value;
+ return map;
+ }
+ ts.appendProperty = appendProperty;
function assign(t) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
@@ -1227,6 +1247,14 @@ var ts;
getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
}
ts.getEmitModuleKind = getEmitModuleKind;
+ function getEmitModuleResolutionKind(compilerOptions) {
+ var moduleResolution = compilerOptions.moduleResolution;
+ if (moduleResolution === undefined) {
+ moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
+ }
+ return moduleResolution;
+ }
+ ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
function hasZeroOrOneAsteriskCharacter(str) {
var seenAsterisk = false;
for (var i = 0; i < str.length; i++) {
@@ -1777,6 +1805,16 @@ var ts;
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
+ function orderedRemoveItem(array, item) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] === item) {
+ orderedRemoveItemAt(array, i);
+ return true;
+ }
+ }
+ return false;
+ }
+ ts.orderedRemoveItem = orderedRemoveItem;
function orderedRemoveItemAt(array, index) {
for (var i = index; i < array.length - 1; i++) {
array[i] = array[i + 1];
@@ -2811,7 +2849,7 @@ var ts;
Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." },
A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." },
Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." },
- Type_0_is_not_constrained_to_keyof_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_constrained_to_keyof_1_2536", message: "Type '{0}' is not constrained to 'keyof {1}'." },
+ Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." },
Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." },
Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." },
Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." },
@@ -2876,7 +2914,8 @@ var ts;
An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." },
Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." },
Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." },
- An_object_rest_element_must_be_an_identifier: { code: 2701, category: ts.DiagnosticCategory.Error, key: "An_object_rest_element_must_be_an_identifier_2701", message: "An object rest element must be an identifier." },
+ The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." },
+ _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -2947,6 +2986,7 @@ var ts;
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." },
Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." },
+ Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." },
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." },
@@ -3161,9 +3201,9 @@ var ts;
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
- Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
+ Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
- The_path_in_an_extends_options_must_be_relative_or_rooted: { code: 18001, category: ts.DiagnosticCategory.Error, key: "The_path_in_an_extends_options_must_be_relative_or_rooted_18001", message: "The path in an 'extends' options must be relative or rooted." },
+ A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." },
Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." },
@@ -3175,6 +3215,9 @@ var ts;
Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" },
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" },
Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." },
+ Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" },
+ Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" },
+ Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" },
};
})(ts || (ts = {}));
var ts;
@@ -5176,12 +5219,16 @@ var ts;
description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file
}
];
- ts.typingOptionDeclarations = [
+ ts.typeAcquisitionDeclarations = [
{
name: "enableAutoDiscovery",
type: "boolean",
},
{
+ name: "enable",
+ type: "boolean",
+ },
+ {
name: "include",
type: "list",
element: {
@@ -5205,6 +5252,18 @@ var ts;
sourceMap: false,
};
var optionNameMapCache;
+ function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
+ if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
+ var result = {
+ enable: typeAcquisition.enableAutoDiscovery,
+ include: typeAcquisition.include || [],
+ exclude: typeAcquisition.exclude || []
+ };
+ return result;
+ }
+ return typeAcquisition;
+ }
+ ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
function getOptionNameMap() {
if (optionNameMapCache) {
return optionNameMapCache;
@@ -5484,14 +5543,15 @@ var ts;
return {
options: {},
fileNames: [],
- typingOptions: {},
+ typeAcquisition: {},
raw: json,
errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))],
wildcardDirectories: {}
};
}
var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
- var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
+ var jsonOptions = json["typeAcquisition"] || json["typingOptions"];
+ var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
if (json["extends"]) {
var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3];
if (typeof json["extends"] === "string") {
@@ -5518,7 +5578,7 @@ var ts;
return {
options: options,
fileNames: fileNames,
- typingOptions: typingOptions,
+ typeAcquisition: typeAcquisition,
raw: json,
errors: errors,
wildcardDirectories: wildcardDirectories,
@@ -5526,7 +5586,7 @@ var ts;
};
function tryExtendsName(extendedConfig) {
if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) {
- errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_path_in_an_extends_options_must_be_relative_or_rooted));
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return;
}
var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName);
@@ -5589,7 +5649,7 @@ var ts;
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
}
else {
- excludeSpecs = ["node_modules", "bower_components", "jspm_packages"];
+ excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"];
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
if (outDir) {
excludeSpecs.push(outDir);
@@ -5624,12 +5684,12 @@ var ts;
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
- function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) {
+ function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
var errors = [];
- var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
+ var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
return { options: options, errors: errors };
}
- ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson;
+ ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
var options = ts.getBaseFileName(configFileName) === "jsconfig.json"
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true }
@@ -5637,9 +5697,10 @@ var ts;
convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors);
return options;
}
- function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
- var options = { enableAutoDiscovery: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
- convertOptionsFromJson(ts.typingOptionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_typing_option_0, errors);
+ function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
+ var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
+ var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
+ convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors);
return options;
}
function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) {
@@ -5858,9 +5919,9 @@ var ts;
"constants", "process", "v8", "timers", "console"
];
var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; });
- function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, unresolvedImports) {
+ function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) {
var inferredTypings = ts.createMap();
- if (!typingOptions || !typingOptions.enableAutoDiscovery) {
+ if (!typeAcquisition || !typeAcquisition.enable) {
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
}
fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) {
@@ -5874,8 +5935,8 @@ var ts;
var filesToWatch = [];
var searchDirs = [];
var exclude = [];
- mergeTypings(typingOptions.include);
- exclude = typingOptions.exclude || [];
+ mergeTypings(typeAcquisition.include);
+ exclude = typeAcquisition.exclude || [];
var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
if (projectRootPath) {
possibleSearchDirs.push(projectRootPath);
@@ -6058,6 +6119,7 @@ var ts;
function moduleHasNonRelativeName(moduleName) {
return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName));
}
+ ts.moduleHasNonRelativeName = moduleHasNonRelativeName;
function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) {
var jsonContent = readJson(packageJsonPath, state.host);
switch (extensions) {
@@ -6619,9 +6681,17 @@ var ts;
isEnabled: function () { return false; },
writeLine: ts.noop
};
- function typingToFileName(cachePath, packageName, installTypingHost) {
- var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
- return result.resolvedModule && result.resolvedModule.resolvedFileName;
+ function typingToFileName(cachePath, packageName, installTypingHost, log) {
+ try {
+ var result = ts.resolveModuleName(packageName, ts.combinePaths(cachePath, "index.d.ts"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, installTypingHost);
+ return result.resolvedModule && result.resolvedModule.resolvedFileName;
+ }
+ catch (e) {
+ if (log.isEnabled()) {
+ log.writeLine("Failed to resolve " + packageName + " in folder '" + cachePath + "': " + e.message);
+ }
+ return undefined;
+ }
}
var PackageNameValidationResult;
(function (PackageNameValidationResult) {
@@ -6710,7 +6780,7 @@ var ts;
}
this.processCacheLocation(req.cachePath);
}
- var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typingOptions, req.unresolvedImports);
+ var discoverTypingsResult = ts.JsTyping.discoverTypings(this.installTypingHost, req.fileNames, req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, req.typeAcquisition, req.unresolvedImports);
if (this.log.isEnabled()) {
this.log.writeLine("Finished typings discovery: " + JSON.stringify(discoverTypingsResult));
}
@@ -6750,8 +6820,9 @@ var ts;
if (!packageName) {
continue;
}
- var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost);
+ var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log);
if (!typingFile) {
+ this.missingTypingsSet[packageName] = true;
continue;
}
var existingTypingFile = this.packageNameToTypingLocation[packageName];
@@ -6782,7 +6853,7 @@ var ts;
var result = [];
for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) {
var typing = typingsToInstall_1[_i];
- if (this.missingTypingsSet[typing]) {
+ if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) {
continue;
}
var validationResult = validatePackageName(typing);
@@ -6858,7 +6929,8 @@ var ts;
_this.sendResponse({
kind: server.EventInstall,
packagesToInstall: scopedTypings,
- installSuccess: ok
+ installSuccess: ok,
+ typingsInstallerVersion: ts.version
});
}
if (!ok) {
@@ -6872,17 +6944,14 @@ var ts;
return;
}
if (_this.log.isEnabled()) {
- _this.log.writeLine("Requested to install typings " + JSON.stringify(scopedTypings) + ", installed typings " + JSON.stringify(scopedTypings));
+ _this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings));
}
var installedTypingFiles = [];
- for (var _a = 0, scopedTypings_1 = scopedTypings; _a < scopedTypings_1.length; _a++) {
- var t = scopedTypings_1[_a];
- var packageName = ts.getBaseFileName(t);
- if (!packageName) {
- continue;
- }
- var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost);
+ for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) {
+ var packageName = filteredTypings_2[_a];
+ var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log);
if (!typingFile) {
+ _this.missingTypingsSet[packageName] = true;
continue;
}
if (!_this.packageNameToTypingLocation[packageName]) {
@@ -6931,7 +7000,7 @@ var ts;
TypingsInstaller.prototype.createSetTypings = function (request, typings) {
return {
projectName: request.projectName,
- typingOptions: request.typingOptions,
+ typeAcquisition: request.typeAcquisition,
compilerOptions: request.compilerOptions,
typings: typings,
unresolvedImports: request.unresolvedImports,
@@ -7022,14 +7091,13 @@ var ts;
_this.log.writeLine("Process id: " + process.pid);
}
_this.npmPath = getNPMLocation(process.argv[0]);
- var execSync;
- (_a = require("child_process"), _this.exec = _a.exec, execSync = _a.execSync, _a);
+ (_this.execSync = require("child_process").execSync);
_this.ensurePackageDirectoryExists(globalTypingsCacheLocation);
try {
if (_this.log.isEnabled()) {
_this.log.writeLine("Updating " + TypesRegistryPackageName + " npm package...");
}
- execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
+ _this.execSync(_this.npmPath + " install " + TypesRegistryPackageName, { cwd: globalTypingsCacheLocation, stdio: "ignore" });
}
catch (e) {
if (_this.log.isEnabled()) {
@@ -7038,7 +7106,6 @@ var ts;
}
_this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation), _this.installTypingHost, _this.log);
return _this;
- var _a;
}
NodeTypingsInstaller.prototype.listen = function () {
var _this = this;
@@ -7062,18 +7129,26 @@ var ts;
}
};
NodeTypingsInstaller.prototype.installWorker = function (requestId, args, cwd, onRequestCompleted) {
- var _this = this;
if (this.log.isEnabled()) {
this.log.writeLine("#" + requestId + " with arguments'" + JSON.stringify(args) + "'.");
}
- var command = this.npmPath + " install " + args.join(" ") + " --save-dev";
+ var command = this.npmPath + " install " + args.join(" ") + " --save-dev --user-agent=\"typesInstaller/" + ts.version + "\"";
var start = Date.now();
- this.exec(command, { cwd: cwd }, function (err, stdout, stderr) {
- if (_this.log.isEnabled()) {
- _this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + stdout + ts.sys.newLine + "stderr: " + stderr);
- }
- onRequestCompleted(!err);
- });
+ var stdout;
+ var stderr;
+ var hasError = false;
+ try {
+ stdout = this.execSync(command, { cwd: cwd });
+ }
+ catch (e) {
+ stdout = e.stdout;
+ stderr = e.stderr;
+ hasError = true;
+ }
+ if (this.log.isEnabled()) {
+ this.log.writeLine("npm install #" + requestId + " took: " + (Date.now() - start) + " ms" + ts.sys.newLine + "stdout: " + (stdout && stdout.toString()) + ts.sys.newLine + "stderr: " + (stderr && stderr.toString()));
+ }
+ onRequestCompleted(!hasError);
};
return NodeTypingsInstaller;
}(typingsInstaller.TypingsInstaller));
diff --git a/node_modules/typescript/package.json b/node_modules/typescript/package.json
index 1e155af85..cd55aa06f 100644
--- a/node_modules/typescript/package.json
+++ b/node_modules/typescript/package.json
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
- "version": "2.2.0-dev.20161115",
+ "version": "2.2.0-dev.20161127",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [